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.
some image samples would help I think
also, due to pinhole model, from a single camera, you will only be able to get exact dimensions, if you either know the distance, or have some reference-scale object in your image
@berak yes I am using coin as a reference scale object. But how I can detect and measure rectangle of specific foot.
@theodore Image would be like put the foot on the surface with one coin(specificied) as a refence and Image of foot. Now I want opencv create a rectangle on foot and give me length and width. Though I'll soon update a Image here.
@theodore I have added a sample image please check it.
Plane are not parallel (foot and camera plane) so it would be difficult with only one coin. With two coin I think it's possible to estimate foot length
@LBerger Lets Assume if foot and camera plane are parallel, then how we can measure height and width of foot.
Of course you cannot find height and width. But your coin give you a length estimation small image region. You can say that 's this value is true everywhere (order 0). If you 've got focal length you can interpolate this value everywhere.
Agian this method is not calibrattion process but can give you some good estimation...