I understand the return is a pointer to the first sequence of the whole contour sequence.
but when I analyze the contour (sequences), how shall I connect all of them? I am a little confusing because if I want to derive information from the contour, I am not sure how exactly I should start.
for example, I have the test1_edge (in the attachment)
I use the following code to draw the contour
int nContour = cvFindContours( tempEdge.getCvImage(), storage, &contours, sizeof(CvContour), CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0));
for( ; contours != NULL; contours = contours->h_next ){ // Search for the bigger countour
float area = fabs( cvContourArea(contours, CV_WHOLE_SEQ) );
printf("area: %f\n", area);
cvDrawContours(contourImg.getCvImage(), contours, getRandomColor(), cvScalar(128,128,128,0), 1, 2, 8, cvPoint(0,0));
}
the returned value from findContour has 5 items, and each of them has a different area, 2.5, 5.5, 3.5, 5.5, 4.0
btw, the getRandomColor returns the next color of a fixed list (red, green, blue, yellow, pink, purple, skyblue…
I could use cvStartReadSeq to read the points along a given sequence, but they are only on one sequence. The most confusing part is, if it’s in real time (input from camera), how can I know what sequence I should connect to analyze as one single hand?
For example, if I have 2 hands, the findContour gives me 7 sequences, and strangely, I have 3 of them have 0 area. The area of those sequences are: 0, 20.5, 0, 5.5, 18, 0, 28 (from the first to the last).
what I really want are,
- getting all sequences that belong to one hand together so I can associate one “contour” with another information I already have;
- if I can get (1), I hope I can derive where the palm is, and the direction of the finger is pointing (in angle).
could anyone help me understand how to use the findContour to analyze what I want?
Thank you very much!