Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 在opencv中保存从视频流检测到的图像的键盘输入_C++_Opencv - Fatal编程技术网

C++ 在opencv中保存从视频流检测到的图像的键盘输入

C++ 在opencv中保存从视频流检测到的图像的键盘输入,c++,opencv,C++,Opencv,我试图使用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 d

我试图使用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'

你能告诉我问题到底是什么吗?它不是进入街区还是别的什么?