Reputation: 1145
I have to remove some lines from the sides of hundreds of grayscale images.
In this image lines appear in three sides.
The lines are not consistent though, i.e, they appear above, below, left and/or right side of the image. And they are of unequal length and width.
Upvotes: -1
Views: 1292
Reputation: 20264
If you could assume that the borders are free of important information, you may crop the photo like this:
C++ code:
cv::Mat img;
//load your image into img;
int padding=MAX_WIDTH_HEIGHT_OF_THE LINEAS_AREA
img=img(cv::Rect(padding,padding,img.cols-padding,img.rows-padding));
If not, you have to find a less dumb solution like this for example:
Another solution, assuming the handwritten shape is connected:
Another solution, asuming that the handwritten shape could be discontinuity :
P.S. I did not touch HoughLine transform since I do not about the shapes. I assume that some of them may contain very straight lines.
Upvotes: 1