Page 2 of 2
Re: Align Hole Punches
Posted: 2019-04-29T13:43:15-07:00
by bwroga
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.
Re: Align Hole Punches
Posted: 2019-04-29T15:07:59-07:00
by snibgo
"-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.
Re: Align Hole Punches
Posted: 2019-05-04T13:36:48-07:00
by bwroga
snibgo wrote: ↑2019-04-28T04:29:36-07:00
Can you take it from there? If you need help, I suggest you link to a couple of sample scans.
I got it working! Thanks for your help!