From 18cc1806874b3a750e70082cf24eef0649559da8 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Tue, 26 Jul 2022 17:41:05 +0300 Subject: [PATCH] Switch to non-deprecated overload of oiio::ImageBufAlgo::make_kernel() The overload of oiio::ImageBufAlgo::make_kernel() that returns the ImageBuf instance via a reference has been deprecated since oiio 1.9. AliceVision requires OpenImageIO >= 2.1.0 so we can switch to the replacement API now. --- src/aliceVision/mvsData/imageAlgo.cpp | 3 +-- src/aliceVision/panorama/gaussian.cpp | 5 ++--- src/software/utils/main_lightingEstimation.cpp | 6 ++---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/aliceVision/mvsData/imageAlgo.cpp b/src/aliceVision/mvsData/imageAlgo.cpp index 04cc30ae95..382c30ce6a 100644 --- a/src/aliceVision/mvsData/imageAlgo.cpp +++ b/src/aliceVision/mvsData/imageAlgo.cpp @@ -302,8 +302,7 @@ void convolveImage(oiio::TypeDesc typeDesc, const oiio::ImageBuf inBuf(oiio::ImageSpec(inWidth, inHeight, nchannels, typeDesc), const_cast(inBuffer.data())); oiio::ImageBuf outBuf(oiio::ImageSpec(inWidth, inHeight, nchannels, typeDesc), outBuffer.data()); - oiio::ImageBuf K; - oiio::ImageBufAlgo::make_kernel(K, kernel, kernelWidth, kernelHeight); + oiio::ImageBuf K = oiio::ImageBufAlgo::make_kernel(kernel, kernelWidth, kernelHeight); oiio::ImageBufAlgo::convolve(outBuf, inBuf, K); } diff --git a/src/aliceVision/panorama/gaussian.cpp b/src/aliceVision/panorama/gaussian.cpp index 126b409456..ab4cb1cecd 100644 --- a/src/aliceVision/panorama/gaussian.cpp +++ b/src/aliceVision/panorama/gaussian.cpp @@ -44,8 +44,7 @@ bool GaussianPyramidNoMask::process(const image::Image& input) /** * Kernel */ - oiio::ImageBuf K; - oiio::ImageBufAlgo::make_kernel(K, "gaussian", 5, 5); + oiio::ImageBuf K = oiio::ImageBufAlgo::make_kernel("gaussian", 5, 5); /** * Build pyramid @@ -88,4 +87,4 @@ bool GaussianPyramidNoMask::downscale(image::Image& output, return true; } -} // namespace aliceVision \ No newline at end of file +} // namespace aliceVision diff --git a/src/software/utils/main_lightingEstimation.cpp b/src/software/utils/main_lightingEstimation.cpp index 459c544868..30c3b0a30d 100644 --- a/src/software/utils/main_lightingEstimation.cpp +++ b/src/software/utils/main_lightingEstimation.cpp @@ -214,8 +214,7 @@ void initAlbedo(image::Image& albedo, const image::Image((void*)&picture(0,0)(0))); oiio::ImageBuf albedoBuf(oiio::ImageSpec(picture.Width(), picture.Height(), 3, oiio::TypeDesc::FLOAT), albedo.data()); - oiio::ImageBuf K; - oiio::ImageBufAlgo::make_kernel(K, "gaussian", albedoEstimationFilterSize, albedoEstimationFilterSize); + oiio::ImageBuf K = oiio::ImageBufAlgo::make_kernel("gaussian", albedoEstimationFilterSize, albedoEstimationFilterSize); oiio::ImageBufAlgo::convolve(albedoBuf, pictureBuf, K); image::writeImage((fs::path(outputFolder) / (std::to_string(viewId) + "_albedo.jpg")).string(), albedo, image::EImageColorSpace::AUTO); @@ -254,8 +253,7 @@ void initAlbedo(image::Image& albedo, const image::Image& picture, albedo.resize(picture.Width(), picture.Height()); const oiio::ImageBuf pictureBuf(oiio::ImageSpec(picture.Width(), picture.Height(), 1, oiio::TypeDesc::FLOAT), const_cast(picture.data())); oiio::ImageBuf albedoBuf(oiio::ImageSpec(picture.Width(), picture.Height(), 1, oiio::TypeDesc::FLOAT), albedo.data()); - oiio::ImageBuf K; - oiio::ImageBufAlgo::make_kernel(K, "gaussian", albedoEstimationFilterSize, albedoEstimationFilterSize); + oiio::ImageBuf K = oiio::ImageBufAlgo::make_kernel("gaussian", albedoEstimationFilterSize, albedoEstimationFilterSize); oiio::ImageBufAlgo::convolve(albedoBuf, pictureBuf, K); image::writeImage((fs::path(outputFolder) / (std::to_string(viewId) + "_albedo.jpg")).string(), albedo, image::EImageColorSpace::AUTO);