How to divide the contents of a monochrome image into separate files?

asked 2014-08-20 08:20:05 -0500

fyodor gravatar image

Actually, there is some image (bmp / ​​jpg / png) which contains a number of objects with polygonal boundaries. Objects are in the picture as you like (may be very close to each other), but do not intersect. image description link Image link

The goal is to break the software image is a plurality of other images, each of which will contain a separate monochrome elements. What algorithms can advise? Maybe there is something in OpenCV, that will let you know the coordinates of the extreme points (x1, y1, x2, y2) and already using, for example, QImage-> copy to copy the selected portion of the QImage and save it (to transfer to another component).

PS> In thinking came up with an option enter data in two-dimensional array (black - 0, w - 1) and already out of it in some way to allocate groups of zeros and write them somewhere else. Accordingly, from somewhere back into a file and save (to work on with him). What could be better than this option?

edit retag flag offensive close merge delete

Comments

1

look at findcontours and come back ?

berak gravatar imageberak ( 2014-08-20 08:28:33 -0500 )edit

The contours of the image obtained is quite simple. And as the set of loops scattered on individual files

fyodor gravatar imagefyodor ( 2014-08-20 11:03:44 -0500 )edit

"And as the set of loops scattered on individual files" - mind explaining that ?

berak gravatar imageberak ( 2014-08-20 11:34:30 -0500 )edit