-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
Describe the bug
BoxFilter currently applies kernel size as (height, width) instead of (width, height).
When width and height are different, the filter effect is transposed relative to what the UI labels indicate.
To Reproduce
Steps to reproduce the behavior:
- Upload any image.
- Add
filtering_boxfilterblock. - Set
width = 3,height = 5. - Run pipeline.
- Compare result against expected OpenCV behavior for kernel
(3,5).
Code-level repro:
import cv2
import numpy as np
from app.operators.filtering.box_filter import BoxFilter
img = np.arange(8*9, dtype=np.uint8).reshape(8, 9)
out = BoxFilter({"width": 3, "height": 5, "depth": -1, "point_x": -1, "point_y": -1}).compute(img)
expected_wh = cv2.boxFilter(img, -1, (3,5), anchor=(-1,-1), normalize=True, borderType=cv2.BORDER_DEFAULT)
expected_hw = cv2.boxFilter(img, -1, (5,3), anchor=(-1,-1), normalize=True, borderType=cv2.BORDER_DEFAULT)
print(np.array_equal(out, expected_wh)) # False
print(np.array_equal(out, expected_hw)) # TrueExpected behavior
width should map to kernel width and height should map to kernel height, so backend should call OpenCV with (width, height).
Environment:
OS: Windows 11 (local repro)
Python version: 3.14
OpenCV version: 4.13.0
Additional context
Likely relevant files:
imagelab-backend/app/operators/filtering/box_filter.py (currently passes (height, width))
imagelab-frontend/src/blocks/definitions/filtering.blocks.ts (labels show width then height)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels