Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:vim3:add-ons:vim3-mipi-camera

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
products:sbc:vim3:add-ons:vim3-mipi-camera [2024/01/30 21:14]
nick
products:sbc:vim3:add-ons:vim3-mipi-camera [2024/05/11 03:34]
ivan [Record Video with OpenCV]
Line 40: Line 40:
 sudo apt install libopencv-dev python3-opencv sudo apt install libopencv-dev python3-opencv
 ``` ```
 +<tabbox VIM4>
  
 Get Frame via V4l2: Get Frame via V4l2:
Line 64: Line 65:
     capture.set(CAP_PROP_FRAME_WIDTH, 3840);     capture.set(CAP_PROP_FRAME_WIDTH, 3840);
     capture.set(CAP_PROP_FRAME_HEIGHT, 2160);     capture.set(CAP_PROP_FRAME_HEIGHT, 2160);
 +    
     while (count)     while (count)
     {     {
Line 84: Line 86:
  
 ``` ```
 +<tabbox VIM3>
 +
 +Get Frame via V4l2:
 +
 +```c++ mipi-camera.cpp
 +#include <opencv2/highgui/highgui.hpp>
 +#include <opencv2/imgproc/imgproc.hpp>
 +#include <opencv2/core/core.hpp>
 +#include <iostream>
 +#include <string>
 +using
 +namespace  cv;
 +
 +using
 +namespace  std;
 +
 +int main(int argc, char** argv)
 +{
 +    int count=100;
 +    string str = argv[1];
 +    string res=str.substr(10);
 +    VideoCapture capture(0);
 +    capture.set(CAP_PROP_FOURCC, VideoWriter::fourcc('U','Y','V','Y'));
 +    capture.set(CAP_PROP_FRAME_WIDTH, 3840);
 +    capture.set(CAP_PROP_FRAME_HEIGHT, 2160);
 +    
 +    while (count)
 +    {
 +        Mat frame;
 +        capture >> frame;
 +
 +        if (frame.empty()) {
 +            break;
 +        }
 +        int h = frame.rows;
 +        int w = frame.cols;
 +        const char *name = "video";
 +        namedWindow(name, 0);
 +        imshow(name, frame);
 +        waitKey(30);
 +        count--;
 +    }
 +    return 0;
 +}
 +
 +```
 +
 +</tabbox>
  
 Get Frame via Gstreamer: Get Frame via Gstreamer:
Last modified: 2024/05/11 03:48 by ivan