Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

convertTo should works fine. Your issue might comes from values. In your case the proper values before should be greater than 0.5/255

From the convertTo doc

dstMat(x,y) = saturate_cast<dstType>(alpha*srcMat(x,y) + beta)

you should know that

saturate_cast<char>(0.4999) = 0
saturate_cast<char>(0.5)    = 1
saturate_cast<char>(0.7)    = 1
...
saturate_cast<char>(260.x)  = 255

in general, when dstType is fixed type if srcValues < 0.5/alpha than dstValue = 0

Is this your case ?