I am trying to use shape_example.cpp provided by opencv as a foundation of comparing images. However, I dont know why the distance calculated by the c++ is quite random - there is different distance even when comparing the same image...
The source code can be found : github.com/Itseez/opencv/blob/master/samples/cpp/shape_example.cpp
I copied 4 copies of an image and run the program..
Samples tested: Samples
Distance calculated: Results
Somehow when I changed the image file format from jpg to bnp, the distance found will be more steady and small. However, It is still a bit strange for identical images. The difference calculated: 0.0305, 0.0308, 0.0287, 0.0315, 0.03916.
The difference calculated will be a bit larger and not steady when Hausdoff Distance is chosen. The difference calculated: 1, 4.12311, 1, 2,0. Therefore, I would like to ask which distance method (shape distance or Hausdoff distance) will be better and representative for product inspection (comparing images of different products) and how to set the threshold of rejecting objects... Thanks~
Aucun commentaire:
Enregistrer un commentaire