讀取點雲數據將其轉換爲二維圖像,在二維圖像中進行處理後,即將其再轉換爲點雲數據,OpenCV Mat讀取png格式時所遇到的問題如下:
Error: Assertion failed (elemSize() == sizeof(_Tp)) in cv::Mat::begin,
解決方法:
1、將所處理的圖像放至所在項目.cpp所在目錄;
2、將圖像加載至如下所示:直接將圖像拖拽至粉紅色矩形框內;
3、 格式轉換,先用Iplimage *加載文件,再轉換爲Mat格式;
IplImage *sr;
sr = cvLoadImage("D:\\C Add Add\PCL_Study\\D_3D_Transformation\\D_3D_Transformation\\GaussianHighKneePiece.png",
CV_LOAD_IMAGE_UNCHANGED);
Mat image = cvarrToMat(sr);
經上述方法均未解決此問題,最後就將其cvLoadImage中的CV_LOAD_IMAGE_UNCHANGED問題得到解決,但是對於讀取圖像質量肯定是有影響的。
IplImage *sr;
sr = cvLoadImage("D:\\C Add
Add\PCL_Study\\D_3D_Transformation\\D_3D_Transformation\\GaussianHighKneePiece.png");
Mat image = cvarrToMat(sr);
參考博文:
1、opencv Mat讀取圖片提示OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow;