Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
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 :
C++
/// Draw convexityDefects
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.
Posted
Updated 16-Jun-15 18:29pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900