Skip to content

Commit be2975c

Browse files
authored
fix(IBA): reorient() cases for transpose and transverse (#5350)
Orientations 5 and 7 were swapped: case 5 produced transverse and case 7 produced transpose. Fix both cases. This adds reorient() tests covering all 8 values to the oiiotool-xform testsuite, and updates the python-imagebufalgo reorient() test to use the new test image for consistency. Also, add orientation example images to documentation. Fixes #4661 Signed-off-by: Luna Kim <177369799+luna-y-kim@users.noreply.github.com>
1 parent f17c4b4 commit be2975c

24 files changed

Lines changed: 55 additions & 28 deletions

src/doc/figures/orientation1.jpg

10.3 KB
Loading

src/doc/figures/orientation2.jpg

10.3 KB
Loading

src/doc/figures/orientation3.jpg

10.3 KB
Loading

src/doc/figures/orientation4.jpg

10.3 KB
Loading

src/doc/figures/orientation5.jpg

10.3 KB
Loading

src/doc/figures/orientation6.jpg

10.3 KB
Loading

src/doc/figures/orientation7.jpg

10.3 KB
Loading

src/doc/figures/orientation8.jpg

10.3 KB
Loading

src/doc/stdmetadata.rst

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,22 @@ Description of the image
7474
Display hints
7575
=============
7676

77+
.. |orient1img| image:: figures/orientation1.jpg
78+
:height: 1 in
79+
.. |orient2img| image:: figures/orientation2.jpg
80+
:height: 1 in
81+
.. |orient3img| image:: figures/orientation3.jpg
82+
:height: 1 in
83+
.. |orient4img| image:: figures/orientation4.jpg
84+
:height: 1 in
85+
.. |orient5img| image:: figures/orientation5.jpg
86+
:width: 1 in
87+
.. |orient6img| image:: figures/orientation6.jpg
88+
:width: 1 in
89+
.. |orient7img| image:: figures/orientation7.jpg
90+
:width: 1 in
91+
.. |orient8img| image:: figures/orientation8.jpg
92+
:width: 1 in
7793

7894
.. option:: "Orientation" : int
7995

@@ -83,16 +99,16 @@ Display hints
8399
`"Orientation"` field can suggest that it should be displayed with
84100
a different orientation, according to the TIFF/EXIF conventions:
85101

86-
=== ==========================================================================
87-
1 normal (top to bottom, left to right)
88-
2 flipped horizontally (top to bottom, right to left)
89-
3 rotated :math:`180^\circ` (bottom to top, right to left)
90-
4 flipped vertically (bottom to top, left to right)
91-
5 transposed (left to right, top to bottom)
92-
6 rotated :math:`90^\circ` clockwise (right to left, top to bottom)
93-
7 transverse (right to left, bottom to top)
94-
8 rotated :math:`90^\circ` counter-clockwise (left to right, bottom to top)
95-
=== ==========================================================================
102+
=== ============ ==========================================================================
103+
1 |orient1img| normal (top to bottom, left to right)
104+
2 |orient2img| flipped horizontally (top to bottom, right to left)
105+
3 |orient3img| rotated :math:`180^\circ` (bottom to top, right to left)
106+
4 |orient4img| flipped vertically (bottom to top, left to right)
107+
5 |orient5img| transposed (left to right, top to bottom)
108+
6 |orient6img| rotated :math:`90^\circ` clockwise (right to left, top to bottom)
109+
7 |orient7img| transverse (right to left, bottom to top)
110+
8 |orient8img| rotated :math:`90^\circ` counter-clockwise (left to right, bottom to top)
111+
=== ============ ==========================================================================
96112

97113
.. option:: "PixelAspectRatio" : float
98114

src/libOpenImageIO/imagebufalgo_orient.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,15 +363,15 @@ ImageBufAlgo::reorient(ImageBuf& dst, const ImageBuf& src, int nthreads)
363363
case 3: ok = ImageBufAlgo::rotate180(dst, src, ROI(), nthreads); break;
364364
case 4: ok = ImageBufAlgo::flip(dst, src, ROI(), nthreads); break;
365365
case 5:
366-
ok = ImageBufAlgo::rotate270(tmp, src, ROI(), nthreads);
366+
ok = ImageBufAlgo::rotate90(tmp, src, ROI(), nthreads);
367367
if (ok)
368368
ok = ImageBufAlgo::flop(dst, tmp, ROI(), nthreads);
369369
else
370370
dst.errorfmt("{}", tmp.geterror());
371371
break;
372372
case 6: ok = ImageBufAlgo::rotate90(dst, src, ROI(), nthreads); break;
373373
case 7:
374-
ok = ImageBufAlgo::flip(tmp, src, ROI(), nthreads);
374+
ok = ImageBufAlgo::flop(tmp, src, ROI(), nthreads);
375375
if (ok)
376376
ok = ImageBufAlgo::rotate90(dst, tmp, ROI(), nthreads);
377377
else

0 commit comments

Comments
 (0)