Get segments sizes in image and remove small segments
Hi, I'm new to openCV, can't find what is the way to do basic segmentation on a binary image and get segments (with black pixels) sizes, then delete small segments from image with given threshold. The example image is below
Is that a representative sample image? As in, you're always looking for a straightish line across the whole image?
If so, I suggest the Hough Line Transform, link text
Another way could be to invert your binary, and then do Connected Components, throwing away anything that doesn't meet your size expectations.