Search code examples
c#imageopencvemgucv

How to add effects to image


I am new to the image processing.I want to know that how i can add the effects to the image using EmguCV or any other technique.Just like Microsoft LifeCam.(ex. showing hat on the head,showing name on the head etc.)

Please help,thanks in advance.

Update::I am now working with the code

face recognition x86

in that i am using the function currentFrame.Draw(...) to drow the image. now i want to add the new bitmap image with the current image but it showing me the exception.

OpenCV: The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array'

So anything which i will do with the Image myimg.Add()


Solution

  • A good start would be to read the documentation.

    I have used Emgu CV and there is a face detection module, which returns the Rectangle of the persons face. (Haar Cascades)

    Once you have that information it would be easy to position a graphic on top of the image in a location relative to the face.

    The library also supports eye detection so you could draw on glasses using the same method as above.

    It's very easy to use and the documentation is excellent so I would start there.

    Update:

    I found the code I used (Emgu CV) which detects every face in an image and returns a list of rectangles with their locations. (please excuse any poor code quality)

    You will also need to tweak the parameters to suit your needs.

    public List<Rectangle> detect(Bitmap inputImage)
            {
                inImage = new Image<Bgr, byte>(inputImage);
                grayImage = inImage.Convert<Gray, Byte>();
    
                List<Rectangle> faceRects = new List<Rectangle>();
    
                var faces = grayImage.DetectHaarCascade(haar, 1.1, 1, HAAR_DETECTION_TYPE.DO_CANNY_PRUNING, new Size(inImage.Width, inImage.Height))[0];
    
                grayImage.Dispose();
    
                foreach (var face in faces)
                {
                    faceRects.Add(face.rect);                
                }
    
                inImage.Dispose();
                return faceRects;
            }