opencv 3.1 imshow not working when graphic driver is enabled pi3

asked 2016-10-09 22:42:55 -0600

abhi0329 gravatar image

updated 2016-10-10 02:34:14 -0600

LBerger gravatar image

Hi Friends, Once we enable the experimental graphical driver, opencv 3.1 imshow does not work, it does nothing and the very basic program hangs for infinite. My sample code is as pasted below:

#include "opencv2/opencv.hpp"
using namespace cv;
int main(int, char**)
{
    VideoCapture cap(0); // open the default camera
    if(!cap.isOpened())  // check if we succeeded
        return -1;
    Mat edges;
    namedWindow("edges",1);
    for(;;)
    {
        Mat frame;
        cap >> frame; // get a new frame from camera
        cvtColor(frame, edges, COLOR_BGR2GRAY);
        GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
        Canny(edges, edges, 0, 30, 3);
        imshow("edges", edges);
        if(waitKey(30) >= 0) break;
    }
    // the camera will be deinitialized automatically in VideoCapture destructor
    return 0;
}
edit retag flag offensive close merge delete

Comments

Weird because I have Ubuntu16.04 running here with latest driver and OpenCV runs just smooth with imshow possibilities. Could you give your CMAKE output and system configuration?

StevenPuttemans gravatar imageStevenPuttemans ( 2016-10-10 04:08:34 -0600 )edit

Thanks Steven, Basically I am using raspbian pixel OS on raspberry pi 3, I will try installing UBUNTU Mate on raspberry pi and will update you,...

abhi0329 gravatar imageabhi0329 ( 2016-10-10 04:30:19 -0600 )edit