1 | initial version |
yes, say you got a 16 bit grayscale ( CV_16S ) , you can just convert it to a 32bit one:
Mat m16; // from somewhere
Mat m32; // our new one (no, you don't have to alloc anything before )
m16.convertTo(m32,CV_32S);
2 | No.2 Revision |
yes, say you got a 16 bit grayscale ( CV_16S ) , you can just convert it to a 32bit one:
Mat m16; // from somewhere
Mat m32; // our new one (no, you don't have to alloc anything before )
m16.convertTo(m32,CV_32S);
for gradients, you probably want floats:
m16.convertTo(m32,CV_32F);
maybe even in the [0-1] range:
m16.convertTo(m32,CV_32F, 1.0/65536.0);
// do your calculations, (maybe normalize your results) and convert back
m32.convertTo(m16,CV_16S);
3 | No.3 Revision |
say you got a 16 bit grayscale ( CV_16S ) , you can just convert it to a 32bit one:
Mat m16; // from somewhere
Mat m32; // our new one (no, you don't have to alloc anything before )
m16.convertTo(m32,CV_32S);
for gradients, you probably want floats:
m16.convertTo(m32,CV_32F);
maybe even in the [0-1] range:
m16.convertTo(m32,CV_32F, 1.0/65536.0); 1.0/65536.0);
m32.convertTo(m16,CV_16S);