Description
Describe the feature
The raw image data provided by some sensors needs to be treated as mirrored and/or rotated before further processing or display on a screen. Real-world cameras use the EXIF Orientation tag to record this information (https://sirv.com/help/articles/rotate-photos-to-be-upright/#exif-orientation-values). This hint cannot currently be represented in OSI, so generators of CameraSensorView
messages are forced to reorganize the pixel values in CameraSensorView::image_data
to match the sensor coordinate system to prevent confusion about how to interpret the image data for receivers.
Instead of forcing this byte-reordering step, The CameraSensorViewConfiguration
should have a way to preserve this orientation hint in the CameraSensorViewConfiguration, indicating how the data in CameraSensorView::imageData
should be interpreted.
Describe the solution you would like
Add an integer field "orientation" (required, default 1, range 1..8) to CameraSensorViewConfiguration to indicate how the image data should be interpreted (or how a sensor/sensor simulator should fill the image_data field). The integer values should correspond to the orientation values of the exif data (i.e. 1 = "image is in correct orientation", 4 = "image has been flipped back-to-front and is upside down", etc.)
Describe alternatives you have considered
- use separate boolean field for "mirrored" and a rotation enum (ROTATE_0, ROTATE_90, ROTATE_180, ROTATE_270)
- Using negative values in field_of_view_vertical and _horizontal to indicate flipped data (=>rotation not possible)
- Adding new channel formats to indicate flipped / rotated data
Describe the backwards compatibility
By choosing the default "orientation = 1", backwards compatibility is maintained.
Additional context
EXIF specification https://web.archive.org/web/20180921145139if_/http://www.cipa.jp:80/std/documents/e/DC-010-2017_E.pdf
Examples for flipped image data:
- OpenGL image coordinates (0,0 is bottom left) vs "standard" image coordinates (0, 0 is top left)
- Cameras used as mirror replacements
- model-specific technical details of the camera/sensor chip