Page 2 of 2
Re: Detecting multiple images in one image file
Posted: 2019-10-11T16:04:09-07:00
by fmw42
The listing from connected components when you use verbose=true in the define will show all the bounding boxes. So you just need to parse the output to get them. Once you have them, you can use -crop with those bounding boxes to extract each image one at a time. You will have to script these parts.
Re: Detecting multiple images in one image file
Posted: 2019-10-16T18:16:25-07:00
by dcotto
Hey it works great!
the only issue im having is that the images arent cropping to exactly the same in the master sheet. For instance ill have 2 or more images in the one master sheet ...200x300, 425 x 500 .. .
im using the command below:
convert niceoutput-chopped.png -define connected-components:area-threshold=410 -define connected-components:verbose=true -connected-components 4 objects.png
With the command you gave me it works great but theres only small pixel differences after i use the command above. ill get 201x302, 426x502.
I guess the settings in -define connected-components:area-threshold=410 and -connected-components 4 may need to be configured. but not sure if the issue could be in the other command... mind you that i have about 2px black border around all images in my master sheet..not sure if that 2px black border is interfereing with the black background with the command you gave me last
Is there anyway to force it to be 100% of the exact everytime
i need to make sure the size is exactly the same size
Re: Detecting multiple images in one image file
Posted: 2019-10-16T19:40:07-07:00
by fmw42
If there is noise in your image or other data, then the regions may touch and include other things than your exact images and so be larger. Did you threshold or flood fill first? Did you try changing the area-threshold? Use as large a value as you can such that it is smaller than the area of your smallest image. You can try removing noise before flood filling also.
Re: Detecting multiple images in one image file
Posted: 2019-10-17T10:59:21-07:00
by dcotto
Yes one great thing that helped was increasing the fuzz to 10%. that seems to work well.
Thank you again for all your help.
its hard to understand imagemagick. I really wish there was a more thorough book out there thats up to date. ill have to go through documenation for now.
Do you know of any good books or tutorials out there that explain the process of a image file.. for instance i know photoshop and i know channels, Alpha, Green, Blue, Red. I want to know the autonomy of an image and its data and what it contains pertaining to how imagemagick works with those image files would you be able to know where i can begin my journey?
Re: Detecting multiple images in one image file
Posted: 2019-10-17T13:38:46-07:00
by fmw42