FlannBasedMatcher parameters explanations ? for camera tampering

Hi there, I attempt to compare two images with SURF and FLANN. The first image is basically the first frame captured of a camera when you run the app. The other image change at every frame since it is a video stream.
So my first frame is the reference, and I compare it to the other frames I get further.

So first I use xfeatures2d.SURF_create(hessianThreshold=NUMBER) to instanciate surf, and then I use FlannBasedMatcher(index_params, search_params) where index_params = dict(algorithme=KDTREE, trees=NUMBER) and search_params = dict(checks=NUMBER).

I just want to have some explanations about these parameters, for exemple, is it better to increase or decrease the trees, or the checks ? Because I don’t find any explanations on the doc.

Also, is this the best way to compare the two images for camera tampering detection ? Because the camera can switch from color mode to infra red mode so SURF doesn’t seems to support the switch. However, when it is the same color mode, SURF seems to cover all the usecases (like the camera movement, over or under exposed, etc). So what is your opinion on this choice ?

can you explain some more ? what are you trying to achieve ?
(comparing SURF features won’t help finding exposure problems, wrong tool)
example images would be helpful, too.

I explained the process of the images so :
first I draw a ROI on the first frame, which will be the image taken as a reference for the comparison. (the first image isn’t the ROI I used for the others)

Then, the first image is “cropped” as you can see.

(images at the next post because I’m a “new user”)

Then, my video run behind and I compare the reference to the current frame of the videostream.
So I am able to compare the number of keypoints and make a percentage of matches. If it is lower than a limit fixed, for more than X seconds, I can tell that the camera is tampered.

(images at the next post because I’m a “new user”)

So I can detect the tamper. However, I made this post for multiple reasons:

  1. I attempt to understand the different parameters used at the instanciation of SURF and FLANN (as explained in the first post).
  2. I want to know if SURF is a good tool to do this tampering detection project and if not, which tool I can use to fix the problem.

For the exposure, at the moment it works well, since if the compared image have no keypoints detected, I can tell that the image isn’t similar (Because when I say exposure, I mean that the camera is blind or covered or dazzled).

Thanks

also consider “background subtraction”

https://docs.opencv.org/master/d8/d38/tutorial_bgsegm_bg_subtraction.html

as for the parameters… if opencv documentation is insufficient, perhaps look for original scientific papers for the involved algorithms.

Yes I already tested background substraction but this project is for a real product and it wasn’t efficient enough since when people go through the ROI, it raised false alarms. I also consider the contour feature and then apply the surf on the contours but I don’t know if it’s a good idea.
Obviously I tried to find which techology use the current tampering detection systems but with no success, or I find experimental papers not sufficient.

Thanks for your response anyway

I meant papers/documentation on FLANN.

a start:

and perhaps try AKAZE. you chose some very old descriptors there. AKAZE will certainly perform better, regardless of any other aspects you have to figure out.

Yes I understood what you meant with “papers”, thanks :slight_smile:
Which one you consider as old descriptors ? SURF and FLANN ?

I’ll try Akaze then !

SURF is somewhat old.

FLANN isn’t a descriptor but a matcher.

Continuing the discussion from FlannBasedMatcher parameters explanations ? for camera tampering:

I tried A-KAZE and I got a worse percentage of matches than SURF. I used FLANN fot both tests, should I change to BruteForce Hamming ? I don’t know if there is a big difference between them.

I wouldn’t recommend bruteforce, just because it’s… bruteforce, i.e. takes longer. FLANN uses approximation (to gain speed) but that’s usually not noticeable compared to an exact result.

I see that you get more descriptors for each picture and the number of matches is also greater, absolutely. with these numbers, you don’t need to worry about percentages. both results look excellent and very robust.

Ok thanks for your help and your explanations