add option to never rotate photos (ignore Orientation tags)

Issue #280 new
Matthew Arnison created an issue

For computer vision processing of RAW files, it is often essential to work with photos that are consistently oriented with respect to the camera (so that up in the image points towards the top of the camera). However, normally when photos are processed, they are rotated using an Orientation or CameraOrientation tag according to the camera’s orientation with respect to gravity, so that they are presented on screen with up on the screen pointing away from the centre of the Earth.

It would be helpful to have an ART profile option that disables the effect of the *Orientation tags, so that all photos are oriented with respect to the camera.

Comments (4)

  1. agriggio repo owner

    Hi,

    I think you should be able to do this already with custom dynamic profile rules. The “trick” would be to trigger different rules according to the image orientation value (Exif.Image.Orientation tag), in which each of the rule would undo the effect of applying the initial orientation. For example, something like this:

    where left_bottom.arp contains the following:

    [Version]
    AppVersion=1.18.1
    Version=1039
    
    [Coarse Transformation]
    Rotate=90
    HorizontalFlip=false
    VerticalFlip=false
    

    You would need a separate profile for each orientation that you care about, but after that it should work…

  2. Matthew Arnison reporter

    Thank you so much for investigating this and giving a detailed recipe for achieving it.

    Unfortunately, I missed some important context in my initial suggestion. We are using the ART CLI, and in fact we are already doing something quite similar in our ART calling code to detect the orientation and then undo any rotation that ART has applied.

    The problem is that we have discovered the orientation logic is quite complicated. For example, with Canon cameras, it seems if the camera has Auto-rotate switched off (it defaults to on), then the Orientation tag and the CameraOrientation tags are different (normally they are the same) and different raw processing engines are interpreting this situation differently. (We are still verifying this Auto-rotate behaviour so take it with a grain of salt.)

    We could detect and fix this case, but after looking at the rotation logic (by searching for flip in dcraw.cc), it looks quite complex and reversing the rotation in an outer layer seems likely to be fragile and error-prone.

    I did notice that dcraw includes a user_flip parameter in main() which disables rotation when it is set to 0. So this behaviour could potentially be emulated in rawimage.cc. For the libraw case, libraw already exposes the user_flip parameter but it’s currently unused by ART.

    I might experiment with a patch.

  3. agriggio repo owner

    Hi, thanks for the explanation. Then let’s say that if you come up with a patch that adds a checkbox in the “raw preprocessing” section to ignore the exif orientation, I’ll be happy to integrate it

  4. Log in to comment