i have to distinguish between palm and elbow in my contour(I'm using cvconvexitydefect for that purpose). Here's the image:


I'm taking contour of left image.

the 2 topmost points in right image are shoulder(detected by other method)

bottom left 2 are darker than bottom right 2 (to distinguish between left and right hand)

using the code defect.start is darker than defect.end(but for left hand defect.start is palm while for right hand defect.start is elbow)

I have 2 questions:

  1. So how does cvconvexity defect get it's defect.start?
  2. In any case how to differentiate palm from elbow?

To be clear i thought that i could make out the palm from elbow just by thinking that start might be upper most point of a contour or leftmost point of that but it ain't so.

here's the relevant part of code:

cvFindContours( HeadLess1, mem, &contours, sizeof(CvContour), CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0));

    CvConvexityDefect defect,cd;

    for(int l=0;l<tem->total;l++){

        //a bad inference for the case when palm is above elbow
    } else { 
        //a bad inference same case


    cvCircle(HeadLess1, *(defect.end), 10, cvScalarAll(q+50), CV_FILLED);


Headless1 one is my image. Thanks in advance.

  • $\begingroup$ Please ask if something is unclear. Thank you. $\endgroup$ Jun 7, 2012 at 10:05
  • $\begingroup$ just to know: how are you getting this image? $\endgroup$
    – nkint
    Jun 19, 2012 at 9:44

1 Answer 1


If you can obtain coordinates for the points you show in the right hand image, and you know the points relating to the shoulders, could you presume that the palms were further from the shoulder than the elbow is?

If you assume this to be true, then you simply need to find the distance from the shoulder to the elbow & palm and call the point with the larger distance the palm.

Of course, you could bend your arm in such a way that the palm would be closer to the elbow, so perhaps this isn't an ideal method...

  • $\begingroup$ But I can't assume that. Thanks Anyways. But there's got to be a method by which cvConvexityDefect calculates it's starting point. $\endgroup$ Jun 7, 2012 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.