開發平台(Platform): (Ex: Win10, Linux, ...)
Linux Ubuntu 16.04
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
GCC+QT
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
OpenCV4.0.0
問題(Question):
目前將Mat檔案用Ref放置到function中,
將Mat轉換至IplImage。
Mat src;
imshow("ShowSrc", src);
cvWaitKey();
IplImage* image= 0;
*image = IplImage(src);
可是IplImage卻無法轉換,
出現結果
the inferior stopped because it received a signal from the operating system.
Signal name: SIGSEGV
Signal meaning: Segmentation fault
去找尋此錯誤,有敘述可能是指標問題,imshow可以顯示出圖案,故是有值。
想知道問題出現在哪?
餵入的資料(Input):
Test.bmp 一張彩色圖片
預期的正確結果(Expected Output):
可以顯示其直方圖
錯誤結果(Wrong Output):
the inferior stopped because it received a signal from the operating system.
Signal name: SIGSEGV
Signal meaning: Segmentation fault
程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔)
void MainWindow::on_pushButton_clicked()
{
Mat cvInImg;
cvInImg = imread("Test.bmp");
GaussianBlur( cvInImg, cvInImg, Size(3,3), 0);
Mat cvInHSVImg;
Mat acvChannel[3];
cvtColor(cvInImg,cvInHSVImg,CV_BGR2HSV);
split(cvInHSVImg,acvChannel);
//imshow("OutputEdgeImg",cvEdgeImg);
HistogramDisplay(acvChannel[0]);
...
}
void MainWindow::HistogramDisplay(Mat &src)
{
IplImage* image= 0;
IplImage* imgHistogram = 0;
IplImage* gray= 0;
CvHistogram* hist;
imshow("ShowSrc", src);
cvWaitKey();
*image = IplImage(src);
//size of the histogram -1D histogram
int bins = 256;
int hsize[] = {bins};
...
}
補充說明(Supplement):