3
$\begingroup$

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

http://imageshack.us/content_round.php?page=done&l=img194/5232/capture12a.jpg

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));

for(ptr=contours;ptr!=0;ptr=ptr->h_next){
    tem=cvConvexHull2(ptr,0,1,0);
    tem=cvConvexityDefects(ptr,tem,mem);
    CvConvexityDefect defect,cd;
    defect.depth=0;

    for(int l=0;l<tem->total;l++){
        cd=*(CvConvexityDefect*)cvGetSeqElem(tem,l);
        if(cd.depth>defect.depth)defect=cd;
    }

    if((*(defect.start)).y>(*(defect.end)).y){
        elbow=(*(defect.start));palm=(*(defect.end));
        //a bad inference for the case when palm is above elbow
    } else { 
        elbow=(*(defect.end));palm=(*(defect.start));
        //a bad inference same case
    }

    if(elbow.x<320)
    {
        q=100;
    }
    else
    {
        q=200;
    }

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

}

Headless1 one is my image. Thanks in advance.

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

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...

$\endgroup$
  • $\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$ – Roney Island Jun 7 '12 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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