Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert 8 bit image to 32 bit in OpenCV 2

Tags:

image

opencv

How can I convert an 8 bit mat to a 32 bit mat to use in the kmeans function. I tried to use ConvertScale, but the compiler said it was an unknown function. I am using OpenCV 2.3.1 and want to avoid using the API calls from older versions.

Thanks in advance!

like image 995
keshavdv Avatar asked Feb 04 '26 04:02

keshavdv


1 Answers

you can use convertTo

cv::Mat mat = do your thing using CV_8S (or CV_8U)
cv::Mat dst = do your other thing
mat.convertTo(dst, CV_32S);
like image 107
Boaz Avatar answered Feb 05 '26 19:02

Boaz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!