0

I have two images which are same but differ by brightness level. I was using a code to generate hash codes for image comparison by converting an image to 9*9 pixels which compares every adjacent pixels (8 pairs) and 1 would be appended in the hash code if the left pixel is brighter than the right and 0 if the right pixel is brighter than the left. Since it is taking color into consideration, I'm not able to identify images that are same even though their brightness levels are different. Need help. Thanks in advance.

  • Why dont you convert both in grayscale – Shubham Srivastava Oct 08 '18 at 10:17
  • 1
    I did something similar here https://stackoverflow.com/a/35153895/1315444 – fubo Oct 08 '18 at 10:18
  • @fubo I tried that code, it's working well for the exact same images with exact same brightness level. I'm looking for a code that would ignore the brightness and just consider the image's content in order to decide if it's identical or not. – Rakshita Kv Oct 08 '18 at 10:23
  • I imagine you're comparing RGB values, but if you compare HSB values only the Brightness will change with brightness - so you could compare the Hue and Saturation to find identical pixels. https://codeitdown.com/hsl-hsb-hsv-color/ – Robin Bennett Oct 08 '18 at 10:23
  • @RakshitaKv _instead of setting 0.5f to differ between light and dark - use the distinct median brightness_ did you even read the answer? – fubo Oct 08 '18 at 10:24
  • @fubo what is the ideal range that I should consider in order to neglect the brightness? – Rakshita Kv Oct 08 '18 at 10:56
  • @VIPER I tried doing that as well but it is taking brightness into consideration. – Rakshita Kv Oct 08 '18 at 12:55
  • @RakshitaKv try converting greyscale images to hsv i would have to do research to find exactly how it can be achieved – Shubham Srivastava Oct 08 '18 at 13:02

0 Answers0