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:vim4-mipi-camera [2023/07/04 22:55] nick |
products:sbc:vim4:add-ons:vim4-mipi-camera [2024/09/24 03:46] (current) nick [Preview video on ubuntu desktop] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ~~tag> VIM4 OpenCV V4l2 MIPI ISP ~~ | ||
| + | |||
| + | {{indexmenu_n> | ||
| ====== VIM4 MIPI Camera Usage ====== | ====== VIM4 MIPI Camera Usage ====== | ||
| - | ===== Video Node ===== | + | ===== Linux ===== |
| + | |||
| + | ==== Upgrade System ==== | ||
| + | |||
| + | Please follow the [[products: | ||
| + | |||
| + | ==== Video Node ==== | ||
| The video node for MIPI camera is ''/ | The video node for MIPI camera is ''/ | ||
| - | ===== Record Video via Gstreamer | + | ==== Record Video via Gstreamer ==== |
| - | ==== Install | + | Follow the steps below to install |
| ```shell | ```shell | ||
| sudo apt update | sudo apt update | ||
| Line 15: | Line 25: | ||
| ``` | ``` | ||
| - | ==== Record Video ==== | + | Record Video: |
| ```shell | ```shell | ||
| - | gst-launch-1.0 v4l2src device=/ | + | gst-launch-1.0 |
| ``` | ``` | ||
| - | ===== Record Video with OpenCV | + | ==== Record Video with OpenCV ==== |
| - | ==== Install | + | Follow the steps below to install |
| ```shell | ```shell | ||
| Line 30: | Line 41: | ||
| ``` | ``` | ||
| - | ==== C++ ==== | + | Get Frame via V4l2: |
| - | + | ||
| - | + | ||
| - | === Get Frame via V4l2 === | + | |
| ```c++ mipi-camera.cpp | ```c++ mipi-camera.cpp | ||
| Line 54: | Line 62: | ||
| VideoCapture capture(stoi(res), | VideoCapture capture(stoi(res), | ||
| capture.set(CAP_PROP_FOURCC, | capture.set(CAP_PROP_FOURCC, | ||
| - | capture.set(CAP_PROP_FRAME_WIDTH, | + | capture.set(CAP_PROP_FRAME_WIDTH, |
| - | capture.set(CAP_PROP_FRAME_HEIGHT, | + | capture.set(CAP_PROP_FRAME_HEIGHT, |
| while (count) | while (count) | ||
| { | { | ||
| Line 77: | Line 85: | ||
| ``` | ``` | ||
| - | + | Get Frame via Gstreamer: | |
| - | == Get Frame via Gstreamer | + | |
| ```c++ mipi-camera.cpp | ```c++ mipi-camera.cpp | ||
| Line 97: | Line 104: | ||
| string str = argv[1]; | string str = argv[1]; | ||
| string gstformat = " | string gstformat = " | ||
| - | string gstfile = " | + | string gstfile = " |
| VideoCapture capture(gstfile); | VideoCapture capture(gstfile); | ||
| Line 133: | Line 140: | ||
| ``` | ``` | ||
| - | ====== New VIM4 MIPI Camera Usage ====== | + | ==== Preview video on ubuntu desktop |
| - | ===== Enable Overlays ===== | + | <tabbox Ubuntu 24.04> |
| - | If you want to use the OS08A10 MIPI camera, you need to enable it in [[products: | + | You can use gstreamer |
| + | ```shell | ||
| + | gst-launch-1.0 v4l2src device=/ | ||
| ``` | ``` | ||
| - | $ cat / | ||
| - | fdt_overlays=vim4n-os08a10 | ||
| - | ``` | ||
| - | |||
| - | And then reboot to take effect. | ||
| - | |||
| - | ===== Video Node ===== | ||
| - | |||
| - | The video node is ''/ | ||
| - | |||
| - | ===== Get Frames via Mediactl API ===== | ||
| - | |||
| - | You can get the test source code here: https:// | ||
| - | |||
| - | Download and build the test source code: | ||
| - | |||
| - | <tabbox 5.4 kernel> | ||
| + | You can use the command below to check display fps: | ||
| ```shell | ```shell | ||
| - | $ git clone https:// | + | gst-launch-1.0 -v v4l2src device=/dev/video50 io-mode=mmap ! video/x-raw, |
| - | $ cd v4l2_media_test | + | |
| - | $ git checkout e0482794337c01935593a91b621f9c42123cf175 | + | |
| - | $ g++ v4l2_test_raw.cpp | + | |
| - | $ ls v4l2_test_raw | + | |
| - | v4l2_test_raw | + | |
| ``` | ``` | ||
| - | < | + | < |
| + | |||
| + | You can use gstreamer '' | ||
| ```shell | ```shell | ||
| - | $ git clone https:// | + | gst-launch-1.0 v4l2src device=/dev/video50 io-mode=mmap ! video/x-raw, |
| - | $ cd v4l2_media_test | + | |
| - | $ g++ v4l2_test_raw.cpp | + | |
| - | $ ls v4l2_test_raw | + | |
| - | v4l2_test_raw | + | |
| ``` | ``` | ||
| - | </ | + | You can use the command below to check display fps: |
| - | + | ||
| - | Test: | + | |
| ```shell | ```shell | ||
| - | $ ./ | + | gst-launch-1.0 -v v4l2src device=/dev/video50 io-mode=mmap ! video/ |
| ``` | ``` | ||
| - | It will capture 10 frames to file '' | + | You press '' |
| - | Preview the file: | + | </ |
| - | ```shell | + | ===== Android ===== |
| - | $ ffplay -f rawvideo -pixel_format nv21 -video_size 3840x2160 / | + | WIP: |
| - | ``` | ||