Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Finger count and convexity defects providing wrong value

I have retrieved convexity defects and after referring to some questions asked here, I figured out that Convexity defect contains data in 4s, i.e., [startIndex, endIndex, farthestPoint, depth].

So I retrieved the all these values and drew circles at the points (except depth). Following is the code which I used to do that.

    for (int j = 0; j < convexDefect.toList().size(); j = j+4) {

        if(farPoint.y < a){

            MODELConvexityDefects convexityDefects = new MODELConvexityDefects();





    // Draws all the points from defect data
    MODELConvexityDefects convexityDefects;

    for (int i = 0; i < convexityData.size(); i++) {

        convexityDefects = new MODELConvexityDefects();
        convexityDefects = convexityData.get(i);

                    // Green, convexityDefects.getStartIndex(), 6, new Scalar(0,154,0));
                    // Orange, convexityDefects.getEndIndex(), 6, new Scalar(0,154,246)); 
                    // Red, convexityDefects.getFarthestPoint(), 6, new Scalar(0,0,255));

The output I got is not really desirable one. Please tell me what am I doing wrong here.


If you notice I'm not able to get the farthest point correctly and the thumb is completely neglected.