Answer the question
In order to leave comments, you need to log in
How to compare two images on delphi with percentage error?
It is necessary to make a function so that at the input there are 2 images, which in the function itself are compared for similarity with a percentage error and the output is true/false: true - similar, false - not similar
Answer the question
In order to leave comments, you need to log in
Can. For example, you can simply compare pixel by pixel. By specifying the allowable error of the difference between pixels.
Getting access to pixels is very easy. Via Bitmap.Canvas.Pixels[x, y] or faster via scanline[y]
In such a question, the Algorithms tag would be more appropriate, and Delphi and Pascal are just possible tools for implementing the selected algorithm.
It is necessary to decide what you want to consider as similar images (the mentioned percentage error does not add information). Identical pixel by pixel or something more complex? Turned at an angle? Mirrored? Reduced or enlarged? With a changed color palette? The same object, taken from different angles?
Depending on this, the algorithm may consist only of a pixel iteration cycle, or it may consist of a neural network.
So:
1) formulate your similarity criteria;
2) you come up with or look for a ready-made algorithm for them;
3) and even implement it on Delphi, at least on anything.
Make a link to the pHash library and compare hashes by Hamming distance.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question