Ask Your Question

Revision history [back]

Segmentation fault when using cv::imshow

Hy guys, I am using OpenCV 3.1 with ros indigo and try to use cv::imshow to display an image. Everytime it hits imshow i get a segmentation fault. Even in the very basic programms below.

#include <iostream>
#include <opencv/cv.h>
#include <opencv2/highgui/highgui.hpp>

int main(int argc, char* argv[])  {
cv::Mat img = cv::imread("frankenfurter.jpg"); //Make sure that the image is there

std::cout << img.rows << "; " << img.cols <<  std::endl;

cv::namedWindow("img");
cv::imshow("img", img);

cv::waitKey(2000);
return 0;
}

I am looking for hints what to do. Since I don't know what the cause of this behavior is. My ideas were maybe a problem with QT or the sublibrary that is used in imshow. Any ideas

Segmentation fault when using cv::imshow

Hy guys, I am using OpenCV 3.1 with ros indigo and try to use cv::imshow to display an image. Everytime it hits imshow i get a segmentation fault. Even in the very basic programms below.below. The image is loaded and shows rows and cols.

#include <iostream>
#include <opencv/cv.h>
#include <opencv2/highgui/highgui.hpp>

int main(int argc, char* argv[])  {
cv::Mat img = cv::imread("frankenfurter.jpg"); //Make sure that the image is there

std::cout << img.rows << "; " << img.cols <<  std::endl;

cv::namedWindow("img");
cv::imshow("img", img);

cv::waitKey(2000);
return 0;
}

I am looking for hints what to do. Since I don't know what the cause of this behavior is. My ideas were maybe a problem with QT or the sublibrary that is used in imshow. Any ideas