If you want to compare images, the better method is (better than histogram or template matching) feature matching method. In this method, the image is analyzed much more layers and steps. So, it is slower than other methods, on the other hand it wants to much more computer requirements. CPU or GPU power can be listed.
SURF means Speeded-Up Robust Features. First time it known SIFT but it works very slow. Project engineers was worked on this project in 2006 and SURF was created. It is partly inspired by the scale-invariant feature transform (SIFT) descriptor but itself algorithm but much more faster it.
You can find more information about it:
If you would like to integrate SURF libraries opencv, you have to install opencv_contribution version. Because some libraries cannot located on default opencv version.
Opencv Contribution Download Link: