autodetection of portrait-images
Posted: 2009-02-24T03:39:15-07:00
Hello,
my scanner supports scanning slides in landscape and portrait-mode. My idea is to do a quick preview-scan in landscape-mode, use some magic IM-command-sequence to find out if the image really is landscape or not and then scan the slide with the correct orientation.
If the image is in portrait-orientation but scanned as landscape, I will have an image where the left-quarter and the right-quarter of the image are black (the slide is 36x24mm, but the scan only captures the center of the portrait-mode slide which is 24x36mm). So the idea is to extract these two regions, do some noise-removal and compare against a pure black image. If the difference is low, than it should be a portrait-image. If it is high, it is in landscape orientation.
What is the most efficient way to do that?
Thanks, Bernhard
my scanner supports scanning slides in landscape and portrait-mode. My idea is to do a quick preview-scan in landscape-mode, use some magic IM-command-sequence to find out if the image really is landscape or not and then scan the slide with the correct orientation.
If the image is in portrait-orientation but scanned as landscape, I will have an image where the left-quarter and the right-quarter of the image are black (the slide is 36x24mm, but the scan only captures the center of the portrait-mode slide which is 24x36mm). So the idea is to extract these two regions, do some noise-removal and compare against a pure black image. If the difference is low, than it should be a portrait-image. If it is high, it is in landscape orientation.
What is the most efficient way to do that?
Thanks, Bernhard