Detecting multiple images in one image file
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Detecting multiple images in one image file
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
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
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
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Detecting multiple images in one image file
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
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?
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?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Detecting multiple images in one image file
See
https://imagemagick.org/script/command- ... essing.php
https://imagemagick.org/Usage/reference.html
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/basics/
https://imagemagick.org/script/command-line-options.php
https://imagemagick.org/script/sitemap.php
https://imagemagick.org/script/architecture.php
https://imagemagick.org/script/resources.php
https://imagemagick.org/script/command- ... essing.php
https://imagemagick.org/Usage/reference.html
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/basics/
https://imagemagick.org/script/command-line-options.php
https://imagemagick.org/script/sitemap.php
https://imagemagick.org/script/architecture.php
https://imagemagick.org/script/resources.php