This project has moved. For the latest updates, please go here.

Crop subimage from main

Dec 27, 2015 at 12:30 PM
Hi. I need process large massive of scanned images. Actually after filters and other I have picture like this:
How can i split it for simple object? From example picture i need to get 6 separate pictures or rectangles with it. Can i do it with Magick.Net?
Dec 30, 2015 at 5:26 AM
This can be done with 'ConnectedComponents' but with the current API it is not easy to get the coordinates. We are working on changing the API to make this easier and the next version of Magick.NET will return the coordinates or images of these objects. I will come back to this post when that is completed and post an example.
Jan 2, 2016 at 10:02 AM
Thank for reply! Happy new year!
At this monent i have simple images. But dont have any idia how trim and rotate it.
I tried make rotate with hough lines and calculate angle, but it work not always.
Is has other method how can i rotate and trim image?
I would be grateful for any help!
Jan 2, 2016 at 2:54 PM
I just added the new API for connected components and I included the image that you supplied for that in a unit test. The result is 6 images that contain the individual stamps. I will add a link to the unit test after I have completed the rest of the changes.

But then you will run into the issue that you have to 'unrotate' the individual images. I am also working on porting Fred Weinhaus his scripts to C# ( The script unrotate ( seems to do exactly what you what. But it might be a while before I have time to port that script. And if you want to use it commercially you will need to pay a small license fee.