Skip to content

imageProcessing: guard OpenCV-dependent filters behind ALICEVISION_HA…#2090

Open
predat wants to merge 3 commits intodevelopfrom
fix/guard-opencv-filters-imageProcessing
Open

imageProcessing: guard OpenCV-dependent filters behind ALICEVISION_HA…#2090
predat wants to merge 3 commits intodevelopfrom
fix/guard-opencv-filters-imageProcessing

Conversation

@predat
Copy link
Contributor

@predat predat commented Mar 19, 2026

Summary

Guard the registration of OpenCV-dependent image processing steps behind the ALICEVISION_HAVE_OPENCV compile-time flag.

Motivation

Three filter steps — BilateralFilter, ClaheFilter, and NlmFilter — rely on OpenCV internally. Without this guard, any build configuration that does not include OpenCV will fail at compile time when setupSteps() tries to instantiate these classes.

Changes

  • Wrapped BilateralFilterProcess and ClaheFilterProcess registration under #if ALICEVISION_IS_DEFINED(ALICEVISION_HAVE_OPENCV) in main_imageProcessing.cpp.
  • Wrapped NlmFilterProcess registration under the same guard.

Co-authored-by: Fabien Castan <fabcastan@gmail.com>
{
steps.push_back(std::make_unique<NoiseProcess>(ENoiseMethod_enumToString(pParams.noise.method), pParams.noise.A, pParams.noise.B, pParams.noise.mono));
}
#if ALICEVISION_IS_DEFINED(ALICEVISION_HAVE_OPENCV)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same than the other comment

…Filter 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants