1 | initial version |
my solution is
threshold(mat_part[i], mat_part[i], 0, 255, CV_THRESH_BINARY + CV_THRESH_OTSU);
findContours(mat_part[i],contour,CV_RETR_TREE,CV_CHAIN_APPROX_SIMPLE);
for(k = 0; k < contour.size(); k++)
{
///skip contours with smaller size than specified area
double area = contourArea(contour[k]);
if (area > area_max)
{
area_max = area;
index_of_area_max = k;
}
}
for(size_t j = 0; j < contour[index_of_area_max].size();j++) // run until j < contours[i].size();
{
pold = pixel;
pixel = Point(contour[index_of_area_max][j]); //do whatever
if (pixel.x > 10 && pixel.x < (max_x-10))
{
line_to_draw.push_back(pixel);
}
aproximation to line with my own function
print out
Thanks Folks!