Is there anyway to compare 2 similar images (not the same) in Delphi.
here are some examples:
&
Its obvious here that we cant compare pixel by pixel, So my idea was to sum the pixels values of each image, the compare them:
function CalcPix( img : TImage) : longint;
var
s : longint;
i, j : integer;
begin
s := 0;
for i := 0 to img.Height do
begin
for j := 0 to img.Width do
begin
if img.Canvas.Pixels[i,j] <> clWhite then
s := s + img.Canvas.Pixels[i, j];
end;
end;
Result := S;
end;
the results are:
1)14836072057
2)16750850318
as you see they are not that close, and if i do this process with 4 - 5 image at a time it always give me wrong results.
Is there anyother way? like changing the color or contrast etc.
Here's good write up about the options you have: https://stackoverflow.com/a/844113/7735 This requires some background knowledge, and best performing solutions are hard to implement from ground up, so using some kind of library would be easiest. Here's OpenCV wrapper for Delphi: https://github.com/Laex/Delphi-OpenCV
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.