This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous 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:48] (current) ivan [VIM3] |
||
---|---|---|---|
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, | capture.set(CAP_PROP_FRAME_WIDTH, | ||
capture.set(CAP_PROP_FRAME_HEIGHT, | capture.set(CAP_PROP_FRAME_HEIGHT, | ||
+ | | ||
while (count) | while (count) | ||
{ | { | ||
Line 84: | Line 86: | ||
``` | ``` | ||
+ | <tabbox VIM3> | ||
+ | |||
+ | Get Frame via V4l2: | ||
+ | |||
+ | ```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; | ||
+ | } | ||
+ | |||
+ | ``` | ||
+ | |||
+ | </ | ||
Get Frame via Gstreamer: | Get Frame via Gstreamer: |