Convert 8-bit image to 32 bit in OpenCV 2

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

Thanks in advance!

+3
source share
1 answer

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);
+10
source

Source: https://habr.com/ru/post/1546241/


All Articles