Skip to content

[Bug] BilateralFilter crashes when filterSize is zero or negative — no validation #332

@ajithhraj

Description

@ajithhraj

Describe the bug
BilateralFilter in app/operators/filtering/bilateral_filter.py reads filterSize directly with no validation. Passing 0 or any negative integer to cv2.bilateralFilter raises an OpenCV exception. All blurring operators (Blur, GaussianBlur, MedianBlur) validate their kernel size — BilateralFilter does not.

To Reproduce
Steps to reproduce the behavior:

  1. Add a BilateralFilter block to the pipeline
  2. Set filterSize to 0 or any negative value
  3. Run the pipeline — crashes with cv2.error

Expected behavior
Should raise a clear ValueError when filterSize is zero or negative, consistent with how other operators validate their parameters.

Screenshots
N/A

Environment:

  • Python version: 3.12

Additional context
Relevant code in app/operators/filtering/bilateral_filter.py:

filter_size = int(self.params.get("filterSize", 5))
# no validation — cv2.bilateralFilter throws on filterSize <= 0
return cv2.bilateralFilter(image, filter_size, sigma_color, sigma_space)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions