forked from floratest1/SpireCV
29 lines
512 B
C++
29 lines
512 B
C++
#include <iostream>
|
|
#include <string>
|
|
// 包含SpireCV SDK头文件
|
|
#include <sv_world.h>
|
|
|
|
using namespace std;
|
|
|
|
int main(int argc, char *argv[]) {
|
|
// 打开摄像头
|
|
sv::Camera cap;
|
|
cap.setWH(1280, 720);
|
|
cap.setFps(30);
|
|
cap.open(sv::CameraType::V4L2CAM, 0); // CameraID 0
|
|
// 实例化OpenCV的Mat类,用于内存单帧图像
|
|
cv::Mat img;
|
|
while (1)
|
|
{
|
|
// 读取一帧图像到img
|
|
cap.read(img);
|
|
|
|
// 显示img
|
|
cv::imshow("img", img);
|
|
cv::waitKey(10);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|