如何使用SURF和C检测视频中的对象? [英] How to detect object in a video using SURF and C?

查看:148
本文介绍了如何使用SURF和C检测视频中的对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了教程中的SURF程序来检测视频帧中的对象.但这会检测所有关键点和描述符.我如何更改程序以仅检测特定对象?

I used a SURF program from a tutorial to detect object in a video frame. but that detects all the key points and descriptors. how i change the program to detect only specific object?

CvSeq *imageKeypoints = 0, *imageDescriptors = 0;
int i;


CvSURFParams params = cvSURFParams(500, 1);
cvExtractSURF( image, 0, &imageKeypoints, &imageDescriptors, storage, params );
printf("Image Descriptors: %d\n", imageDescriptors->total);


for( i = 0; i < imageKeypoints->total; i++ )
{
CvSURFPoint* r = (CvSURFPoint*)cvGetSeqElem( imageKeypoints, i );
CvPoint center;
int radius;
center.x = cvRound(r->pt.x);
center.y = cvRound(r->pt.y);
radius = cvRound(r->size*1.2/9.*2);
cvCircle( frame, center, radius, red_color[0], 1, 8, 0 );
}

推荐答案

该算法可以检测所有健壮的关键点.使用这种算法检测特定对象的唯一方法是,拥有要检测的对象的图片(称为标记),以便能够将标记中的那些关键点与图像中的关键点进行比较.这些匹配对意味着在amrker和图像中很常见.

The algorithm is supossed to detect all the robust keypoints. The only way you have to detect a specific object with this kind of algorithms, is having a picture of the object you want to detect (called marker), to be able to compare those keypoints in the marker with the keypoints in the image. Those pairs that match mean that are common in the amrker and in the image.

了解此方法很重要:

1-您的标记带有要检测的图像.您可以使用SURF,FAST,SIFT或任何算法来检测关键点.这是离线的,您只需要在开始时做一次即可.

1 - You have your marker with the image you want to detect. You use SURF, FAST, SIFT or whatever algorithm to detect the keypoints. This is offline, you do it only onece at the beggining.

2-您开始从视频中获取帧,并对每个帧使用SURF来检测视频中的关键点.

2 - You start getting frames from video, and you use SURF for each frame to detect keypoints in the video.

3-这是真实的处理部分,您可以在其中将标记中的点与图像中的点匹配".如果没有找到匹配的对象,则该对象不在图像中.

3 - Here it comes the real processing part, where you "match" points in the marker with points in the image. If you don't get matches the object it is not in the image.

看这个示例.

这篇关于如何使用SURF和C检测视频中的对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆