Skip to content

Commit

Permalink
fix: normalize cleanup (#3963)
Browse files Browse the repository at this point in the history
* Add documentation for oiiotool --normalize

* Add tests for oiiotool --normalize

* Revamp existing normalize tests in testsuite/python-imagebofalgo: Get
rid of old test images and refs, because their values were already
normalized, so was probably not testing the math. Make new tests that
are much smaller, 3x3 images that contain specific (non-normalized)
values to verify they all get normalized corectly. They'll run a lot
faster, too.

Signed-off-by: Larry Gritz <[email protected]>
  • Loading branch information
lgritz authored Aug 31, 2023
1 parent fd8e64a commit 436ab6e
Show file tree
Hide file tree
Showing 36 changed files with 153 additions and 62 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ clang-format: config
# DEPRECATED: 'make dist' is just a synonym for 'make install'
dist : install

TEST_FLAGS += --force-new-ctest-process --output-on-failure --progress
TEST_FLAGS += --force-new-ctest-process --output-on-failure

# 'make test' does a full build and then runs all tests
test: build
Expand Down
32 changes: 32 additions & 0 deletions src/doc/oiiotool.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2557,6 +2557,38 @@ current top image.
Include/exclude subimages (see :ref:`sec-oiiotool-subimage-modifier`).


.. option:: --normalize

Normalize the top image. Assuming the first three channels represent a 3D
vector, divide each pixel by its length to make it unit length. This
function assumes a 3-channel image that represents a 3-vector, or a
4-channel image that represents a 3-vector plus an alpha value. If an
alpha channel is present, its value is merely copied, and is not part of
the normalization computation.

Optional appended modifiers include:

`:incenter=` *float*
The pixel value that corresponds to a 0.0 vector value for the input.
(default: 0.0)

`:outcenter=` *float*
The pixel value that corresponds to a 0.0 vector value for the output.
(default: 0.0)

`:scale=` *float*
The desired length of the output vectors. (default: 1.0)

Example::

# Normalize a floating point image containing vector values:
oiiotool xyzvectors.exr --normalize -o normalized.exr

# Normalize an unsigned integer image where [-1,1] vector values
# are encoded on [0,1] for both input and output:
oiiotool xyzvectors.tif --normalize:incenter=0.5:outcenter=0.5:scale=0.5 -o normalized.tif


.. option:: --noise

Alter the top image to introduce noise, with the option `:type=`
Expand Down
4 changes: 4 additions & 0 deletions src/include/OpenImageIO/imagebufalgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,10 @@ bool OIIO_API pow (ImageBuf &dst, const ImageBuf &A, cspan<float> B,
/// `outCenter=0.5` and `scale=0.5`, but if you want them to be in the range
/// [-1,1], use `outCenter=0.0` and `scale=1.0` (this probably will only work
/// if you intend to write the results in `float` or `half` format).
///
/// Expressed another way, the computation is conceptually:
///
/// out = outCenter + scale * (in - inCenter) / length(in - inCenter)
///
bool OIIO_API normalize(ImageBuf& dst, const ImageBuf& A, float inCenter=0.0f,
float outCenter=0.0f, float scale=1.0f,
Expand Down
Binary file removed testsuite/common/vectorschart_raw.tif
Binary file not shown.
Binary file removed testsuite/common/vectorschart_raw_xyza.exr
Binary file not shown.
Binary file added testsuite/oiiotool/ref/normalize.exr
Binary file not shown.
Binary file added testsuite/oiiotool/ref/normalize_in.exr
Binary file not shown.
Binary file added testsuite/oiiotool/ref/normalize_offsetin.exr
Binary file not shown.
Binary file added testsuite/oiiotool/ref/normalize_offsetscale.exr
Binary file not shown.
Binary file added testsuite/oiiotool/ref/normalize_offsetscaleout.exr
Binary file not shown.
Binary file added testsuite/oiiotool/ref/normalize_scale.exr
Binary file not shown.
10 changes: 10 additions & 0 deletions testsuite/oiiotool/ref/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@ Comparing "cpow1.exr" and "ref/cpow1.exr"
PASS
Comparing "cpow2.exr" and "ref/cpow2.exr"
PASS
Comparing "normalize.exr" and "ref/normalize.exr"
PASS
Comparing "normalize_scale.exr" and "ref/normalize_scale.exr"
PASS
Comparing "normalize_offsetin.exr" and "ref/normalize_offsetin.exr"
PASS
Comparing "normalize_offsetscaleout.exr" and "ref/normalize_offsetscaleout.exr"
PASS
Comparing "normalize_offsetscale.exr" and "ref/normalize_offsetscale.exr"
PASS
Comparing "abs.exr" and "ref/abs.exr"
PASS
Comparing "absdiff.exr" and "ref/absdiff.exr"
Expand Down
10 changes: 10 additions & 0 deletions testsuite/oiiotool/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@
# Test --powc val,val,val... (per-channel powers)
command += oiiotool ("grey128.exr --powc 2,2,1 -o cpow2.exr")

# Test --normalize
command += oiiotool ("src/norm.exr --normalize -o normalize.exr " +
"src/norm.exr --normalize:scale=0.5 -o normalize_scale.exr " +
"src/normoffset.exr --normalize:incenter=0.5 -o normalize_offsetin.exr " +
"src/norm.exr --normalize:outcenter=0.5:scale=0.5 -o normalize_offsetscaleout.exr " +
"src/normoffset.exr --normalize:incenter=0.5:outcenter=0.5:scale=0.5 -o normalize_offsetscale.exr ")


# Test --abs, --absdiff, --absdiffc
# First, make a test image that's 0.5 on the left, -0.5 on the right
command += oiiotool ("-pattern constant:color=-0.25,-0.25,-0.25 64x128 3 "
Expand Down Expand Up @@ -263,6 +271,8 @@
"div.exr", "divc1.exr", "divc2.exr",
"mad.exr", "invert.tif",
"cpow1.exr", "cpow2.exr",
"normalize.exr", "normalize_scale.exr", "normalize_offsetin.exr",
"normalize_offsetscaleout.exr", "normalize_offsetscale.exr",
"abs.exr", "absdiff.exr", "absdiffc.exr",
"chsum.tif",
"rgbahalf-zfloat.exr",
Expand Down
Binary file added testsuite/oiiotool/src/norm.exr
Binary file not shown.
Binary file added testsuite/oiiotool/src/normoffset.exr
Binary file not shown.
Binary file added testsuite/python-imagebufalgo/ref/norm.exr
Binary file not shown.
Binary file added testsuite/python-imagebufalgo/ref/normalize.exr
Binary file not shown.
Binary file removed testsuite/python-imagebufalgo/ref/normalize_flfl.exr
Binary file not shown.
Binary file removed testsuite/python-imagebufalgo/ref/normalize_flui.tif
Binary file not shown.
Binary file not shown.
Binary file added testsuite/python-imagebufalgo/ref/normalize_in.exr
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed testsuite/python-imagebufalgo/ref/normalize_uifl.exr
Binary file not shown.
Binary file removed testsuite/python-imagebufalgo/ref/normalize_uiui.tif
Binary file not shown.
Binary file added testsuite/python-imagebufalgo/ref/normoffset.exr
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ Comparing "minimg.tif" and "ref/minimg.tif"
PASS
Comparing "minval.tif" and "ref/minval.tif"
PASS
Comparing "minchan.tif" and "../../../testsuite/oiiotool/ref/minchan.tif"
Comparing "minchan.tif" and "ref/minchan.tif"
PASS
Comparing "maxchan.tif" and "../../../testsuite/oiiotool/ref/maxchan.tif"
Comparing "maxchan.tif" and "ref/maxchan.tif"
PASS
Comparing "chsum.tif" and "../../../testsuite/oiiotool/ref/chsum.tif"
PASS
Expand Down Expand Up @@ -172,15 +172,19 @@ Comparing "resample.tif" and "../../../testsuite/oiiotool-xform/ref/resample.tif
PASS
Comparing "fit.tif" and "../../../testsuite/oiiotool-xform/ref/fit.tif"
PASS
Comparing "normalize_uiui.tif" and "ref/normalize_uiui.tif"
Comparing "norm.exr" and "ref/norm.exr"
PASS
Comparing "normalize_uifl.exr" and "ref/normalize_uifl.exr"
Comparing "normoffset.exr" and "ref/normoffset.exr"
PASS
Comparing "normalize_flfl.exr" and "ref/normalize_flfl.exr"
Comparing "normalize.exr" and "ref/normalize.exr"
PASS
Comparing "normalize_flui.tif" and "ref/normalize_flui.tif"
Comparing "normalize_scale.exr" and "ref/normalize_scale.exr"
PASS
Comparing "normalize_flui_na.tif" and "ref/normalize_flui_na.tif"
Comparing "normalize_offsetin.exr" and "ref/normalize_offsetin.exr"
PASS
Comparing "normalize_offsetscaleout.exr" and "ref/normalize_offsetscaleout.exr"
PASS
Comparing "normalize_offsetscale.exr" and "ref/normalize_offsetscale.exr"
PASS
Comparing "bsplinekernel.exr" and "../../../testsuite/oiiotool/ref/bsplinekernel.exr"
PASS
Expand Down
18 changes: 11 additions & 7 deletions testsuite/python-imagebufalgo/ref/out-freetype2.4.11.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ Comparing "minimg.tif" and "ref/minimg.tif"
PASS
Comparing "minval.tif" and "ref/minval.tif"
PASS
Comparing "minchan.tif" and "../../../testsuite/oiiotool/ref/minchan.tif"
Comparing "minchan.tif" and "ref/minchan.tif"
PASS
Comparing "maxchan.tif" and "../../../testsuite/oiiotool/ref/maxchan.tif"
Comparing "maxchan.tif" and "ref/maxchan.tif"
PASS
Comparing "chsum.tif" and "../../../testsuite/oiiotool/ref/chsum.tif"
PASS
Expand Down Expand Up @@ -172,15 +172,19 @@ Comparing "resample.tif" and "../../../testsuite/oiiotool-xform/ref/resample.tif
PASS
Comparing "fit.tif" and "../../../testsuite/oiiotool-xform/ref/fit.tif"
PASS
Comparing "normalize_uiui.tif" and "ref/normalize_uiui.tif"
Comparing "norm.exr" and "ref/norm.exr"
PASS
Comparing "normalize_uifl.exr" and "ref/normalize_uifl.exr"
Comparing "normoffset.exr" and "ref/normoffset.exr"
PASS
Comparing "normalize_flfl.exr" and "ref/normalize_flfl.exr"
Comparing "normalize.exr" and "ref/normalize.exr"
PASS
Comparing "normalize_flui.tif" and "ref/normalize_flui.tif"
Comparing "normalize_scale.exr" and "ref/normalize_scale.exr"
PASS
Comparing "normalize_flui_na.tif" and "ref/normalize_flui_na.tif"
Comparing "normalize_offsetin.exr" and "ref/normalize_offsetin.exr"
PASS
Comparing "normalize_offsetscaleout.exr" and "ref/normalize_offsetscaleout.exr"
PASS
Comparing "normalize_offsetscale.exr" and "ref/normalize_offsetscale.exr"
PASS
Comparing "bsplinekernel.exr" and "../../../testsuite/oiiotool/ref/bsplinekernel.exr"
PASS
Expand Down
18 changes: 11 additions & 7 deletions testsuite/python-imagebufalgo/ref/out-python2-alt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ Comparing "minimg.tif" and "ref/minimg.tif"
PASS
Comparing "minval.tif" and "ref/minval.tif"
PASS
Comparing "minchan.tif" and "../../../testsuite/oiiotool/ref/minchan.tif"
Comparing "minchan.tif" and "ref/minchan.tif"
PASS
Comparing "maxchan.tif" and "../../../testsuite/oiiotool/ref/maxchan.tif"
Comparing "maxchan.tif" and "ref/maxchan.tif"
PASS
Comparing "chsum.tif" and "../../../testsuite/oiiotool/ref/chsum.tif"
PASS
Expand Down Expand Up @@ -172,15 +172,19 @@ Comparing "resample.tif" and "../../../testsuite/oiiotool-xform/ref/resample.tif
PASS
Comparing "fit.tif" and "../../../testsuite/oiiotool-xform/ref/fit.tif"
PASS
Comparing "normalize_uiui.tif" and "ref/normalize_uiui.tif"
Comparing "norm.exr" and "ref/norm.exr"
PASS
Comparing "normalize_uifl.exr" and "ref/normalize_uifl.exr"
Comparing "normoffset.exr" and "ref/normoffset.exr"
PASS
Comparing "normalize_flfl.exr" and "ref/normalize_flfl.exr"
Comparing "normalize.exr" and "ref/normalize.exr"
PASS
Comparing "normalize_flui.tif" and "ref/normalize_flui.tif"
Comparing "normalize_scale.exr" and "ref/normalize_scale.exr"
PASS
Comparing "normalize_flui_na.tif" and "ref/normalize_flui_na.tif"
Comparing "normalize_offsetin.exr" and "ref/normalize_offsetin.exr"
PASS
Comparing "normalize_offsetscaleout.exr" and "ref/normalize_offsetscaleout.exr"
PASS
Comparing "normalize_offsetscale.exr" and "ref/normalize_offsetscale.exr"
PASS
Comparing "bsplinekernel.exr" and "../../../testsuite/oiiotool/ref/bsplinekernel.exr"
PASS
Expand Down
18 changes: 11 additions & 7 deletions testsuite/python-imagebufalgo/ref/out-python3-freetype2.4.11.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ Comparing "minimg.tif" and "ref/minimg.tif"
PASS
Comparing "minval.tif" and "ref/minval.tif"
PASS
Comparing "minchan.tif" and "../../../testsuite/oiiotool/ref/minchan.tif"
Comparing "minchan.tif" and "ref/minchan.tif"
PASS
Comparing "maxchan.tif" and "../../../testsuite/oiiotool/ref/maxchan.tif"
Comparing "maxchan.tif" and "ref/maxchan.tif"
PASS
Comparing "chsum.tif" and "../../../testsuite/oiiotool/ref/chsum.tif"
PASS
Expand Down Expand Up @@ -172,15 +172,19 @@ Comparing "resample.tif" and "../../../testsuite/oiiotool-xform/ref/resample.tif
PASS
Comparing "fit.tif" and "../../../testsuite/oiiotool-xform/ref/fit.tif"
PASS
Comparing "normalize_uiui.tif" and "ref/normalize_uiui.tif"
Comparing "norm.exr" and "ref/norm.exr"
PASS
Comparing "normalize_uifl.exr" and "ref/normalize_uifl.exr"
Comparing "normoffset.exr" and "ref/normoffset.exr"
PASS
Comparing "normalize_flfl.exr" and "ref/normalize_flfl.exr"
Comparing "normalize.exr" and "ref/normalize.exr"
PASS
Comparing "normalize_flui.tif" and "ref/normalize_flui.tif"
Comparing "normalize_scale.exr" and "ref/normalize_scale.exr"
PASS
Comparing "normalize_flui_na.tif" and "ref/normalize_flui_na.tif"
Comparing "normalize_offsetin.exr" and "ref/normalize_offsetin.exr"
PASS
Comparing "normalize_offsetscaleout.exr" and "ref/normalize_offsetscaleout.exr"
PASS
Comparing "normalize_offsetscale.exr" and "ref/normalize_offsetscale.exr"
PASS
Comparing "bsplinekernel.exr" and "../../../testsuite/oiiotool/ref/bsplinekernel.exr"
PASS
Expand Down
18 changes: 11 additions & 7 deletions testsuite/python-imagebufalgo/ref/out-python3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ Comparing "minimg.tif" and "ref/minimg.tif"
PASS
Comparing "minval.tif" and "ref/minval.tif"
PASS
Comparing "minchan.tif" and "../../../testsuite/oiiotool/ref/minchan.tif"
Comparing "minchan.tif" and "ref/minchan.tif"
PASS
Comparing "maxchan.tif" and "../../../testsuite/oiiotool/ref/maxchan.tif"
Comparing "maxchan.tif" and "ref/maxchan.tif"
PASS
Comparing "chsum.tif" and "../../../testsuite/oiiotool/ref/chsum.tif"
PASS
Expand Down Expand Up @@ -172,15 +172,19 @@ Comparing "resample.tif" and "../../../testsuite/oiiotool-xform/ref/resample.tif
PASS
Comparing "fit.tif" and "../../../testsuite/oiiotool-xform/ref/fit.tif"
PASS
Comparing "normalize_uiui.tif" and "ref/normalize_uiui.tif"
Comparing "norm.exr" and "ref/norm.exr"
PASS
Comparing "normalize_uifl.exr" and "ref/normalize_uifl.exr"
Comparing "normoffset.exr" and "ref/normoffset.exr"
PASS
Comparing "normalize_flfl.exr" and "ref/normalize_flfl.exr"
Comparing "normalize.exr" and "ref/normalize.exr"
PASS
Comparing "normalize_flui.tif" and "ref/normalize_flui.tif"
Comparing "normalize_scale.exr" and "ref/normalize_scale.exr"
PASS
Comparing "normalize_flui_na.tif" and "ref/normalize_flui_na.tif"
Comparing "normalize_offsetin.exr" and "ref/normalize_offsetin.exr"
PASS
Comparing "normalize_offsetscaleout.exr" and "ref/normalize_offsetscaleout.exr"
PASS
Comparing "normalize_offsetscale.exr" and "ref/normalize_offsetscale.exr"
PASS
Comparing "bsplinekernel.exr" and "../../../testsuite/oiiotool/ref/bsplinekernel.exr"
PASS
Expand Down
18 changes: 11 additions & 7 deletions testsuite/python-imagebufalgo/ref/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ Comparing "minimg.tif" and "ref/minimg.tif"
PASS
Comparing "minval.tif" and "ref/minval.tif"
PASS
Comparing "minchan.tif" and "../../../testsuite/oiiotool/ref/minchan.tif"
Comparing "minchan.tif" and "ref/minchan.tif"
PASS
Comparing "maxchan.tif" and "../../../testsuite/oiiotool/ref/maxchan.tif"
Comparing "maxchan.tif" and "ref/maxchan.tif"
PASS
Comparing "chsum.tif" and "../../../testsuite/oiiotool/ref/chsum.tif"
PASS
Expand Down Expand Up @@ -172,15 +172,19 @@ Comparing "resample.tif" and "../../../testsuite/oiiotool-xform/ref/resample.tif
PASS
Comparing "fit.tif" and "../../../testsuite/oiiotool-xform/ref/fit.tif"
PASS
Comparing "normalize_uiui.tif" and "ref/normalize_uiui.tif"
Comparing "norm.exr" and "ref/norm.exr"
PASS
Comparing "normalize_uifl.exr" and "ref/normalize_uifl.exr"
Comparing "normoffset.exr" and "ref/normoffset.exr"
PASS
Comparing "normalize_flfl.exr" and "ref/normalize_flfl.exr"
Comparing "normalize.exr" and "ref/normalize.exr"
PASS
Comparing "normalize_flui.tif" and "ref/normalize_flui.tif"
Comparing "normalize_scale.exr" and "ref/normalize_scale.exr"
PASS
Comparing "normalize_flui_na.tif" and "ref/normalize_flui_na.tif"
Comparing "normalize_offsetin.exr" and "ref/normalize_offsetin.exr"
PASS
Comparing "normalize_offsetscaleout.exr" and "ref/normalize_offsetscaleout.exr"
PASS
Comparing "normalize_offsetscale.exr" and "ref/normalize_offsetscale.exr"
PASS
Comparing "bsplinekernel.exr" and "../../../testsuite/oiiotool/ref/bsplinekernel.exr"
PASS
Expand Down
8 changes: 4 additions & 4 deletions testsuite/python-imagebufalgo/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# https://github.com/OpenImageIO/oiio

refdirlist = [
refdir,
OIIO_TESTSUITE_ROOT + "/oiiotool/ref/",
OIIO_TESTSUITE_ROOT + "/oiiotool-color/ref/",
OIIO_TESTSUITE_ROOT + "/oiiotool-copy/ref/",
Expand All @@ -14,7 +15,6 @@
OIIO_TESTSUITE_ROOT + "/oiiotool-pattern/ref/",
OIIO_TESTSUITE_ROOT + "/oiiotool-text/ref/",
OIIO_TESTSUITE_ROOT + "/oiiotool-xform/ref/",
refdir
]

# Run the script
Expand Down Expand Up @@ -50,9 +50,9 @@
"contrast-sigmoid5.tif",
"saturate-0.tif", "saturate-2.tif",
"resize.tif", "resample.tif", "fit.tif",
"normalize_uiui.tif", "normalize_uifl.exr",
"normalize_flfl.exr", "normalize_flui.tif",
"normalize_flui_na.tif",
"norm.exr", "normoffset.exr", "normalize.exr", "normalize_scale.exr",
"normalize_offsetin.exr", "normalize_offsetscaleout.exr",
"normalize_offsetscale.exr",
"bsplinekernel.exr", "bspline-blur.tif", "tahoe-median.tif",
"dilate.tif", "erode.tif",
"unsharp.tif", "unsharp-median.tif", "tahoe-laplacian.tif",
Expand Down
41 changes: 26 additions & 15 deletions testsuite/python-imagebufalgo/src/test_imagebufalgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,21 +265,32 @@ def test_iba (func, *args, **kwargs) :
write (b, "invert.tif", oiio.UINT8)

# normalize
a = ImageBuf (OIIO_TESTSUITE_ROOT+"/common/vectorschart_raw.tif")
b = test_iba (ImageBufAlgo.normalize, a, 0.5, 0.5, 0.5)
write (b, "normalize_uiui.tif", oiio.UINT16)
b = test_iba (ImageBufAlgo.normalize, a, 0.5, 0.0, 1.0)
write (b, "normalize_uifl.exr", oiio.HALF)

a = ImageBuf (OIIO_TESTSUITE_ROOT+"/common/vectorschart_raw_xyza.exr")
b = test_iba (ImageBufAlgo.normalize, a, 0.0, 0.0, 1.0)
write (b, "normalize_flfl.exr", oiio.HALF)
b = test_iba (ImageBufAlgo.normalize, a, 0.0, 0.5, 0.5)
write (b, "normalize_flui.tif", oiio.UINT16)
b = ImageBuf()
b.specmod().nchannels = 3
b = test_iba (ImageBufAlgo.normalize, a, 0.0, 0.5, 0.5)
write (b, "normalize_flui_na.tif", oiio.UINT16)
# Construct an image with several values to test normalization
norm = ImageBuf(ImageSpec(3, 3, 3, "half"))
ImageBufAlgo.render_point(norm, 0, 0, (0.0, 0.0, 0.0)) # zero
ImageBufAlgo.render_point(norm, 1, 0, (0.6, 0.0, 0.0)) # x
ImageBufAlgo.render_point(norm, 2, 0, (-0.6, 0.0, 0.0)) # -x
ImageBufAlgo.render_point(norm, 0, 1, (0.0, 0.6, 0.0)) # y
ImageBufAlgo.render_point(norm, 1, 1, (0.0, -0.6, 0.0)) # -y
ImageBufAlgo.render_point(norm, 2, 1, (0.0, 0.0, 0.6)) # z
ImageBufAlgo.render_point(norm, 0, 2, (0.0, 0.0, -0.6)) # -z
ImageBufAlgo.render_point(norm, 1, 2, (0.6, 0.6, -0.6)) # diag3
ImageBufAlgo.render_point(norm, 2, 2, (0.0, -0.6, -0.6)) # diag2
write (norm, "norm.exr", "half")
# and another copy that is offset to .5 center and scaled by 0.5
normoffset = ImageBufAlgo.add(ImageBufAlgo.mul(norm, 0.5), 0.5)
write (normoffset, "normoffset.exr", "half")
# Test various options
b = test_iba (ImageBufAlgo.normalize, norm)
write (b, "normalize.exr", "half")
b = test_iba (ImageBufAlgo.normalize, norm, scale=0.5)
write (b, "normalize_scale.exr", "half")
b = test_iba (ImageBufAlgo.normalize, normoffset, inCenter=0.5)
write (b, "normalize_offsetin.exr", "half")
b = test_iba (ImageBufAlgo.normalize, norm, outCenter=0.5, scale=0.5)
write (b, "normalize_offsetscaleout.exr", "half")
b = test_iba (ImageBufAlgo.normalize, normoffset, inCenter=0.5, outCenter=0.5, scale=0.5)
write (b, "normalize_offsetscale.exr", "half")

# pow
b = ImageBufAlgo.pow (gray128, 2)
Expand Down

0 comments on commit 436ab6e

Please sign in to comment.