locked
CameraCaptureUI showing image at 90 degrees on portrait device

    Question

  • Hi,

    We use CameraCaptureUI.captureFileAsync in an 8.0 Store app to capture a photo. We don't set orientation, the camera automatically rotates correctly depending on the rotation of the device. We just got access to a portrait device (camera on the narrow side rather than long side) and the camera is always at 90 degrees. This happens also when running the CameraCaptureUI Sample from the Windows Samples pack.

    Would anyone know if this is an issue with the CameraCaptureUI class itself, and either way how we can put in a workaround, i.e. how to know the camera is on portrait edge and then rotate the camera if appropriate?

    Thanks

    Monday, September 30, 2013 5:20 PM

Answers

  • Hello,

    You are correct the CameraCaptureUI does not allow you to specify the geometric aperture of the saved file directly. By using the MediaCapture API you can use the sensor API on the device to determine the orientation and then specify the orientation to the MediaCapture API that will allow the proper geometric aperture to be saved in the out put file. Unfortunately there is no simple solution here.

    That said can you please confirm for us that this issue is specific to this device by trying your app on a similar device by another vendor? It is possible that this behavior is specific to the device.

    Thanks,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    • Marked as answer by Kangshung Friday, October 4, 2013 1:20 PM
    Thursday, October 3, 2013 10:01 PM
    Moderator

All replies

  • Hello,

    Does the device have orientation sensors? If the orientation sensors are not reporting the correct value the CameraCaptureUI it will not know how to modify the geometric aperture to set the proper orientation in the output file header. If you choose to use the MediaCapture API you can manually set the orientation by calling SetRecordRotation. You will still need to know the actual orientation of the device and if this information is not available you will likely need to prompt the user for the orientation in some way.

    I hope this helps,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Monday, September 30, 2013 10:36 PM
    Moderator
  • You can also check that the camera's device metadata reports it the correct location. See Identifying the location of internal cameras

    --Rob

    Monday, September 30, 2013 10:39 PM
    Moderator
  • Thank you for the replies James and Rob. The device is an 8 inch tablet (I should have specified that!) with the camera at the top when in portrait orientation, like on a phone. It seems to me like their could be a bug with CameraCaptureUI because every app that uses that class has an issue on this device, but the inbuilt camera application is oriented correctly.I've tried the CameraCaptureUI sample from both Windows 8 and Windows 8.1 sample packs.

    What I'm seeing with CameraCaptureUI is that regardless of the orientation of the tablet initially, the video preview when taking the photo is showing up rotated 90 degrees counterclockwise. As the tablet is rotated the OS automatically rotates the feed but since the starting point is incorrect it stays 90 degrees off.

    Rob, I tried getting the camera location by using Windows.Devices.Enumeration.Panel (this is html/js app) but it just reports the camera as being 'front' (it's not a bit field so it reports front or back, I don't see how it could report "front top" or "back left" for example).

    We rely on CameraCaptureUI to capture a photo with a cropping area of a specific size, the capture is full screen and it would be a lot of work to replicate all of that with MediaCapture. I don't see any way of changing the starting camera orientation with CameraCaptureUI, and even if we moved to MediaCapture I'm not seeing a way of knowing the camera is 'wrong' on the portrait device.


    • Edited by Kangshung Tuesday, October 1, 2013 4:39 PM Addressed wrong person, plus clarified comment
    Tuesday, October 1, 2013 3:12 PM
  • Hello,

    You are correct the CameraCaptureUI does not allow you to specify the geometric aperture of the saved file directly. By using the MediaCapture API you can use the sensor API on the device to determine the orientation and then specify the orientation to the MediaCapture API that will allow the proper geometric aperture to be saved in the out put file. Unfortunately there is no simple solution here.

    That said can you please confirm for us that this issue is specific to this device by trying your app on a similar device by another vendor? It is possible that this behavior is specific to the device.

    Thanks,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    • Marked as answer by Kangshung Friday, October 4, 2013 1:20 PM
    Thursday, October 3, 2013 10:01 PM
    Moderator
  • Hi James,

    I just got another similar device from another vendor this morning with a similar camera location. Everything works as expected on that, so it looks like the problem is device-specific and not a problem with any Windows API. The rest of your post confirmed my thinking so far, we'll need to revert to the device manufacturer, I'll mark this as answered and thank you for your help.

    Thanks,
    Conor

    Friday, October 4, 2013 1:20 PM