MCPcopy Create free account
hub / github.com/alicevision/AliceVision / initAlbedo

Function initAlbedo

src/software/utils/main_lightingEstimation.cpp:188–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188void initAlbedo(image::Image<image::RGBfColor>& albedo,
189 const image::Image<image::RGBfColor>& picture,
190 EAlbedoEstimation albedoEstimationMethod,
191 int albedoEstimationFilterSize,
192 const std::string& outputFolder,
193 IndexT viewId)
194{
195 switch (albedoEstimationMethod)
196 {
197 case EAlbedoEstimation::CONSTANT:
198 {
199 albedo.resize(picture.width(), picture.height());
200 albedo.fill(image::RGBfColor(.5f, .5f, .5f));
201 }
202 break;
203 case EAlbedoEstimation::PICTURE:
204 {
205 albedo = picture;
206 }
207 break;
208 case EAlbedoEstimation::MEDIAN_FILTER:
209 {
210 albedo.resize(picture.width(), picture.height());
211 const oiio::ImageBuf pictureBuf(oiio::ImageSpec(picture.width(), picture.height(), 3, oiio::TypeDesc::FLOAT),
212 const_cast<void*>((void*)&picture(0, 0)(0)));
213 oiio::ImageBuf albedoBuf(oiio::ImageSpec(picture.width(), picture.height(), 3, oiio::TypeDesc::FLOAT), albedo.data());
214 oiio::ImageBufAlgo::median_filter(albedoBuf, pictureBuf, albedoEstimationFilterSize, albedoEstimationFilterSize);
215 image::writeImage((fs::path(outputFolder) / (std::to_string(viewId) + "_albedo.jpg")).string(), albedo, image::ImageWriteOptions());
216 }
217 break;
218 case EAlbedoEstimation::BLUR_FILTER:
219 {
220 albedo.resize(picture.width(), picture.height());
221 const oiio::ImageBuf pictureBuf(oiio::ImageSpec(picture.width(), picture.height(), 3, oiio::TypeDesc::FLOAT),
222 const_cast<void*>((void*)&picture(0, 0)(0)));
223 oiio::ImageBuf albedoBuf(oiio::ImageSpec(picture.width(), picture.height(), 3, oiio::TypeDesc::FLOAT), albedo.data());
224 oiio::ImageBuf K = oiio::ImageBufAlgo::make_kernel("gaussian", albedoEstimationFilterSize, albedoEstimationFilterSize);
225 oiio::ImageBufAlgo::convolve(albedoBuf, pictureBuf, K);
226 image::writeImage((fs::path(outputFolder) / (std::to_string(viewId) + "_albedo.jpg")).string(), albedo, image::ImageWriteOptions());
227 }
228 break;
229 }
230}
231
232void initAlbedo(image::Image<float>& albedo,
233 const image::Image<float>& picture,

Callers 1

mainFunction · 0.85

Calls 8

writeImageFunction · 0.85
pathClass · 0.85
ImageWriteOptionsClass · 0.85
dataMethod · 0.80
resizeMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45
fillMethod · 0.45

Tested by

no test coverage detected