I'm doing my final project about hand gesture recognition using OpenCV in Android. So far I did until Convex Hull. Now, I want to draw
convexity defect on it and get the defect value from it. But I am stack. I found some references codes, but most of it written in C++ code. I have no idea how to convert them into Java android code. Anyone, Would you mind to help me by convert this code? this is the C++ code :
for( int i = 0; i< contours.size(); i++ )
{
size_t count = contours[i].size();
if( count <300 )
continue;
vector<Vec4i>::iterator d=convdefect[i].begin();
while( d!=convdefect[i].end() ) {
Vec4i& v=(*d);
int startidx=v[0]; Point ptStart( contours[i][startidx] );
int endidx=v[1]; Point ptEnd( contours[i][endidx] );
int faridx=v[2]; Point ptFar( contours[i][faridx] );
float depth = v[3] / 256;
line( drawing, ptStart, ptEnd, Scalar(0,255,0), 1 );
line( drawing, ptStart, ptFar, Scalar(0,255,0), 1 );
line( drawing, ptEnd, ptFar, Scalar(0,255,0), 1 );
circle( drawing, ptFar, 4, Scalar(0,255,0), 2 );
d++;
}
}
I would be glad if you can solve this for me, because it's for my final project. Thanks a lot.