According to documentation, imshow will work like this
What if my Matrix contain negative value in 32-bit floating point. How it will treat it?
The key bits of Open_CV source are
#define CV_8S 1
#define CV_32S 4
#define CV_32F 5
double scale = src_depth <= CV_8S ? 1 : src_depth <= CV_32S ? 1./256 : 255;
double shift = src_depth == CV_8S || src_depth == CV_16S ? 128 : 0;
dst[x] = saturate_cast<DT>(src[x]*scale + shift);
Ultimately imshow creates a CV_8 Mat before displaying it, so saturate_cast, when DT is uchar, clamps the argument to 0 and 255.
For floating point depth == CV_32F:
That means for CV_32F
Now to answer you question:
What if my Matrix contain negative value in 32-bit floating point. How it will treat it?
The negative values will be displayed as if they are 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With