Page 1 of 1

opencv 3.1 not working when graphic driver is enabled pi3

Posted: Mon Sep 26, 2016 6:00 pm
by abhisek
Hi Friends,
Once we enable the experimental graphical driver, opencv 3.1 programs does not work, it does nothing and the very basic program hangs for infinite. This the normal sample code which doesn't work.

Code: Select all

#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;
} 
Once I disable the graphics driver the same code works fine, I think either I am missing the very basic stuff or this is a big issue.
I have also tried doing "sudo BRANCH=next rpi-update ".

I sincerely thank to all of you for your help and support.

Re: opencv 3.1 not working when graphic driver is enabled p

Posted: Wed Sep 28, 2016 6:48 am
by ban6
It is an experimental driver. You should expect such problems.

I think waiting for the stable version is the best thing you can do unless you plan to dive into driver code and fix the problem yourself (I doubt that the driver code is available).

Ban,
JavaFX tutorials

Re: opencv 3.1 not working when graphic driver is enabled p

Posted: Wed Sep 28, 2016 7:29 am
by abhisek
Any idea when we can expect a new OS release, last one was in the month of May...

Re: opencv 3.1 not working when graphic driver is enabled p

Posted: Wed Sep 28, 2016 9:18 am
by 6by9
The upstream driver has no support at all for multimedia (ie camera and codecs).
Under the old scheme the GPU set up the display composition lists. Under the new scheme it is the kernel. That results in a big mismatch if you mix and match.

You can try viewtopic.php?f=29&t=159853 which should still be using the old composition scheme but the new 3D engine.
The other lurking thought is that the AWB algorithm runs on the QPUs (3D block processors). That's going to fail with the ARM taking control of them, as there is no interprocessor arbitration. Disabling AWB may work.

Re: opencv 3.1 not working when graphic driver is enabled p

Posted: Wed Sep 28, 2016 1:14 pm
by DougieLawson
abhisek wrote:Any idea when we can expect a new OS release, last one was in the month of May...
How about today? https://raspberrypi.org/downloads

Re: opencv 3.1 not working when graphic driver is enabled p

Posted: Wed Sep 28, 2016 2:45 pm
by abhisek
DougieLawson wrote:
abhisek wrote:Any idea when we can expect a new OS release, last one was in the month of May...
How about today? https://raspberrypi.org/downloads
Awesome, thank you, let me try with latest build

Re: opencv 3.1 not working when graphic driver is enabled p

Posted: Mon Oct 10, 2016 3:33 am
by abhisek
6by9 wrote:The upstream driver has no support at all for multimedia (ie camera and codecs).
Under the old scheme the GPU set up the display composition lists. Under the new scheme it is the kernel. That results in a big mismatch if you mix and match.

You can try viewtopic.php?f=29&t=159853 which should still be using the old composition scheme but the new 3D engine.
The other lurking thought is that the AWB algorithm runs on the QPUs (3D block processors). That's going to fail with the ARM taking control of them, as there is no interprocessor arbitration. Disabling AWB may work.

Thank you, I tried viewtopic.php?f=29&t=159853, but the problem with this is opencv imshow function is not working, it simply shows gray sceen nothing else , weird :(. Although with this my 3d rendering is fast but openCV is broken