Export (0) Print
Expand All

Camera Rotation (Windows CE 5.0)

Windows CE 5.0
Send Feedback

Applies to: Devices based on Windows Mobile Version 5.0 and later

If you are creating a camera application that will run on a portable device, your application should account for both the physical orientation of the device and the orientation of the shell on the device. The physical orientation of the device relates directly to the orientation of the imaging sensor relative to the physical world. The orientation of the devices shell is the orientation of your applications display environment relative to the physical device.

It is important for your application to be orientation-aware so that it can make the correct compensations both when it displays images to the user, and also when it writes the captured image data to a file. The tables and diagrams later in this topic show how your camera application should handle the various combinations of image, device, and shell orientations.

The following design principles will help you create camera applications that maximize image quality and provide an intuitive experience for the user.

  • Use as many of the pixels on your sensor as possible.
  • Align the output from the viewfinder with the subject. What the user sees in the viewfinder should align with what they see in the real world.
  • Thumbnails should align with the subject, provided device has not moved. Another way to understand this is that the thumbnail should be recorded in the orientation that the user saw the subject.

Implementation Considerations for Camera Applications

When the shell is rotated, the camera application must change the aspect ratio of the preview window by transposing the height and width of the image size reported by the camera driver. For example, if the camera reports a still image resolution of with a 4:3 aspect ration, the camera application must create a preview window that has the same 4:3 aspect ratio when the shell is rotated.

The Microsoft Image Sink Filter has built-in support for both sensor and shell orientation. If you use this filter, you do not need to make any additions to the filter graph to handle rotation. Third party image sink filters and encoder DMOs must consider the shell rotation when persisting images from the source filter to storage. In particular, the file sink must counter-rotate images. For example, if the shell is rotated +90 degrees (to the right), then the sink filter must rotate the image by -90 (to the left). This guarantees that when the file is viewed, it will exhibit the same image as was seen in the viewfinder at the time of capture.

Implementation Considerations for Drivers

Camera drivers must mark all captured images as pre-rotated and flip the image vertically. This way, if the device is rotated, the display driver will apply the correct rotation when the image is rendered. Camera driver developers must add the BI_SRCPREROTATE flag to the biCompression field of the BITMAPINFOHEADER structure for each media type.

Display drivers must respect the BI_SRCPREROTATE flag on bitmaps. They also must be able to efficiently execute scaling and cropping operations.

Landscape Sensor Orientation

A device with a landscape sensor orientation has its sensor mounted to the device in a way that produces an image in landscape orientation when the device is not physically rotated. In all the tables below, viewfinder rotation is noted as the amount the shell is rotated relative to the viewfinder

Shell and device are aligned

 Viewfinder = 0Viewfinder = -90Viewfinder = +90
Device orientationAa452495.camera_land_s0_v0(en-us,MSDN.10).gifAa452495.camera_land_s0_v-90(en-us,MSDN.10).gifAa452495.camera_land_s0_v+90(en-us,MSDN.10).gif
Orientation of image as written to storageAa452495.camera_land_thumb_0(en-us,MSDN.10).gifAa452495.camera_port_thumb_-90(en-us,MSDN.10).gifAa452495.camera_port_thumb_+90(en-us,MSDN.10).gif

Shell is rotated -90 relative to the device

 Viewfinder = 0Viewfinder = -90Viewfinder = +90
Device orientationAa452495.camera_land_s-90_v0(en-us,MSDN.10).gifAa452495.camera_land_s-90_v-90(en-us,MSDN.10).gifAa452495.camera_land_s-90_v+90(en-us,MSDN.10).gif
Orientation of image as written to storageAa452495.camera_port_thumb_0(en-us,MSDN.10).gifAa452495.camera_land_thumb_+90(en-us,MSDN.10).gifAa452495.camera_land_thumb_-90(en-us,MSDN.10).gif

Shell is rotated +90 relative to the device

 Viewfinder = 0Viewfinder = -90Viewfinder = +90
Device orientationAa452495.camera_land_s+90_v0(en-us,MSDN.10).gifAa452495.camera_land_s+90_v-90(en-us,MSDN.10).gifAa452495.camera_land_s+90_v+90(en-us,MSDN.10).gif
Orientation of image as written to storageAa452495.camera_port_thumb_0(en-us,MSDN.10).gifAa452495.camera_land_thumb_+90(en-us,MSDN.10).gifAa452495.camera_land_thumb_-90(en-us,MSDN.10).gif

Portrait Sensor Orientation

A device with a portrait sensor orientation has its sensor mounted to the device in a way that produces an image in portrait orientation when the device is not physically rotated. In all the tables below, viewfinder rotation is noted as the amount the shell is rotated relative to the viewfinder.

Shell and device are aligned

 Viewfinder = 0Viewfinder = -90Viewfinder = +90
Device orientationAa452495.camera_port_s0_v0(en-us,MSDN.10).gifAa452495.camera_port_s0_v-90(en-us,MSDN.10).gifAa452495.camera_port_s0_v+90(en-us,MSDN.10).gif
Orientation of image as written to storageAa452495.camera_port_thumb_0(en-us,MSDN.10).gifAa452495.camera_land_thumb_+90(en-us,MSDN.10).gifAa452495.camera_land_thumb_-90(en-us,MSDN.10).gif

Shell is rotated -90 relative to the device

 Viewfinder = 0Viewfinder = -90Viewfinder = +90
Device orientationAa452495.camera_port_s-90_v0(en-us,MSDN.10).gifAa452495.camera_port_s-90_v-90(en-us,MSDN.10).gifAa452495.camera_port_s-90_v+90(en-us,MSDN.10).gif
Orientation of image as written to storageAa452495.camera_land_thumb_0(en-us,MSDN.10).gifAa452495.camera_port_thumb_+90(en-us,MSDN.10).gifAa452495.camera_port_thumb_-90(en-us,MSDN.10).gif

Shell is rotated +90 relative to the device

 Viewfinder = 0Viewfinder = -90Viewfinder = +90
Device orientationAa452495.camera_port_s+90_v0(en-us,MSDN.10).gifAa452495.camera_port_s+90_v-90(en-us,MSDN.10).gifAa452495.camera_port_s+90_v+90(en-us,MSDN.10).gif
Orientation of image as written to storageAa452495.camera_land_thumb_0(en-us,MSDN.10).gifAa452495.camera_port_thumb_+90(en-us,MSDN.10).gifAa452495.camera_port_thumb_-90(en-us,MSDN.10).gif

See Also

Video Capture


Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft