Skip to content

Commit

Permalink
oiiotools --normalize
Browse files Browse the repository at this point in the history
added --normalize to oiiotools.

example:
oiiotool.exe -v -i:ch=R,G,B OpenImageIO\testsuite\common\vectorschart_raw_xyza.exr --normalize:incntr=0.0:outcntr=0.0:scale=1.0 -d float -o normalize.exr

Signed-off-by: ssh4net <[email protected]>
  • Loading branch information
ssh4net committed Aug 24, 2023
1 parent 9893fa8 commit 437bb9f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/oiiotool/oiiotool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4655,8 +4655,6 @@ OIIOTOOL_OP(unsharp, 1, [&](OiiotoolOp& op, span<ImageBuf*> img) {
threshold);
});



UNARY_IMAGE_OP(laplacian, ImageBufAlgo::laplacian); // --laplacian
UNARY_IMAGE_OP(fft, ImageBufAlgo::fft); // --fft
UNARY_IMAGE_OP(ifft, ImageBufAlgo::ifft); // --ifft
Expand All @@ -4665,6 +4663,17 @@ UNARY_IMAGE_OP(unpolar, ImageBufAlgo::polar_to_complex); // --unpolar



// --normalize
OIIOTOOL_OP(normalize, 1, [&](OiiotoolOp& op, span<ImageBuf*> img) {
float inCenter = op.options().get_float("incntr", 0.0f);
float outCenter = op.options().get_float("outcntr", 0.0f);
float scale = op.options().get_float("scale", 1.0f);
return ImageBufAlgo::normalize(*img[0], *img[1], inCenter, outCenter,
scale);
});



// --fixnan
void
action_fixnan(Oiiotool& ot, cspan<const char*> argv)
Expand Down Expand Up @@ -6864,6 +6873,9 @@ Oiiotool::getargs(int argc, char* argv[])
ap.arg("--laplacian")
.help("Laplacian filter the image")
.OTACTION(action_laplacian);
ap.arg("--normalize")
.help("Normalize the image (options: incntr=0.5, outcntr=0.5, scale=0.5)")
.OTACTION(action_normalize);
ap.arg("--fft")
.help("Take the FFT of the image")
.OTACTION(action_fft);
Expand Down

0 comments on commit 437bb9f

Please sign in to comment.