I am looking to detect SURF feature points in a live video feed, however, I can't seem to find any tutorials on how to achieve this.
I am able to detect them on still images:
int minHessian = 400;
cv::SurfFeatureDetector detector(minHessian);
std::vector<cv::KeyPoint> keypoints_1;
detector.detect(img_1, keypoints_1);
cv::Mat img_keypoints_1;
drawKeypoints(img_1, keypoints_1, img_keypoints_1);
But I am not sure how you apply this to a video feed using cvCaptureFromCAM()
?
The frame grabbed by your webcam is nothing but a single image. Therefore, whatever you can do with your single image, you can do the same thing on that frame too using the same method.
Following is the code where you receive a frame
through your webcam in an infinite for loop
. Basically, you just need to read the frame and then do the same thing which you did at your single image.
Mat frame;
VideoCapture cap(0); // open the default camera
if (!cap.isOpened()) // check if we succeeded
return -1;
for (;;)
{
cap.read(frame); // get a new frame from camera
if (frame.empty()) continue;
//Now do the same thing with each frame which you did with your single image.
}