Ok guys found a solution finally!
- Use tophat morphology on the gray image. This enhances the line cuts along with noise
- Use line filter and rotate it by 10 degrees.
e.g. Mat kernel = (cv::Mat_<float>(3, 3) << -1, 4, -1,
-1, 4, -1,
-1, 4, -1;
(Now only the straight contours remain)
- Check the aspect ratio of the contours and store if it exceeds a threshold.
- Check for collinearity of the contours. If the length of collinear segment is more than a threshold, declare it as a line cut.
This algorithm is working good for me