Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:vim4:add-ons:os08a10-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
Next revision
Previous revision
products:sbc:vim4:add-ons:os08a10-mipi-camera [2023/01/10 04:55]
nick
products:sbc:vim4:add-ons:os08a10-mipi-camera [2023/09/10 01:10] (current)
hyphop
Line 1: Line 1:
 +~~tag> VIM4 MIPI Camera ISP IP~~
 +
 +{{indexmenu_n>30}}
 +
 ====== VIM4 OS08A10 MIPI Camera ====== ====== VIM4 OS08A10 MIPI Camera ======
  
 ===== Introduction ===== ===== Introduction =====
  
-This document mainly introduces MIPI Camera. The document is divided into two parts,The first part of the document describes how to connectThe second part introduces How to record video via Gstreamer and test your camera under Ubuntu.+This document mainly introduces the usage of [[https://www.khadas.com/product-page/os08a10-8mp-camera | OS08A10 MIPI Camera]] 
 ===== Hardware Connection ===== ===== Hardware Connection =====
  
 <WRAP important > <WRAP important >
-The reverse connection will burn the camera, please check the connection of the picture carefully before connecting.+The reverse connection will damage the camera, please check the connection of the picture carefully before connecting.
 </WRAP> </WRAP>
  
-{{/products/sbc/vim4/gallery/vim4-camera-os8a10.png?600|docs-vim4-camera-os8a10}}+{{/products/sbc/vim4/gallery/vim4-camera-os8a10.webp?600|docs-vim4-camera-os8a10}}
  
-===== Video Node =====+===== Identify VIM4 Version =====
  
-The video node for MIPI camera is ''/dev/video50''.+<WRAP important >
  
-===== Record Video via Gstreamer =====+There are two versions of **VIM4**, they are **VIM4** and **New VIM4**, as they have different ISP IP core, so the usage of MIPI camera is also different, 
 +please follow the documentation to identify your VIM4 version and choose the right documentation for your VIM4.
  
 +</WRAP>
  
-==== Install Gstreamer Encoder Plugin ==== +Please check the [[products:sbc:vim4:configurations:identify-version| documentation]] to identify your VIM4 version.
-```shell +
-sudo apt update +
-sudo apt install gstreamer-aml +
-``` +
- +
-==== Record Video ==== +
-```shell +
-gst-launch-1.0 v4l2src device=/dev/video50 io-mode=mmap num-buffers=300 ! amlvenc ! h264parse ! qtmux ! filesink location=test_50.mp4 +
-``` +
- +
- +
-===== Record Video with OpenCV ===== +
- +
-==== Install OpenCV ==== +
- +
-```shell +
-sudo apt update +
-sudo apt install libopencv-dev python3-opencv +
-``` +
- +
-==== C++ ==== +
- +
-/* +
-=== 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(stoi(res), CAP_V4L2); +
-    capture.set(CAP_PROP_FRAME_WIDTH, 1920); +
-    capture.set(CAP_PROP_FRAME_HEIGHT, 1080); +
-    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; +
-+
-``` +
-*/ +
- +
-=== Get Frame via Gstreamer === +
- +
-```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 gstformat = "NV12"; +
-    string gstfile = "v4l2src device=" + str + " ! video/x-raw,format=" + gstformat + ",width=1920,height=1080,framerate=30/1 ! videoconvert ! appsink"; +
-    VideoCapture capture(gstfile); +
- +
-    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; +
-+
- +
-```+
  
-Compile:+===== Upgrade System =====
  
-```shell +Please follow the [[products:sbc:vim4:configurations:upgrade-system|documentation ]]to upgrade your system to latest version.
-gcc -o mipi mipi-camera.cpp -lopencv_imgproc -lopencv_core -lopencv_videoio -lopencv_imgcodecs -lopencv_highgui -std=c++11 -std=gnu++11 -Wall -std=c++11 -lstdc++ -I/usr/include/opencv4 +
-```+
  
-Test:+===== Camera Usage =====
  
-```shell +  * [[products:sbc:vim4:add-ons:vim4-mipi-camera|]] 
-./mipi /dev/video50 +  * [[products:sbc:vim4:add-ons:new-vim4-mipi-camera|]]
-```+
  
 ===== See Also ===== ===== See Also =====
Line 145: Line 41:
   * [[pp>os08a10-8mp-camera|Buy OS08S10-8MP camera]]   * [[pp>os08a10-8mp-camera|Buy OS08S10-8MP camera]]
   * [[dl>products/add-ons/os08a10/|OS08A10 Hardware Documentations]]   * [[dl>products/add-ons/os08a10/|OS08A10 Hardware Documentations]]
-  
  
Last modified: 2023/01/10 04:55 by nick