You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gil::threshold_truncate() and gil::threshold_binary() from gil/image_processing/truncate.hpp employ a hard-coded value of 0 for the channel minimum value and a value of std::numeric_limits<channel_t>::max() for the maximum value. This works only for unsigned integer channel types such as gil::rgb8_pixel_t and gil::gray8_pixel_t, but does not work for signed channel types and also not for floating point types whose value range is limited from 0.0 to 1.0.
Edit: Otsu thresholding also employs std::numeric_limits, which is invalid for scoped channels.
Expected behavior
Correct channel value truncation according to the channel min/max values.
The text was updated successfully, but these errors were encountered:
I may vaguely recall that I agreed with @miralshah365 to begin with support unsigned integer channel types only.
There should be at least a static assertion though as a documentation of such limitation.
It would be nice to have this fixed/improved indeed.
Actual behavior
gil::threshold_truncate()
andgil::threshold_binary()
from gil/image_processing/truncate.hpp employ a hard-coded value of 0 for the channel minimum value and a value ofstd::numeric_limits<channel_t>::max()
for the maximum value. This works only for unsigned integer channel types such asgil::rgb8_pixel_t
andgil::gray8_pixel_t
, but does not work for signed channel types and also not for floating point types whose value range is limited from 0.0 to 1.0.Edit: Otsu thresholding also employs std::numeric_limits, which is invalid for scoped channels.
Expected behavior
Correct channel value truncation according to the channel min/max values.
The text was updated successfully, but these errors were encountered: