Reputation: 103
I have a mat of this type
Mat port(M.size(),CV_8UC1);
and inside I have the 2 values: 0 and 1.
If I try to do imshow ( " p " , port) ;
img by a black .
How can I distinguish all 0 and 1 with two different colors ?
I tried and tried to use line()
but you must already know the two closest points while I do not know what the values 1 distanced from each other .
someone can help me ?
It seems a trivial problem
Upvotes: 0
Views: 4984
Reputation: 17275
Try scaling your data for display: imshow(" p ", port*255);
A gray value of 1
is almost indistinguishable from full black and will not be discernible on any normal monitor/screen. Scaling by 255 will make these pixels appear white.
Note that the scaling is done only for the display and do not affect the image itself.
Please see the imshow()
docs for what scaling is done and the values for display:
The function may scale the image, depending on its depth:
- If the image is 8-bit unsigned, it is displayed as is.
- If the image is 16-bit unsigned or 32-bit integer, the pixels are divided by 256. That is, the value range [0,255*256] is mapped to [0,255].
- If the image is 32-bit floating-point, the pixel values are multiplied by 255. That is, the value range [0,1] is mapped to [0,255].
Upvotes: 4