I didn't know that IM had something called connected components, I thought you were just referring to the connected components algorithm in general. That's great.
I think I have a good handle on it. Thanks for your help.
Align Hole Punches
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Align Hole Punches
"-connected-components" is a fairly new operation, added after this thread was started. It directly gives centroids, so is useful here.
The messy part is finding which components are the ones you want. Perhaps some crop will always find the three holes, and no other dark components. In any case, you might have sanity checks:
- The central hole should be between some limits A and B pixels in area.
- The longer acme holes should be between some limits C and D pixels in area.
- The y-coordinates of all three holes should be roughly equal.
- The distance from both longer holes to the central hole should be roughly equal.
These tests could be done in a script.
The messy part is finding which components are the ones you want. Perhaps some crop will always find the three holes, and no other dark components. In any case, you might have sanity checks:
- The central hole should be between some limits A and B pixels in area.
- The longer acme holes should be between some limits C and D pixels in area.
- The y-coordinates of all three holes should be roughly equal.
- The distance from both longer holes to the central hole should be roughly equal.
These tests could be done in a script.
snibgo's IM pages: im.snibgo.com