#include
#include
using namespace std;
using namespace cv;
int main(int argc, char** argv)
{
VideoCapture cap(0);
if (!cap.isOpened())
{
printf("Can not open a camera\n");
return -1;
}
while (true)
{
Mat frame, hsvedges, edges;
cap >> frame;
if (frame.empty())
break;
cvtColor(frame, hsvedges, COLOR_BGR2HSV);
imshow("hsvedges", hsvedges);
cvtColor(frame, edges, COLOR_BGR2GRAY);
Canny(edges, edges, 175, 255, 3);
imshow("edges", edges);
//等待 30 秒,如果按键则推出循环
if (waitKey(30) >= 0)
break;
}
waitKey(0);
return 0;
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)