1 | initial version |
I think the best way to detect foot is by edge detection. You should try some morphological operations and then you can use some edge detection techniques (canny, sobel operator, gradient etc). If all the images are gonna be like the one you posted then the strongest edge or the biggest component(if you apply some global thresholding) will be your leg. I think to remove some false positives you can do some texture analysis (texture of the foot and background are totally different), histogram analysis (to get the color difference) and generate a classifier. After your component has been classified you can get the rectangle surrounding the foot easily. Just find the min x, min y, max x, max y values. So your height will be (max y - min y) and width will be (max x - min x) or just use the inbuilt function of opencv.
2 | No.2 Revision |
I am assuming you mean length of rectangle when you say height.
I think the best way to detect foot is by edge detection. You should try some morphological operations and then you can use some edge detection techniques (canny, sobel operator, gradient etc). If all the images are gonna be like the one you posted then the strongest edge or the biggest component(if you apply some global thresholding) will be your leg. I think to remove some false positives you can do some texture analysis (texture of the foot and background are totally different), histogram analysis (to get the color difference) and generate a classifier. After your component has been classified you can get the rectangle surrounding the foot easily. Just find the min x, min y, max x, max y values. So your height will be (max y - min y) and width will be (max x - min x) or just use the inbuilt function of opencv.
If you want the actual height of the leg then you will have to c alculate the disparity and depth map of the image.