Taylor Posted August 27, 2014 Report Share Posted August 27, 2014 Despite all my efforts to defeat this problem, it continues to be a bug in my workflow for photogrammetry. To get a good lens calibration in Photoscan, you shoot calibration images by rotating the camera -90 and +90 degrees along with the horizontal images in a sequence of overlapping positions. I've set my camera not to rotate pictures, so the calibration shots should appear as normal horizontal images, with the top of the object in the image facing right or left, depending on the camera rotation. However, the camera exif data apparently still records the image orientation and when I import the images into Lightroom, they're all rotated vertically so the top of the object is pointing up and the images are in portrait orientation, not landscape. Lightroom 4 doesn't allow you to set a preference to ignore image orientation during import, so it automatically rotates the images whether you like it or not. When you export the images as TIFFs or JPEGs, they're all rotated so the object appears oriented right-side-up. I've tried using Photoshop CS6 to open the same DNGs that were imported into Lightroom, after I set PS6 preferences to ignore image orientation, but it still rotates them into portrait mode. Photoscan has a pair of buttons that allow you to rotate the images right or left 90 degrees after they're uploaded to the workspace window, but this doesn't affect how Photoscan uses the images for calibration--Photoscan still thinks the sensor has portrait dimensions with the shorter side at the bottom, instead of the longer side. Therefore, Photoscan groups all the vertically oriented images into a separate calibration instead of using them to refine the calibration for the horizontal images. This is a maddening problem because once you've created masks for your images, the masks have to have the same orientation as the images or Photoscan won't allow you to apply the same masks that you created using rotated images to the unrotated images. If you un-rotate the original images, you also have to remove rotation information for the masks to allow them to align properly, or Photoscan won't let you re-import the masks. I've heard that some use Windows Explorer to remove image orientation data, but I don't have Windows on all my Macs, and I've heard there are also problems with Windows applying lossy compression to JPEGs when it rotates them--very bad behavior! How do I defeat the image rotation problem? This gets very time consuming for projects with hundreds of images. Link to comment Share on other sites More sharing options...
leszekp Posted August 27, 2014 Report Share Posted August 27, 2014 Try this: http://annystudio.com/software/jpeglosslessrotator/ Seems to work fine for me. Has built-in Windows shell integration, so you can select multiple photos in a folder, right-click on and losslessly rotate them left or right. Doesn't affect the EXIF data. Link to comment Share on other sites More sharing options...
cdschroer Posted August 27, 2014 Report Share Posted August 27, 2014 In our workflow we use Adobe Camera Raw (ACR) which comes with photoshop. If the images are not auto-rotated by the camera, then they come in un-rotated to ACR. And you can export tiffs or jpegs as you wish. I am surprised that Lightroom doesn't let you set a preference to ignore the auto-rotate setting. I personally haven't tried this in lightroom. Carla Link to comment Share on other sites More sharing options...
marlin Posted August 27, 2014 Report Share Posted August 27, 2014 Taylor! bummer that you're bumping into this issue. That must be painful. As Carla mentioned, we're not having this issue. Auto-Off images from our capture devices (canons) open w the correct orientation in ACR. And as she mentions, we don't, at this time, use LR. Maybe you might want to make sure that you're using the most recent version(s) of LR and the most recent version of your cameras firm ware. Also double check to see if LR fully supports your camera as well as its file type. I'm genuniely curious about this issue. Hope you get it resolved soon. marlin. Link to comment Share on other sites More sharing options...
Taylor Posted August 28, 2014 Author Report Share Posted August 28, 2014 Thanks, leszekp, Carla, and Marlin. The ideal solution, I suppose, would be to stop my camera from recording the camera orientation data in the exif file, but that doesn't seem to be a possibility. Regarding the tool leszekp suggested, it would be nice to have something similar for Mac OS X, since I don't want to install Windows on my laptop, although I have Windows 7 on one of my Macs and I could use it there. I think the exif orientation reset feature is more important than the ability for lossless rotation, since I prefer not to use Windows. The problem I experienced goes beyond just the rotation of the image: unrotating the images is easy, but in a previous project Photoscan still assumed the sensor dimensions based on the exif orientation, so merely unrotating them didn't allow Photoscan to use them for calibration along with the horizontal images--it still grouped them separately and gave them a separate calibration. I was able to open the unrotated images in Photoshop by setting Preferences to ignore the image rotation, so they'd appear as normal landscape images, but then I couldn't get Photoscan to import the masks. I think I had to unrotate the masks as well (which are .png files). For some reason now Photoshop isn't allowing me to do that (unless I'm just confused about what I did the last time I went through this mess). However, as Carla said, I can unrotate them in ACR and save them and then they appear as normal landscape images in Bridge. I'll try this and see how Photoscan responds. I hate having to realign hundreds of images, but I suppose there's no alternative. I just downloaded the latest update to Lightroom 5 on another computer and it still doesn't allow you to ignore the orientation exif data during import--a major shortcoming of Lightroom, in my opinion, although otherwise it's a good program. Link to comment Share on other sites More sharing options...
marlin Posted August 28, 2014 Report Share Posted August 28, 2014 Taylor, Can you remind me, what camera are you using? What lens? Curious. Can you try a quick test w/ a completely different camera to see if you can reproduce the flaws? (again, just curious). Marlin Link to comment Share on other sites More sharing options...
Taylor Posted August 29, 2014 Author Report Share Posted August 29, 2014 Hi Marlin, I have a Panasonic GH2, modified for UV-Vis-IR. I don't have another camera to try. I can set it so it doesn't rotate the images in the LCD display, but it still records the orientation in the exif data. I can just unrotate the images in Lightroom or ACR, now that I understand the problem better. I mistakenly thought that just disabling the image rotation in the camera setting would suffice. Unfortunately, I had already made my masks based on the rotated images, and I had to redo the masks after I unrotated the images and added them to the Photoscan workspace. In the future, I just need to remember to unrotate the images before exporting them from Lightroom and adding them to Photoscan. By the way, I also shot reflected UVA images of the back of the stretcher of the painting while doing visible-range photogrammetry. The RUVA images are a bit noisy because I had to increase the ISO to 1600 for 60-sec exposures, but they'll be registered with the visible images so I'll have both a visible and RUVA model of the back of the stretcher to complement the multispectral 3D model of the front of the painting. Can you suggest any good noise-reduction software, or is Photoshop as good as any? Link to comment Share on other sites More sharing options...
Taylor Posted August 29, 2014 Author Report Share Posted August 29, 2014 P.S.: It helps to have notes on your capture sequence, especially if there's any variation in your calibration sequence (order of camera rotation). I tried to be consistent in the direction I rotated the camera, but I was glad I had notes for the exception among hundreds of images, so I could reverse the rotation in Lightroom. LR doesn't provide metadata on the image orientation (at least I couldn't easily find it) and once the images are auto-rotated, they look the same whether they were rotated clockwise or counter-clockwise. It's important to unrotate them back to their original orientation if you want Photoscan to use them for calibration. In Bridge, I had to add the image orientation to the list of camera exif data that are displayed--it's not in the default list. Link to comment Share on other sites More sharing options...
cdschroer Posted August 29, 2014 Report Share Posted August 29, 2014 Thanks for the additional notes about this Taylor. Very helpful to have this. Carla Link to comment Share on other sites More sharing options...
ozbigben Posted March 27, 2016 Report Share Posted March 27, 2016 I'm starting to deal with images from multiple photographers now. To get around any camera settings I created a drag and drop batch file (Windows) for EXIFTool that strips out the offending metadata. FOR %%a in (*.*) DO c:\cmd\exiftool.exe -overwrite_original -orientation= %%a Link to comment Share on other sites More sharing options...
cdschroer Posted March 28, 2016 Report Share Posted March 28, 2016 I'm not sure exactly what problem you are trying to solve with this script. We very strongly advise that everyone set their cameras to turn OFF auto-rotate. If that didn't happen, and you strip the flag, it seems like images that might have come in rotated now for sure won't have a flag saying they are rotated. In Photoscan when it groups images for camera calibration, it will put images that came in in portrait mode in a different calibration set (due to different dimensions) than those coming in in landscape mode. This is not helpful for getting a high quality camera calibration. A related point: If the flag is there, PhotoScan will honor it. If the flag is incorrect, then that is a problem because PhotoScan will honor it incorrectly. Maybe you are removing the flag in RAW files before you make tiffs or jpegs, or whatever you are going to put into the PG software? Then this makes more sense, as the software to create the subsequent files wouldn't rotate the image. It seems best to have unrotated images where everything comes in in landscape mode regardless of how the camera was pointed. I get that if someone sends you images where this isn't true that it's difficult to sort it out, but is it possible that stripping this flag and resetting it could actually cause problems - especially if you are doing this to jpegs or tiffs? Carla Link to comment Share on other sites More sharing options...
ozbigben Posted March 29, 2016 Report Share Posted March 29, 2016 I use that script whenever the orientation has been set by the camera to remove the flag from the source files before any further processing. Images load in landscape in every application after this. It's essentially the same thing as correcting the orientation in Lightroom/Bridge... changing the orientation from a variable to a fixed value (you could alternatively set the orientation to a specific setting) but it's automated and not dependent on the user knowing the actual direction of rotation. If you need to document the original camera orientation for whatever reason you could also use EXIFTool to create a table of these values prior to removing them (in the same script), but then the orientation tends to be quite random when the camera is pointing downwards so it's not a particularly reliable flag. I always advise people to turn the orientation off too, but I always have a backup plan Link to comment Share on other sites More sharing options...
cdschroer Posted March 30, 2016 Report Share Posted March 30, 2016 If you are working on the original raw files before you make jpegs or tiffs or whatever you are planning to use in the photogrammetry software, then this makes sense. If you do it after, then the images could be rotated and then have an incorrect flag due to this script. Thanks for the explanation. Carla Link to comment Share on other sites More sharing options...
ozbigben Posted March 31, 2016 Report Share Posted March 31, 2016 It shouldn't really make any difference which derivative is being processed as the flag doesn't change the image data, it's just an instruction for software for what to do with the image when it opens. It is not a setting that defines the orientation of the camera. e.g. if you take a 4000x3000px and rotate it 90° in Lightroom it will set the flag to correspond with the rotation angle required to put the image in the displayed orientation when opened. Explorer will still show the image as 4000x3000px. If you open the image in Photoshop it will have an asterisk next to it's name in the window title indicating that it has been modified. When you save this image, it will now be a 3000x4000px image and the orientation flag will be set to 0 (horizontal) as no rotation is required. As long as the files haven't been edited, changing the orientation of any derivatives can be undone by removing the orientation flag. Link to comment Share on other sites More sharing options...
macsurveyr Posted March 31, 2016 Report Share Posted March 31, 2016 The orientation flag is a problem. There are a couple of ways that the flag can get changed in a way that causes problems. The simplest way to cause a problem is to look at an image in Windows explorer and rotate it while looking at it. The image will get saved as if the NORMAL viewing rotation is now as you were last viewing it. - essentially destroying the flag. Say you copy the image first and then rotate the copy - destroy the flag. Now add both those photos to PhotoScan. PhotoScan will think they were taken by two different cameras and separate them. For camera calibration purposes, they should be the same camera. It can be very difficult to know which way to unrotate images back to the original way especially with images taken from a UAS. RAW files can have the flag. If images are opened in camera raw and appear rotated, then exporting them as a tif or jpg will create a file that is rotated but the flag says it is not. Again, two cameras in PhotoScan when there should only be one. Just need to be sure before destroying the flag. Link to comment Share on other sites More sharing options...
ozbigben Posted April 2, 2016 Report Share Posted April 2, 2016 Yes, if you do different things to the same set of images it will cause problems... but then that would be potentially causing problems irrespective of whether the flag exists or not. I was merely providing this for a situation where you're assuming that the image is a relatively raw image set direct from the camera. If you're manually correcting orientation in Lightroom or Bridge when the flag exists there is the potential to make an error, setting the flag to either 0 or 180° rotation. Removing the flag in this instance sets it to the original sensor image. P.S.: It helps to have notes on your capture sequence, especially if there's any variation in your calibration sequence (order of camera rotation). I tried to be consistent in the direction I rotated the camera, but I was glad I had notes for the exception among hundreds of images, so I could reverse the rotation in Lightroom. LR doesn't provide metadata on the image orientation (at least I couldn't easily find it) and once the images are auto-rotated, they look the same whether they were rotated clockwise or counter-clockwise. It's important to unrotate them back to their original orientation if you want Photoscan to use them for calibration. In Bridge, I had to add the image orientation to the list of camera exif data that are displayed--it's not in the default list. In Taylor's situation, manually rotating images even with the value of the flag visible is going to take a lot of time that could be saved by merely removing the flag. I run this script prior to any image processing, and if anyone has provided me with images that have already had some processing done, then that would be their problem for not following instructions... but most people are understandably happy not to do anything extra themsleves. Link to comment Share on other sites More sharing options...
Taylor Posted April 3, 2016 Author Report Share Posted April 3, 2016 Fortunately, I haven't had this difficulty recur in a long time, but if I do, I'll try running ozbigben's script. Thanks for the discussion! Taylor Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.