How to detect object in a video using SURF and C?
Asked Answered
R

1

2

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 );
}
Rotterdam answered 3/6, 2012 at 2:17 Comment(0)
R
3

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.

It is important that you understand the method:

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 - You start getting frames from video, and you use SURF for each frame to detect keypoints in the video.

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.

Look at this example.

Rateable answered 3/6, 2012 at 8:31 Comment(5)
is this possible for real time system like road sign detection system?Rotterdam
Sure, it is. But you have to see how long does it take to do the matching with all the signs. Maybe there are simpler better aproaches for this task.Rateable
are there any method that you have to suggest for this road sign detection system?Rotterdam
cvMatchTemplate uses a different algorithm to match 2 images, and not two sets of keypoints. You can find info about keypoint matching in the SIFT/SURF descriptor docs.Actual
yes you are right, sorry. Uses crosscorelation by FFT. I will correct it. Answering on Sundays is not ok...Rateable

© 2022 - 2024 — McMap. All rights reserved.