0
我在linux終端(C++在linux)中編譯了以下代碼,並使用OpenCv 3.3 在服務器以unsigned char *形式顯示圖片時,我將它轉換爲cv :: Mat如下:分割錯誤Opencv linux C++
Mat charToMat(unsigned char * bytes, int width, int height){
return Mat(height, width, CV_8UC3, bytes);
}
然後我嘗試2種方式從簡歷::墊的IplImage *,但在每種情況下轉換,分割故障。
1路:
int * ft(Mat ft, int width, int height, int countA4) {
sourceImg = cvCreateImage(cvSize(ft.cols, ft.rows), 8, 3);
IplImage im = ft;
cvCopy(&im, sourceImg); // Segmentation Fault
}
2路:
int * ft (Mat ft, int width, int height, int countA4) {
IplImage im = ft;
sourceImg = cvCloneImage(&im);// Segmentation Fault
}
如果有人知道該如何解決?
感謝您的幫助,但它仍然導致錯誤 –