Here's the code I am using for Convexity Defects and have searched a lot online for its solution, unfortunately I have seen the question, but never a solution posted worked out, if someone has ever used Convexity Defects kindly help....
vector<vector <Vec4i> > convdefect(contours.size());
vector<vector<Point> >hull( contours.size() );
vector<vector<Point> >hull1( contours.size() );
vector<vector<int> >hull2;
if(hull2[i].size() > 3 && hull2[i].size() > 2 )
{
convexityDefects(Mat(contours[i]),hull2[i],convdefect[i]);
}