Nanopi M4 based Opencv open USB camera

A. Environmental Choice

For the first time Nanopi M4 ARM board, it is initially loaded to the official rk3399-sd-friendlydesktop-bionic-4.4-arm64-20190523.img,

But I finally gave up using the system for the following reasons:

1. Failed to update, even if the replacement of the download source, problems still arise;

2. The official installation tutorial is Opencv4.1, I'm not used to use when I install opencv, because of the download source, the installation is unsuccessful;

3. The unexpected system error, such as after the death of the card to log in again, in the user pi, enter the password pi, still can not enter the system, can only be re-brush system;

Based on this, I replace official to rk3399-sd-lubuntu-desktop-xenial-4.4-armhf-20190523.img; this system is operating normally, the following operations are performed on the system;

Second, according to a conventional process, installed on Opencv;

     Reference blog: https://blog.csdn.net/u012840934/article/details/90235040

    https://blog.csdn.net/weixin_44419695/article/details/88751066

III. Open the single USB camera

   After inserting the USB camera on / dev / we found that video8 and video9 two devices, then insert a USB camera, you will find two extra video10 video11 and equipment, as to why there will be two equipment numbers, I do not know, to be later resolved.

    Use: v4l2-ctl -d / dev / video8 --list-formats confirm specific camera device number; Video8 finally determined I video10 is the device number and the camera

     Opencv turning on the camera using a very simple operation, as follows:

#include <opencv2 / opencv.hpp>
#include <the iostream>
the using namespace STD;
the using namespace CV;
int main (int argc, char ** the argv)
{
    VideoCapture CAP;
    cap.open (. 8);
    the while (. 1)
    {
        Mat frame; // define a variable source of a video display a
        CAP >> frame;
        IF (frame.empty ())
        {
            COUT << "Finish" << endl;
            BREAK;
        }
        imshow ( "the Input video", frame );
        waitKey (. 1);
    }
    cap.release ();
    return 0;
 
}

I Keyiqueding my webcam is video8, but by opencv open (8), there is a problem, always run unsuccessful, I do not even open () 0 · --- 9, have failed, the way is finally adopted:

       rm  /dev/video0

       cp  /dev/video8 /dev/video0 ;     

       Opencv then at the open (0) operation, success;

IV. Open two USB camera (failed)

     Imitation of the operation, I had rm / dev / video1; cp / dev / video10 / dev / video1;    

     If the same time, only to run a camera, can be successful, but if the two run at the same time, only a picture captured by the camera, and the other is blocked; the need to continue to address the issue

 

 


 

    

Guess you like

Origin blog.csdn.net/u012840934/article/details/92397634