【发布时间】:2021-11-11 23:14:40
【问题描述】:
我是 C++ 新手,我正在尝试转换此代码,以便它可以拍摄图像而不是视频。 这是用于 OpenCV 的人脸检测。我可以弄清楚 Mat,我需要传递图像而不是视频,只是不知道该怎么做。任何帮助将不胜感激。
谢谢。
int main()
{
VideoCapture capture;
//open capture object at location zero (default location for webcam)
capture.open(0);
//set height and width of capture frame
capture.set(CV_CAP_PROP_FRAME_WIDTH,320);
capture.set(CV_CAP_PROP_FRAME_HEIGHT,480);
Mat cameraFeed;
SkinDetector mySkinDetector;
Mat skinMat;
//start an infinite loop where webcam feed is copied to cameraFeed matrix
//all of our operations will be performed within this loop
while(1){
//store image to matrix
capture.read(cameraFeed);
//show the current image
imshow("Original Image",cameraFeed);
skinMat= mySkinDetector.getSkin(cameraFeed);
imshow("Skin Image",skinMat);
waitKey(30);
}
return 0;
}
【问题讨论】:
标签: c++ opencv opencv3.0 face-recognition face-detection