Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

convert mat type from a specific range pixel value?

Hi, I get the depth camera and I want to do some floodfill(). My source image is CV_16S.I have to convert the mat to CV_8U for floodfill(). However, what I interested is only a small range of pixel value, says, the image input is [0,4096] but I only want [2000,3000] convert to [0,255].

I did some threshold and then convert it like:

src.convertTo( dis, CV_8U, 255.0/4096.0 );

I'm not sure whether it is right or wrong so I'm searching some ready-to-use function. I think normalize would do something but it seems that the boundary of source image connot be set up. thanks for any idea.