Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How can I find defect points?

I want to find gand and palm. I used below algorithm :

1- Get a frame from webcam 2- Convert to grayscale, apply blur and threshold method. 3- Use canny method and findContours 4- Find the contour which has max area, draw it 5- Find and draw convex hull 6- Apply convexityDefects

My result is below :

image description

I wanted to find palm center. For this, I used below code after defects was found.

It calculates average of defects point's coordinate. But the result is not good bacause the defect points aren't found regularly. How can I get better result?

int x = 0,y = 0;
    for(int i = 0; i < defects.size(); i++) {

        Point p1 = contours[maxAreaIndex].at(defects[i].val[2]);
        x += p1.x;
        y += p1.y;
    }

    // draw a circle for palm center
    circle(drawing, Point(x/defects.size(), y/defects.size()), 3, Scalar( 0, 255, 0 ), 3);

How can I find defect points?

I want to find gand hand and palm. I used below algorithm :

1- Get a frame from webcam 2- Convert to grayscale, apply blur and threshold method. 3- Use canny method and findContours 4- Find the contour which has max area, draw it 5- Find and draw convex hull 6- Apply convexityDefects

My result is below :

image description

I wanted to find palm center. For this, I used below code after defects was found.

It calculates average of defects point's coordinate. But the result is not good bacause the defect points aren't found regularly. How can I get better result?

int x = 0,y = 0;
    for(int i = 0; i < defects.size(); i++) {

        Point p1 = contours[maxAreaIndex].at(defects[i].val[2]);
        x += p1.x;
        y += p1.y;
    }

    // draw a circle for palm center
    circle(drawing, Point(x/defects.size(), y/defects.size()), 3, Scalar( 0, 255, 0 ), 3);

How can I find defect points?

I want to find hand and palm. I used below algorithm :

1- Get a frame from webcam 2- Convert to grayscale, apply blur and threshold method. 3- Use canny method and findContours 4- Find the contour which has max area, draw it 5- Find and draw convex hull 6- Apply convexityDefects

My result is below :

image description

I wanted to find palm center. For this, I used below code after defects was found.

It calculates average of defects point's coordinate. But the result is not good bacause the defect points aren't found regularly. How can I get better result?

int x = 0,y = 0;
    for(int i = 0; i < defects.size(); i++) {

        Point p1 = contours[maxAreaIndex].at(defects[i].val[2]);
        x += p1.x;
        y += p1.y;
    }

    // draw a circle for palm center
    circle(drawing, Point(x/defects.size(), y/defects.size()), 3, Scalar( 0, 255, 0 ), 3);