I could find contours of an object in an image by using findContours.
and by using this I could crop the object contours.
Dist.copyTo(crop, mask);
now, I need to find the index of crop Image in Dist image.
to do that I converted the Mat into the float to pointer and I called it cropped!
and then I tried this:
for(int j=0; j < (Dist.rows * Dist.cols); j++){
if(cropped[j] != 0 ){
row = (j / width) + ((Dist.rows));
col = (j % width) + (Dist.cols);
}
Index.push_back(std::make_pair(row,col));
}
But it does not give me any correct answer...