3
votes

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!

1

1 Answers

10
votes

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);