Segmentation fault when using cv::imshow

asked 2018-11-14 01:01:23 -0600

Magikalika gravatar image

updated 2018-11-14 12:49:28 -0600

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. 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

edit retag flag offensive close merge delete

Comments

does it show rows or cols ? most probably your image was not loaded.

do you absolutely have to use a 3rd party built (and outdated) ros installation ? we probably can't help you with specific problems aboout that

berak gravatar imageberak ( 2018-11-14 01:02:39 -0600 )edit

Yes I have to use indigo and opencv 3.x version to run on our hardware. Could it be that my ros installation is botchered?

Magikalika gravatar imageMagikalika ( 2018-11-14 12:51:40 -0600 )edit

how would WE know about ROS ?

if you're mainly interested about opencv, get a recent codebase, and try to build that from src

berak gravatar imageberak ( 2018-11-14 12:55:26 -0600 )edit