Analyze a line of pixels.
Posted: 2018-11-25T14:03:58-07:00
Hi,
I'm not sure if IM can do this, but it can do a lot, so I'd thought I'd ask.
We're involved in a large historical postcard digitization project. Waiting for the scanner to scan is a significant portion of the workflow so we currently scan three cards at a time. Typically, the three cards will be roughly the same size and each takes roughly the same portion of the scanning bed surface. In this case, it's simple to use IM to chop the scans into the top, middle, and bottom cards along predefined chop lines between the cards.
Sometimes, though, the cards are larger and only two, or even one can be scanned at a time. I've been considering creating a chop-line finder script. The first step was to create smaller working copies of the roughly 5000x7000, raw, color bitmaps. Resizing them to about 200x280 seems like it should have enough information to find the gaps between cards. Then I cropped a 1x280 line right down the center of the image. I now have a line of pixels through which I can look for segments that are the value of our scanning background (roughly IM's gray(56)).
After becoming thoroughly fed up with working with batch files, I'm going to tackle this in PowerShell scripts.
My question is, do I need to figure out how to...
- read the bitmap pixel values from the hex in the .BMP files into an array
- figure out a method for detecting the gray sections
...or can IM just do one, or both of those tasks for me? I suspect there might be something in those "fx" options that might do.
Thanks.
I'm not sure if IM can do this, but it can do a lot, so I'd thought I'd ask.
We're involved in a large historical postcard digitization project. Waiting for the scanner to scan is a significant portion of the workflow so we currently scan three cards at a time. Typically, the three cards will be roughly the same size and each takes roughly the same portion of the scanning bed surface. In this case, it's simple to use IM to chop the scans into the top, middle, and bottom cards along predefined chop lines between the cards.
Sometimes, though, the cards are larger and only two, or even one can be scanned at a time. I've been considering creating a chop-line finder script. The first step was to create smaller working copies of the roughly 5000x7000, raw, color bitmaps. Resizing them to about 200x280 seems like it should have enough information to find the gaps between cards. Then I cropped a 1x280 line right down the center of the image. I now have a line of pixels through which I can look for segments that are the value of our scanning background (roughly IM's gray(56)).
After becoming thoroughly fed up with working with batch files, I'm going to tackle this in PowerShell scripts.
My question is, do I need to figure out how to...
- read the bitmap pixel values from the hex in the .BMP files into an array
- figure out a method for detecting the gray sections
...or can IM just do one, or both of those tasks for me? I suspect there might be something in those "fx" options that might do.
Thanks.