python - python2.7 histogram comparison - white background anomaly -


my program's purpose take 2 images , decide how similar are. im not talking here identical, similarity. example, if take 2 screenshots of 2 different pages of same website, theme colors similar , therefor want program declare similar.

my problem starts when both images have white background pretty takes on histogram calculation (over 30% of image white , rest distributed).

in case, cv2.comparehist (using correlation method, works other cases) gives bad results, is, grade high though different.

i have thought taking white (255) off histogram before comparing, requires me calculate histogram 256 bins, not when want check similarity (i thought using 32 or 64 bins best)

unfortunately cant add images im working due legal reasons

if can idea, or code solves grateful

thank much

you can remove white color, rebin histogra , compare:

  • compute histrogram 256 bins.
  • remove white bin (or make zero).
  • regroup bins have 64 bins adding values of 4 consecutive bins.
  • perform comparehist().

this work "predominant color". generalize, can following:

compare full histrograms. if different, finish. if similar, predominant color (with 256-bin histogram), , perform procedure described above, remove predominant color comparisson.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -