# Revision history [back]

Well, after hard work I have a solution. I look forward your inputs, ideas and improvments.

First, I did some noise removal to obtain cleaner lines

Mat se = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(7,7));
Imgproc.morphologyEx(grayOnly, grayOnly, Imgproc.MORPH_OPEN, se);


Then HoughLines transform as I did before, this time the image is cleaner

I have drawn the lines with a large thickness to obtain a single object in the image

Imgproc.line(result, pt1, pt2, new Scalar(0, 0, 0), 35);


Last step, the most important, I applied Zhang Suen thinning alghoritm (skeletonization). I found a good reference here

The final result is the following

Well, after hard work I have a solution. I look forward your inputs, ideas and improvments.improvements.

First, I did some noise removal to obtain cleaner lines

Mat se = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(7,7));
Imgproc.morphologyEx(grayOnly, grayOnly, Imgproc.MORPH_OPEN, se);


Then HoughLines transform as I did before, this time the image is cleaner

I have drawn the lines with a large thickness to obtain a single object in the image

Imgproc.line(result, pt1, pt2, new Scalar(0, 0, 0), 35);


Last step, the most important, I applied Zhang Suen thinning alghoritm (skeletonization). I found a good reference here

The final result is the following

The approximation seems good