Skip to content

Commit 4d732b0

Browse files
Sylvain Maziereservantftransperfect
authored andcommitted
fix(imageProcessing): fix guard placement for bilateralFilter and nlmFilter OpenCV checks
The `#if ALICEVISION_HAVE_OPENCV` guards were incorrectly placed *before* the `if (pParams.*.enabled)` runtime checks, causing the entire block (including the enabled-check) to be silently skipped at compile time when OpenCV is absent. - Move the preprocessor guard *inside* the runtime `if` block for bilateralFilter and nlmFilter, so the enabled-check is always compiled and evaluated - Add an `#else` branch for nlmFilter that logs an explicit error when OpenCV is unavailable and the filter is requested, instead of silently bypassing it
1 parent 1450b4c commit 4d732b0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/software/utils/main_imageProcessing.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,6 @@ void setupSteps(std::list<std::unique_ptr<ImageProcess>> & steps, const Processi
522522
{
523523
steps.push_back(std::make_unique<SharpenProcess>(pParams.sharpen.width, pParams.sharpen.contrast, pParams.sharpen.threshold));
524524
}
525-
#if ALICEVISION_IS_DEFINED(ALICEVISION_HAVE_OPENCV)
526525
if (pParams.bilateralFilter.enabled)
527526
{
528527
#if ALICEVISION_IS_DEFINED(ALICEVISION_HAVE_OPENCV)
@@ -547,11 +546,13 @@ void setupSteps(std::list<std::unique_ptr<ImageProcess>> & steps, const Processi
547546
{
548547
steps.push_back(std::make_unique<NoiseProcess>(ENoiseMethod_enumToString(pParams.noise.method), pParams.noise.A, pParams.noise.B, pParams.noise.mono));
549548
}
550-
#if ALICEVISION_IS_DEFINED(ALICEVISION_HAVE_OPENCV)
551549
if (pParams.nlmFilter.enabled)
550+
#if ALICEVISION_IS_DEFINED(ALICEVISION_HAVE_OPENCV)
552551
{
553552
steps.push_back(std::make_unique<NlmFilterProcess>(pParams.nlmFilter.filterStrength, pParams.nlmFilter.filterStrengthColor, pParams.nlmFilter.templateWindowSize, pParams.nlmFilter.searchWindowSize));
554553
}
554+
#else
555+
ALICEVISION_LOG_ERROR("OpenCV support is not enabled in this AliceVision build. Nlm filter processing is unavailable and will be bypassed.");
555556
#endif
556557
if (pParams.applyDcpMetadata || pParams.enableColorTempProcessing)
557558
{

0 commit comments

Comments
 (0)