Repository navigation
Bilateral Filter: Should sigma_range produce identical blur in RGB vs CIELAB, or should the difference be documented?
#195
Closed
Ryan-Millard
started this conversation in
Ideas
Replies: 1 comment
UpdateWe'll document it and leave it up to the user. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone,
As noted in #192 and #191 something interesting about the bilateral filter occurs:
The filter can operate in either RGB or CIELAB color spaces, but using the same
sigma_rangeproduces different visual blur.The difference
Original image
Filtered images (Left: CIELAB, Right: RGB)
Above:
For both images:
pixels,width,heightwere identical - the same image was used.sigma_spatialwas identical - 3.0 was usedsigma_rangewas identical - 50.0 was usedcolor_spacewas changed - the CIELAB image (left) used 0 and the RGB image (right) used 1The RGB bilateral filter preserved the image the best in comparison.
Why this happens
[0, 255]- max Euclidean distance ≈ 442[0,100], a/b[-128,127]- max distance ≈ 374Result: Lab outputs look blurrier than RGB for the same
sigma_range.Experiment
I tested scaling RGB’s
sigma_rangeto match Lab visually - a factor around 4.18 produces roughly the same blur for natural images.Original image
Filtered images (Left: CIELAB, Right: RGB)
Above:
For both images:
pixels,width,heightwere identical - the same image was used.sigma_spatialwas identical - 3.0 was usedsigma_rangewas identical - 50.0 was usedsigma_rangeby 1.18 - thussigma_rangewascolor_spacewas changed - the CIELAB image (left) used 0 and the RGB image (right) used 1The RGB bilateral filter preserved the image the best in comparison.
Design question
For a library like this, what’s the better approach?
sigma_rangeinternally so RGB and Lab produce visually similar results.My thoughts
Conclusion
I’d love feedback from anyone who has implemented or used bilateral filters before:
Thanks in advance!
All reactions