Help Me Find the Edge of This

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dotmoe
Posts: 1
Joined: 2013-05-07T00:38:39-07:00
Authentication code: 6789

Help Me Find the Edge of This

Post by dotmoe »

Hey,
I have been tinkering with this for a while. I tried Alpha - trim - fuzz - but I cant get it so that its crops out everything except the two boxes.
Image
Can you please help me?

I am on Windows.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Help Me Find the Edge of This

Post by anthony »

That is very hard.

as the two boxes are touching, it become especially hard.
The real question is how variable is the input images. Do the boxes move around, do they overlap, and so on.

Best idea is first try and clean up the umage using Morphology Erode or Smooth to remove any 'thin lines'
http://www.imagemagick.org/Usage/morphology/#channel
then examine that image to find the edges of the two boxes. Once you have the information you can then apply it crop the original image.

Another technique is to scale the image (using ignore aspect flag '!' ) down to one row of pixels. This will average all the columns and from that you can segment where one box ends and another begins. A graph (profile) of that single row of images can help in figuring out thresholds and noise limits.

When you have horizontal placements, repeat vertically (scale all rows to a single column) to find the box row limits.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply