From 102ef46e424036d52fbf450bb82cabbd1ca8dca7 Mon Sep 17 00:00:00 2001 From: RIFJo Date: Thu, 15 Dec 2022 15:11:33 +0100 Subject: [PATCH 1/8] (feat SensorModelling) add pixel_order field refers to #620 Adds a "pixel_order" field and enum to allow mirrored versions of the pixel layouts. This is the result of the discussions with the participants in the sensor modelling workgroup meetings. Signed-off-by: RIFJo --- osi_sensorview.proto | 6 ++-- osi_sensorviewconfiguration.proto | 46 +++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/osi_sensorview.proto b/osi_sensorview.proto index a890261a7..9259d8bca 100644 --- a/osi_sensorview.proto +++ b/osi_sensorview.proto @@ -313,8 +313,10 @@ message CameraSensorView // Raw image data. // - // The raw image data in the memory layout and order specified by the - // camera sensor input configuration. + // The raw image data in the memory layout specified by the camera sensor + // input configuration. Default pixel order is left-to-right, top-to-bottom + ///(think of scan lines in a TV), but modifications can be + // requested/indicated in CameraSensorViewConfiguration.pixel_order. // optional bytes image_data = 2; } diff --git a/osi_sensorviewconfiguration.proto b/osi_sensorviewconfiguration.proto index e5c45c8f7..c765ccf41 100644 --- a/osi_sensorviewconfiguration.proto +++ b/osi_sensorviewconfiguration.proto @@ -729,6 +729,52 @@ message CameraSensorViewConfiguration // repeated WavelengthData wavelength_data = 11; + // Indicates if and how the the pixel data is ordered + // + // By default, the pixel data is is left-to-right, top-to-bottom. + // + // \note for rotations of the pixel data, use the camera coordinate system + // + optional PixelOrder pixel_order = 12; + + // Pixel layout + // + // Pixel layout documents the order of pixels in the \c image_data + // in CameraSensorView. + // + // \note this enum does not contain an entry to do mirroring upside down + // and left-to-right at the same time, because this is equivalent to a 180° + // rotation, which should be indicated in the sensor coordinate system + // + enum PixelOrder + { + // Pixel order is unknown (must not be used). + // + PIXEL_ORDER_UNKNOWN = 0; + + // Unspecified but unknown pixel order. + // Consider proposing an additional format if using + // \c #PIXEL_ORDER_OTHER. + // + PIXEL_ORDER_OTHER = 1; + + // Pixel data is not mirrored (Default). + // Pixels are ordered left-to-right, top-to-bottom + // + PIXEL_ORDER_DEFAULT = 2; + + // Pixel data is mirrored along the vertical axis. + // The image is mirrored left-to-right. + // + PIXEL_ORDER_MIRRORED_LEFT_RIGHT = 3; + + // Pixel data is mirrored along the horizontal axis. + // The image is mirrored top-to-bottom. + // + PIXEL_ORDER_MIRRORED_UP_DOWN = 4; + } + + // Channel format. // enum ChannelFormat From 912f9309c71e421e418a17663613d3f81d2b9ffa Mon Sep 17 00:00:00 2001 From: RIFJo Date: Mon, 19 Dec 2022 09:42:39 +0100 Subject: [PATCH 2/8] Documentation update after review replace non-ascii character, clarify PIXEL_ORDER_OTHER documentation Signed-off-by: RIFJo --- osi_sensorviewconfiguration.proto | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osi_sensorviewconfiguration.proto b/osi_sensorviewconfiguration.proto index c765ccf41..c612c9226 100644 --- a/osi_sensorviewconfiguration.proto +++ b/osi_sensorviewconfiguration.proto @@ -733,7 +733,7 @@ message CameraSensorViewConfiguration // // By default, the pixel data is is left-to-right, top-to-bottom. // - // \note for rotations of the pixel data, use the camera coordinate system + // \note for rotations of the pixel data, use the camera coordinate system. // optional PixelOrder pixel_order = 12; @@ -743,8 +743,9 @@ message CameraSensorViewConfiguration // in CameraSensorView. // // \note this enum does not contain an entry to do mirroring upside down - // and left-to-right at the same time, because this is equivalent to a 180° - // rotation, which should be indicated in the sensor coordinate system + // and left-to-right at the same time, because this is equivalent to a + // 180-degree rotation, which should be indicated in the sensor coordinate + // system. // enum PixelOrder { @@ -752,7 +753,7 @@ message CameraSensorViewConfiguration // PIXEL_ORDER_UNKNOWN = 0; - // Unspecified but unknown pixel order. + // Known pixel order that is not supported by OSI. // Consider proposing an additional format if using // \c #PIXEL_ORDER_OTHER. // From f63077f3d62627b4f2f78ec0b6b2a131571353a3 Mon Sep 17 00:00:00 2001 From: RIFJo Date: Mon, 19 Dec 2022 10:09:08 +0100 Subject: [PATCH 3/8] FIX documentation (triple-slash) remove triple-slash that causes python-test fail Signed-off-by: RIFJo --- osi_sensorview.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osi_sensorview.proto b/osi_sensorview.proto index 9259d8bca..8447a3c23 100644 --- a/osi_sensorview.proto +++ b/osi_sensorview.proto @@ -315,7 +315,7 @@ message CameraSensorView // // The raw image data in the memory layout specified by the camera sensor // input configuration. Default pixel order is left-to-right, top-to-bottom - ///(think of scan lines in a TV), but modifications can be + // (think of scan lines in a TV), but modifications can be // requested/indicated in CameraSensorViewConfiguration.pixel_order. // optional bytes image_data = 2; From 0819913843d1637ada5d658f224aa9b00380705d Mon Sep 17 00:00:00 2001 From: ClemensLinnhoff Date: Fri, 3 Mar 2023 11:50:37 +0100 Subject: [PATCH 4/8] Changed pixel order enum for explicit definition; adjusted documentation Signed-off-by: ClemensLinnhoff --- osi_sensorview.proto | 4 +--- osi_sensorviewconfiguration.proto | 30 +++++++++++++----------------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/osi_sensorview.proto b/osi_sensorview.proto index 8447a3c23..fcf28fb35 100644 --- a/osi_sensorview.proto +++ b/osi_sensorview.proto @@ -314,9 +314,7 @@ message CameraSensorView // Raw image data. // // The raw image data in the memory layout specified by the camera sensor - // input configuration. Default pixel order is left-to-right, top-to-bottom - // (think of scan lines in a TV), but modifications can be - // requested/indicated in CameraSensorViewConfiguration.pixel_order. + // input configuration. The pixel order is specified in CameraSensorViewConfiguration.pixel_order with the default value PIXEL_ORDER_LEFT_RIGHT_TOP_BOTTOM. // optional bytes image_data = 2; } diff --git a/osi_sensorviewconfiguration.proto b/osi_sensorviewconfiguration.proto index c612c9226..73d5c991c 100644 --- a/osi_sensorviewconfiguration.proto +++ b/osi_sensorviewconfiguration.proto @@ -731,9 +731,9 @@ message CameraSensorViewConfiguration // Indicates if and how the the pixel data is ordered // - // By default, the pixel data is is left-to-right, top-to-bottom. + // The default value is PIXEL_ORDER_LEFT_RIGHT_TOP_BOTTOM. // - // \note for rotations of the pixel data, use the camera coordinate system. + // \note For rotations of the pixel data, use the camera coordinate system. // optional PixelOrder pixel_order = 12; @@ -742,9 +742,8 @@ message CameraSensorViewConfiguration // Pixel layout documents the order of pixels in the \c image_data // in CameraSensorView. // - // \note this enum does not contain an entry to do mirroring upside down - // and left-to-right at the same time, because this is equivalent to a - // 180-degree rotation, which should be indicated in the sensor coordinate + // \note this enum does not contain an entry for right-to-left and bottom-to-top, because this is equivalent to a + // 180-degree rotation of the default, which should be indicated in the sensor coordinate // system. // enum PixelOrder @@ -759,20 +758,17 @@ message CameraSensorViewConfiguration // PIXEL_ORDER_OTHER = 1; - // Pixel data is not mirrored (Default). - // Pixels are ordered left-to-right, top-to-bottom + // Pixels are ordered left-to-right, top-to-bottom (default) // - PIXEL_ORDER_DEFAULT = 2; - - // Pixel data is mirrored along the vertical axis. - // The image is mirrored left-to-right. + PIXEL_ORDER_LEFT_RIGHT_TOP_BOTTOM = 2; + + // Pixels are ordered right-to-left, top-to-bottom // - PIXEL_ORDER_MIRRORED_LEFT_RIGHT = 3; - - // Pixel data is mirrored along the horizontal axis. - // The image is mirrored top-to-bottom. - // - PIXEL_ORDER_MIRRORED_UP_DOWN = 4; + PIXEL_ORDER_RIGHT_LEFT_TOP_BOTTOM = 3; + + // Pixels are ordered left-to-right, bottom-to-top + // + PIXEL_ORDER_LEFT_RIGHT_BOTTOM_TOP = 4; } From db690ddefd9020cd30791cf080ed4c3724d2f40e Mon Sep 17 00:00:00 2001 From: RIFJo Date: Wed, 8 Mar 2023 11:56:42 +0100 Subject: [PATCH 5/8] remove UNKNOWN field, put DEFAULT = 0 After discussion in the sensors modelling group, we concluded that UNKNOWN should not be used here, and DEFAULT should be the first field. Also: shorten the lines again, restore old documentation comments see also discussion on the enum guidelines: https://github.com/OpenSimulationInterface/osi-documentation/issues/68 Signed-off-by: RIFJo --- osi_sensorview.proto | 6 ++++-- osi_sensorviewconfiguration.proto | 26 ++++++++++++++------------ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/osi_sensorview.proto b/osi_sensorview.proto index fcf28fb35..7ce3ce884 100644 --- a/osi_sensorview.proto +++ b/osi_sensorview.proto @@ -313,8 +313,10 @@ message CameraSensorView // Raw image data. // - // The raw image data in the memory layout specified by the camera sensor - // input configuration. The pixel order is specified in CameraSensorViewConfiguration.pixel_order with the default value PIXEL_ORDER_LEFT_RIGHT_TOP_BOTTOM. + // The raw image data in the memory layout specified by the camera + // sensor input configuration. The pixel order is specified in + // CameraSensorViewConfiguration.pixel_order with the + // default value PIXEL_ORDER_LEFT_RIGHT_TOP_BOTTOM. // optional bytes image_data = 2; } diff --git a/osi_sensorviewconfiguration.proto b/osi_sensorviewconfiguration.proto index 73d5c991c..1516d85a3 100644 --- a/osi_sensorviewconfiguration.proto +++ b/osi_sensorviewconfiguration.proto @@ -742,32 +742,34 @@ message CameraSensorViewConfiguration // Pixel layout documents the order of pixels in the \c image_data // in CameraSensorView. // - // \note this enum does not contain an entry for right-to-left and bottom-to-top, because this is equivalent to a - // 180-degree rotation of the default, which should be indicated in the sensor coordinate + // \note this enum does not contain an entry to do mirroring upside down + // and left-to-right at the same time, because this is equivalent to a + // 180-degree rotation, which should be indicated in the sensor coordinate // system. // enum PixelOrder { - // Pixel order is unknown (must not be used). + // Pixel data is not mirrored (Default). + // Pixels are ordered left-to-right, top-to-bottom. // - PIXEL_ORDER_UNKNOWN = 0; + PIXEL_ORDER_DEFAULT = 0; // Known pixel order that is not supported by OSI. // Consider proposing an additional format if using // \c #PIXEL_ORDER_OTHER. // PIXEL_ORDER_OTHER = 1; - - // Pixels are ordered left-to-right, top-to-bottom (default) - // - PIXEL_ORDER_LEFT_RIGHT_TOP_BOTTOM = 2; - - // Pixels are ordered right-to-left, top-to-bottom + + // Pixels are ordered right-to-left, top-to-bottom. + // Pixel data is mirrored along the vertical axis. + // The image is mirrored left-to-right. // PIXEL_ORDER_RIGHT_LEFT_TOP_BOTTOM = 3; - // Pixels are ordered left-to-right, bottom-to-top - // + // Pixels are ordered left-to-right, bottom-to-top. + // Pixel data is mirrored along the horizontal axis. + // The image is mirrored top-to-bottom. + // PIXEL_ORDER_LEFT_RIGHT_BOTTOM_TOP = 4; } From 6f91e2d75c43dc13e0441607f228c66aff5090f7 Mon Sep 17 00:00:00 2001 From: RIFJo Date: Wed, 8 Mar 2023 13:06:02 +0100 Subject: [PATCH 6/8] fix documentation reference to default order, explain intended use Signed-off-by: RIFJo --- osi_sensorviewconfiguration.proto | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osi_sensorviewconfiguration.proto b/osi_sensorviewconfiguration.proto index 1516d85a3..e19b3db01 100644 --- a/osi_sensorviewconfiguration.proto +++ b/osi_sensorviewconfiguration.proto @@ -731,7 +731,9 @@ message CameraSensorViewConfiguration // Indicates if and how the the pixel data is ordered // - // The default value is PIXEL_ORDER_LEFT_RIGHT_TOP_BOTTOM. + // The default value (PIXEL_ORDER_DEFAULT) indicates standard image + // pixel order (left-to-right, top-to-bottom). The other values can + // be used to indicate/request mirroring (right to left or bottom to top). // // \note For rotations of the pixel data, use the camera coordinate system. // From a570f63615993c2cb52f13cd96da4303cf22d133 Mon Sep 17 00:00:00 2001 From: RIFJo Date: Wed, 8 Mar 2023 13:44:56 +0100 Subject: [PATCH 7/8] fix enum field indices do not skip index = 2 Signed-off-by: RIFJo --- osi_sensorviewconfiguration.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osi_sensorviewconfiguration.proto b/osi_sensorviewconfiguration.proto index e19b3db01..fc3720ebc 100644 --- a/osi_sensorviewconfiguration.proto +++ b/osi_sensorviewconfiguration.proto @@ -766,13 +766,13 @@ message CameraSensorViewConfiguration // Pixel data is mirrored along the vertical axis. // The image is mirrored left-to-right. // - PIXEL_ORDER_RIGHT_LEFT_TOP_BOTTOM = 3; + PIXEL_ORDER_RIGHT_LEFT_TOP_BOTTOM = 2; // Pixels are ordered left-to-right, bottom-to-top. // Pixel data is mirrored along the horizontal axis. // The image is mirrored top-to-bottom. // - PIXEL_ORDER_LEFT_RIGHT_BOTTOM_TOP = 4; + PIXEL_ORDER_LEFT_RIGHT_BOTTOM_TOP = 3; } From a92e4ac1f1f4517d1fbb1b52b66ed613c813dc46 Mon Sep 17 00:00:00 2001 From: RIFJo Date: Fri, 17 Mar 2023 15:36:28 +0100 Subject: [PATCH 8/8] fix documentation - default-value Signed-off-by: RIFJo --- osi_sensorview.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osi_sensorview.proto b/osi_sensorview.proto index 7ce3ce884..1dd54c459 100644 --- a/osi_sensorview.proto +++ b/osi_sensorview.proto @@ -316,7 +316,7 @@ message CameraSensorView // The raw image data in the memory layout specified by the camera // sensor input configuration. The pixel order is specified in // CameraSensorViewConfiguration.pixel_order with the - // default value PIXEL_ORDER_LEFT_RIGHT_TOP_BOTTOM. + // default value PIXEL_ORDER_DEFAULT (i.e. left-to-right, top-to-bottom). // optional bytes image_data = 2; }