haykart
haykart

Reputation: 957

OpenCV Mat CV_32FC1

how to view Mat image with 32FC1 image format. or how to convert it into 8UC1(I know an old method cvConvertImage, but I need new method)

Upvotes: 8

Views: 14470

Answers (1)

Sam
Sam

Reputation: 20056

Isn't the new interface nice?

Mat floatMat(w, h, CV_32FC1);
Mat ucharMat, ucharMatScaled;
floatMat.convertTo(ucharMat, CV_8UC1);

// scale values from 0..1 to 0..255
floatMat.convertTo(ucharMatScaled, CV_8UC1, 255, 0); 

Upvotes: 13

Related Questions