Page 1 of 1

Identify if flipping is needed and flip

Posted: 2016-07-30T10:33:40-07:00
by pski
I have two tifs that are similar. What happens during normal processing of the original is it has gotten the alpha channel removed and some functions have been applied to the image. Unfortunately, to my dismay despite asking them to fix it, the processing that is done "sometimes" flips the image and rotates it. What I'm trying to do is figure out the most efficient and best way to identify if a flip is needed since these images are generally multi-gigbyte files. Below is the input and the output in a case where the image was flipped (I shrunk them down from the 1.5GB original):

Original: https://www.dropbox.com/s/yk3td3xizxvr1 ... l.tif?dl=0
Flipped: https://www.dropbox.com/s/jzbodrpw68xcp ... d.tif?dl=0

To get the corrected image I'd need to run the following:

Code: Select all

convert UpsideDownModified.tif -rotate 180 -flop Corrected.tif
I'm using "ImageMagick 6.8.9-8 Q16 x64 2014-08-26" on Windows 10.

Re: Identify if flipping is needed and flip

Posted: 2016-07-30T12:12:16-07:00
by pski
My original thought would be to extract the alpha channel from the original, and then take all the black pixels from the "possibly flipped" and make them alpha, compare the alpha channels, And if it's within some reasonable variance (since the output may have black pixels that I care about that are now identified as alpha) then don't flip otherwise do flip. It just seems like there would be a better way to answer this question

Re: Identify if flipping is needed and flip

Posted: 2016-07-30T12:15:38-07:00
by snibgo
pski wrote:... trying to do is figure out the most efficient and best way to identify if a flip is needed ...
From your samples, I don't know what visual feature determines whether a flip is needed.

Re: Identify if flipping is needed and flip

Posted: 2016-07-30T14:26:41-07:00
by pski
I updated the photos with larger versions (1200 pixels). Towards the pixel coordinates 437,37 in the original, there's a blue circle (it's water) and in the flipped version, it's the black hole at the bottom This is also a screenshot showing what I mean: http://screencast.com/t/R4AN5RJECaZ

Re: Identify if flipping is needed and flip

Posted: 2016-07-30T14:28:32-07:00
by fmw42
If all your images do not have such a unique marker and in the same relative location, then I do not see how that helps.

I, too, do not see any way to identify whether the image needs flipping, unless you have some key marker that you know where it should be in the original image.