0

This is the piece of code. I have tried almost everything to resolve this error but the seg-fault doesn't go away. The image is getting read as the code displays the number of columns and rows in the image. I get this output upon running gdb: SIGSEGV received from /usr/lib/x86-64-linux-gnu/libopencv_highgui.so.2.4

#include <opencv2/highgui.hpp>
#include <iostream>

int main( int argc, char** argv ) {

    cv::Mat image;
    image = cv::imread("sample.jpeg" , CV_LOAD_IMAGE_COLOR);

    if(! image.data ) {
        std::cout <<  "Could not open or find the image" << std::endl ;
        return -1;
    }

    cv::namedWindow( "Display window", cv::WINDOW_AUTOSIZE );

    #this line gives me errors
    cv::imshow( "Display window", image );

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

0 Answers0