abhisek
Posts: 11
Joined: Mon Sep 26, 2016 5:40 pm

opencv 3.1 not working when graphic driver is enabled pi3

Mon Sep 26, 2016 6:00 pm

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.

ban6
Posts: 6
Joined: Tue Sep 27, 2016 8:40 am

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

Wed Sep 28, 2016 6:48 am

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
Last edited by ban6 on Sat Dec 10, 2016 1:02 pm, edited 1 time in total.

abhisek
Posts: 11
Joined: Mon Sep 26, 2016 5:40 pm

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

Wed Sep 28, 2016 7:29 am

Any idea when we can expect a new OS release, last one was in the month of May...

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7124
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

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

Wed Sep 28, 2016 9:18 am

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.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
DougieLawson
Posts: 35777
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

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

Wed Sep 28, 2016 1:14 pm

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
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

abhisek
Posts: 11
Joined: Mon Sep 26, 2016 5:40 pm

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

Wed Sep 28, 2016 2:45 pm

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

abhisek
Posts: 11
Joined: Mon Sep 26, 2016 5:40 pm

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

Mon Oct 10, 2016 3:33 am

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

Return to “Advanced users”