This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
products:sbc:vim4:add-ons:os08a10-mipi-camera [2023/06/05 04:27] nick |
products:sbc:vim4:add-ons:os08a10-mipi-camera [2025/05/14 22:39] (current) nick |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ~~tag> VIM4 MIPI Camera ISP IP~~ | ||
| + | |||
| + | {{indexmenu_n> | ||
| + | |||
| ====== VIM4 OS08A10 MIPI Camera ====== | ====== VIM4 OS08A10 MIPI Camera ====== | ||
| ===== Introduction ===== | ===== Introduction ===== | ||
| - | This document mainly introduces [[https:// | + | This document mainly introduces |
| ===== Hardware Connection ===== | ===== Hardware Connection ===== | ||
| Line 10: | Line 15: | ||
| </ | </ | ||
| - | {{/ | + | {{/ |
| + | ===== Identify VIM4 Version ===== | ||
| - | ===== VIM4 ===== | + | <WRAP important > |
| + | 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. | ||
| - | ==== Video Node ==== | + | </WRAP> |
| - | + | ||
| - | The video node for MIPI camera is ''/ | + | |
| - | + | ||
| - | ==== Record Video via Gstreamer ==== | + | |
| - | + | ||
| - | + | ||
| - | === Install Gstreamer Encoder Plugin === | + | |
| - | ```shell | + | |
| - | sudo apt update | + | |
| - | sudo apt install gstreamer-aml | + | |
| - | ``` | + | |
| - | + | ||
| - | === Record Video === | + | |
| - | ```shell | + | |
| - | gst-launch-1.0 v4l2src device=/ | + | |
| - | ``` | + | |
| - | + | ||
| - | + | ||
| - | ==== 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 < | + | |
| - | #include < | + | |
| - | #include < | + | |
| - | #include < | + | |
| - | using | + | |
| - | namespace | + | |
| - | + | ||
| - | using | + | |
| - | namespace | + | |
| - | + | ||
| - | int main(int argc, char** argv) | + | |
| - | { | + | |
| - | int count=100; | + | |
| - | string str = argv[1]; | + | |
| - | string res=str.substr(10); | + | |
| - | VideoCapture capture(stoi(res), | + | |
| - | capture.set(CAP_PROP_FOURCC, | + | |
| - | capture.set(CAP_PROP_FRAME_WIDTH, | + | |
| - | capture.set(CAP_PROP_FRAME_HEIGHT, | + | |
| - | while (count) | + | |
| - | { | + | |
| - | Mat frame; | + | |
| - | capture >> frame; | + | |
| - | + | ||
| - | if (frame.empty()) { | + | |
| - | break; | + | |
| - | } | + | |
| - | int h = frame.rows; | + | |
| - | int w = frame.cols; | + | |
| - | const char *name = " | + | |
| - | namedWindow(name, | + | |
| - | imshow(name, | + | |
| - | waitKey(30); | + | |
| - | count--; | + | |
| - | } | + | |
| - | return 0; | + | |
| - | } | + | |
| - | + | ||
| - | ``` | + | |
| - | + | ||
| - | + | ||
| - | == Get Frame via Gstreamer == | + | |
| - | + | ||
| - | ```c++ mipi-camera.cpp | + | |
| - | #include < | + | |
| - | #include < | + | |
| - | #include < | + | |
| - | #include < | + | |
| - | #include < | + | |
| - | using | + | |
| - | namespace | + | |
| - | + | ||
| - | using | + | |
| - | namespace | + | |
| - | + | ||
| - | int main(int argc, char** argv) | + | |
| - | { | + | |
| - | int count=100; | + | |
| - | string str = argv[1]; | + | |
| - | string gstformat = " | + | |
| - | string gstfile = " | + | |
| - | VideoCapture capture(gstfile); | + | |
| - | + | ||
| - | while (count) | + | |
| - | { | + | |
| - | Mat frame; | + | |
| - | capture >> frame; | + | |
| - | + | ||
| - | if (frame.empty()) { | + | |
| - | break; | + | |
| - | } | + | |
| - | int h = frame.rows; | + | |
| - | int w = frame.cols; | + | |
| - | const char *name = " | + | |
| - | namedWindow(name, | + | |
| - | imshow(name, | + | |
| - | waitKey(30); | + | |
| - | count--; | + | |
| - | } | + | |
| - | return 0; | + | |
| - | } | + | |
| - | + | ||
| - | ``` | + | |
| - | + | ||
| - | Compile: | + | |
| - | ```shell | + | Please check the [[products: |
| - | 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/ | + | |
| - | ``` | + | |
| - | Test: | + | ===== Upgrade System ===== |
| - | ```shell | + | Please follow the [[products: |
| - | ./mipi / | + | |
| - | ``` | + | |
| - | ===== New VIM4 ===== | + | ===== Camera Usage ===== |
| + | * [[products: | ||
| + | * [[products: | ||
| ===== See Also ===== | ===== See Also ===== | ||
| * [[pp> | * [[pp> | ||
| - | * [[dl> | + | * [[dl> |
| - | + | ||