OpenCV save CV_32FC1 images

前端 未结 3 596
借酒劲吻你
借酒劲吻你 2021-01-18 00:48

A program I am using is reading some bitmaps, and expects 32FC1 images.

I am trying to create these images

cv::Mat M1(255, 255, CV_32FC1, cv::Scalar(         


        
3条回答
  •  长发绾君心
    2021-01-18 01:03

    Your problem is that bitmaps store data internally as integers not floats. If your problem is rounding error when saving you will need to either use a different file format or scale your data up before saving and then back down after saving. If you just want to convert the matrix you get after reading the file to a float you can use cv::convertto

提交回复
热议问题