feat(contrast): add new type Gaussian for adaptive_threshold()
#734
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey dears,
I enhanced the
adaptive_threshold()function by introducing a new method, which is consistent with OpenCV'sADAPTIVE_THRESH_GAUSSIAN_C.It seems the existing
adaptive_threshold()function is equivalent to OpenCV'sADAPTIVE_THRESH_MEAN_Ccase. While effective, it weights all pixels in the neighborhood equally. This can be suboptimal for images with varying illumination or complex textures. For instance, I'm working on an app for segmenting pineapple fruitlets:A pineapple's surface is composed of many small hexagonal segments, known as "fruitlets". Due to the pineapple's naturally bumpy texture, lighting across the surface is often uneven. When processing images of pineapples, a challenge emerged: the protrusions inside the fruitlets were difficult to distinguish from the puddles at the boundary, and the fruitlets were mistakenly separated.
The new method addresses my requirement very well: it results in a much cleaner and more accurate segmentation of the fruitlets, as it is better at preserving the true boundaries.
I believe the feature is general enough: adding it will also provides a powerful tool for all
imageprocusers who work with images containing textured surfaces or uneven illumination 😎