Skip to content

Commit

Permalink
Switch to non-deprecated overload of oiio::ImageBufAlgo::make_kernel()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
p12tic committed Jul 26, 2022
1 parent 4dbf0c2 commit 18cc180
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/aliceVision/mvsData/imageAlgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,7 @@ void convolveImage(oiio::TypeDesc typeDesc,
const oiio::ImageBuf inBuf(oiio::ImageSpec(inWidth, inHeight, nchannels, typeDesc), const_cast<T*>(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);
}
Expand Down
5 changes: 2 additions & 3 deletions src/aliceVision/panorama/gaussian.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ bool GaussianPyramidNoMask::process(const image::Image<image::RGBfColor>& 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
Expand Down Expand Up @@ -88,4 +87,4 @@ bool GaussianPyramidNoMask::downscale(image::Image<image::RGBfColor>& output,
return true;
}

} // namespace aliceVision
} // namespace aliceVision
6 changes: 2 additions & 4 deletions src/software/utils/main_lightingEstimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ void initAlbedo(image::Image<image::RGBfColor>& albedo, const image::Image<image
albedo.resize(picture.Width(), picture.Height());
const oiio::ImageBuf pictureBuf(oiio::ImageSpec(picture.Width(), picture.Height(), 3, oiio::TypeDesc::FLOAT), const_cast<void*>((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);
Expand Down Expand Up @@ -254,8 +253,7 @@ void initAlbedo(image::Image<float>& albedo, const image::Image<float>& picture,
albedo.resize(picture.Width(), picture.Height());
const oiio::ImageBuf pictureBuf(oiio::ImageSpec(picture.Width(), picture.Height(), 1, oiio::TypeDesc::FLOAT), const_cast<float*>(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);
Expand Down

0 comments on commit 18cc180

Please sign in to comment.