Hi guys, Have anyone could help me resolve this issue, or have any idea. Original
After applying a series of algorithms, I have the following result.
How to draw line look like bellow.
I have to apply HoughLineP but not good.
Code ``` pyrMeanShiftFiltering( img, res, spatialRad, colorRad, maxPyrLevel );
//imshow( "ShiftFiltering", res );
cvtColor(res, res, COLOR_RGBA2GRAY);
GaussianBlur(res, res, Size(15, 15), 0);
//imshow( "GaussianBlur", res );
adaptiveThreshold(res, res, 255, ADAPTIVE_THRESH_GAUSSIAN_C, THRESH_BINARY_INV, 11, 1);
//imshow( "adaptiveThreshold", res );
Mat element = getStructuringElement (MORPH_RECT, Size(3, 3));
morphologyEx(res, res, MORPH_CLOSE, element);
Mat edgs;
Canny(res, edgs, 750, 800, 3);
vector<Vec4f> lines3;
HoughLinesP(edgs, lines3, 1, CV_PI / 180, 20, 15, 10);
Mat markEdges = Mat(res.size(), CV_8UC3);
for (size_t i = 0; i < lines3.size(); i++)
{
Vec4f l = lines3[i];
double dest = euclideanDist(Point2f(l[0], l[1]), Point2f(l[2], l[3]));
if (dest > 10) {
line(markEdges, Point2f(l[0], l[1]), Point2f(l[2], l[3]), Scalar(0, 0, 255), 2, LINE_AA);
}
}
imshow("markEdges", markEdges);
``` I have applied segment image (watershed) but not good.