How to compare image similarity using java

Recently, I had the opportunity to cooperate with image processing technology. As part of my project, my task is to find the matching image from the image storage when giving a new image I started my project with Google search "how to compare images using java", and I got some good articles to find the similarity between the two images Almost all of these are based on four basic steps:

1.Locating the Region of Interest (Where the Objects appear in the given image),2.Re-sizing the ROIs in to a common size,3.Substracting ROIs,4.Calculating the Black and White Ratio of the resultant image after subtraction.

Although this sounds like a good algorithm for comparing images, it takes quite a long time after using Jai in my project Therefore, I must find an alternative

Any suggestions?

Solution

Depending on the image, you can do this (pseudo code) This is very primitive, but it should be very efficient You can speed up by randomly or patterned pixels instead of each pixel

for x = 0 to image.size:
    for y = 0 to image.size:
        diff += abs(image1.get(x,y).red - image2.get(x,y).red)
        diff += abs(image1.get(x,y).blue - image2.get(x,y).blue)
        diff += abs(image1.get(x,y).green - image2.get(x,y).green)
    end
end

return ((float)(diff)) / ( x * y * 3)
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>