gpt4 book ai didi

c++ - 键盘输入以保存从opencv中的视频流中检测到的图像

转载 作者:行者123 更新时间:2023-11-28 02:58:32 24 4
gpt4 key购买 nike

我正在尝试使用 opencv 进行面部识别,并在键盘输入时保存在 cvRect 中检测到的图像(在我的例子中,当按下键盘上的“c”时,应该使用检测到的面部创建图像在文件夹中。) 但是,我猜中断 (cvWaitKey()) 给我带来了很多问题,系统没有响应。非常感谢您在这方面的投入!

代码在这里:

char d = cvWaitKey(33);

if (d==67) // if the keyboard c is pressed
{
// r is the cvRect created for the face detected
cvSetImageROI(img, cvRect(pt1.x,pt1.y,r->width,r->height));

//img is the video frame passed in here
IplImage* img2 = cvCreateImage(cvGetSize(img),img->depth,img->nChannels);

cvCopy(img, img2, NULL);

cvResetImageROI(img);

cvSaveImage("roi.jpg",img2);
}

在此之前的代码将是非常标准的网络摄像头人脸检测。它有效。谢谢!

最佳答案

67?写成'C'就更清楚了。那也会向您展示真正的问题:您可能是指 'c'

关于c++ - 键盘输入以保存从opencv中的视频流中检测到的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21443158/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com