把问题描述清楚,你这样只贴张图在这里都不知道你到底要干嘛。
你们仓库的https://docs.khadas.com/zh-cn/vim3/HowToUseMIPICamera.html 这里面的cpp文件怎么跑的起来
固件是linux khadas 4.9.241 #20 SMP PREEMT Thu May 20 18:06:42 CST 2021 aarch64 aarch64 aarch64 GNU/LINUX
代码就是
#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));
capture.set(CV_CAP_PROP_FRAME_WIDTH, 1920);
capture.set(CV_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";
cvNamedWindow(name, 0);
cvResizeWindow(name, w / 1, h / 1);
imshow(name, frame);
waitKey(30);
count--;
}
return 0;
}
我们文档上的代码肯定是没问题的,我们这边测试过。
你上面编译报错的问题很显然是语法问题,是不是你复制粘贴代码有问题?把前面的数字前缀也给复制进去了?你自己去检查下。
你登录进板子ubuntu系统后把你的代码cat出来,然后截图贴出来:
$ cat test.cpp
这段代码我已经跑通了,但是mipi摄像头点亮了一下,板子就关机了。另外,我还有个需求,可不可以把这段代码写成一个package分享给我。
检查下供电,确保使用的是我们的Type C PD适配器。
这个需要你自己去做了,我们只是提供一个最基本的demo而已。
Type C PD 适配器 有链接吗,我用的华为手机荣耀10自带的type C 适配器