Reputation: 1707
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?
Upvotes: 4
Views: 7606
Reputation: 11941
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.
Upvotes: 10