Implementation of GrabCut algorithm using face detection
I want to create a body detection software for images using grabCut opencv c++ implementation. I have already the position of faces in the images. Therefore I want to use the information of image in order to caluclate the body bounding box using grabCut (in order to calculate the foreground). I am using the following imgproc implemenation of grabCut algorithm:
cv::grabCut(image, // input image
result, // segmentation result
faces.at(0),// rectangle containing foreground
bgModel,fgModel, // models
5, // number of iterations
cv::GC_INIT_WITH_RECT); // use rectangle
Where faces.at(0) the first face in the image. The result mask contain only area near the face. How can I get the whole containing area of the foreground( my body in that case)?
I would suggest you to compute the rectangle of the body from the face. eg: if all the persons are standing you can suppose that the face is proportional to the body, but it seems that it is varying (wiki says)
Yes sometimes the body does not take straightforward poses. Therefore it is not the best idea to calculate the boundingbox using the face. I want to calculate the boundingbox using grabcut and the face as input to grabCut algorithm.
"rect - It is the coordinates of a rectangle which includes the foreground object in the format (x,y,w,h)" so your body is going to be treated as background. That is why I said "you need to compute the rect of the body"
Ok I got it. However is there any implementation in which I can get the body using grabCut? I mean something like that http://docs.opencv.org/3.0-beta/doc/p...