Identifying 2 same images using Java

前端 未结 10 2482
别那么骄傲
别那么骄傲 2020-12-28 21:10

I have a problem in my web crawler where I am trying to retrieve images from a particular website. Problem is that often I see images that are exactly same but different in

10条回答
  •  庸人自扰
    2020-12-28 21:27

    Hashing is already suggested and recognizing if two files are identical is very easy, but you said pixel level. If you want to recognize two images even if they are in different formats (.png/.jpg/.gif/..) and even if they were scaled I suggest: (using an image library and if the image are medium/big no 16x16 icons):

    1. scale the image to some fixed size, it depends on the samples
    2. transform it to grey scale using the RGB-YUV conversion for exampel and taking Y from there (very easy) 3 Do the hamming distance of each image and set a threshold to decide if they are the same or not.

    You will do a sum of the difference of all the grey pixels of both images you get a number if the difference is < T you consider both images identical

    --

提交回复
热议问题