This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
products:sbc:edge2:add-ons:imx415-mipi-camera [2023/07/04 22:25] nick |
products:sbc:edge2:add-ons:imx415-mipi-camera [2025/08/27 02:02] (current) nick |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | {{indexmenu_n> | ||
| + | |||
| + | |||
| ====== Edge2 IMX415 MIPI Camera ====== | ====== Edge2 IMX415 MIPI Camera ====== | ||
| Line 13: | Line 16: | ||
| {{: | {{: | ||
| - | ===== Upgrade System ===== | + | ===== Camera Usage ===== |
| - | + | ||
| - | Please follow the [[products: | + | |
| - | + | ||
| - | + | ||
| - | ===== Edge2 MIPI Camera Usage ===== | + | |
| - | + | ||
| - | ==== Video Node ==== | + | |
| - | + | ||
| - | You can find the video node from the table below. | + | |
| - | + | ||
| - | | ^ Video Node ^ | + | |
| - | ^ CAM1 | / | + | |
| - | ^ CAM2 | / | + | |
| - | ^ CAM3 | / | + | |
| - | + | ||
| - | ==== Record Video with Gstreamer ==== | + | |
| - | + | ||
| - | === 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++ 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 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; | + | |
| - | } | + | |
| - | + | ||
| - | ``` | + | |
| - | + | ||
| - | Compile: | + | |
| - | + | ||
| - | ```shell | + | |
| - | 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: | + | |
| - | + | ||
| - | Here we take '' | + | |
| - | + | ||
| - | + | ||
| - | ```shell | + | |
| - | ./mipi / | + | |
| - | ``` | + | |
| - | + | ||
| - | ==== Capture Frame with V4L2 API ==== | + | |
| - | + | ||
| - | === Install V4l2 Utils === | + | |
| - | + | ||
| - | ```shell | + | |
| - | sudo apt update | + | |
| - | sudo apt install v4l-utils | + | |
| - | ``` | + | |
| - | + | ||
| - | === Capture Frame === | + | |
| - | + | ||
| - | Here we take '' | + | |
| - | + | ||
| - | ```shell | + | |
| - | v4l2-ctl -d / | + | |
| - | ``` | + | |
| - | + | ||
| - | It will capture a '' | + | |
| - | + | ||
| - | + | ||
| - | Preview the file: | + | |
| - | + | ||
| - | ```shell | + | |
| - | $ ffplay -f rawvideo -pixel_format nv12 -video_size 3840x2160 / | + | |
| - | ``` | + | {{page> |
| ===== See Also ===== | ===== See Also ===== | ||
| - | * [[pp>os08a10-8mp-camera|Buy | + | * [[pp>imx415-camera|Buy |
| - | * [[dl> | + | * [[dl> |