4

I'm trying to recreate an algorithm (from this publication) on Python's OpenCV to detect if an image has a washed-out effect or not.

The paper states the following:

"Washed out images have a reduced dynamic range (in the gray-scale image) with respect to images with natural colors. The compliance score is simply calculated by rescaling the dynamic range of the gray-scale image to [0;100]"

The problem is, I dont understand what a grayscale dynamic range is.

Is this about calculating the difference between the min and max pixel value of a grayscale image [0-255] and rescale that value to a range of [0-100]?

Jeru Luke
  • 20,118
  • 13
  • 80
  • 87
jruivo
  • 447
  • 1
  • 8
  • 22
  • 2
    Yes, the dynamic range is the difference between max and min. The quote probably misses some information, because simply scaling the intensity values of the image doesn't give you a score, something else must be done too. – Cris Luengo Jul 13 '18 at 04:17
  • 3
    probably: by example: If your range is 0..255 => gdr=255 your score is 100. For a range of 80..173 => gdr=93 your score is 93*100/255=36.47 but that's only my intuition, didn't read the paper ;) – Micka Jul 13 '18 at 05:25

1 Answers1

4

I found the paper on researchgate.com. The paper talks about the various standards that face images have to pass in order to be labelled as machine readable. Because machines unlike humans cannot understand face images under various conditions like lighting, occlusion, pose difference, etc. There was not much info regarding ICAO 13 apart from the statement in the question. So I presume it would be the following way.

Converting the gray-scale image to a dynamic range according to ICAO 13 can be done the following way:

enter image description here

I have taken a sample image from the OpenCV docs to illustrate this:

Code:

import cv2
import numpy as np

img = cv2.imread(path + 'wiki.jpg', 0)

print(((np.max(img) - np.min(img)) * 100) / 255)
cv2.imshow(path + 'normal.jpg', img)

equ = cv2.equalizeHist(img)
print(((np.max(equ) - np.min(equ)) * 100) / 255)
cv2.imshow(path + 'equalized.jpg', equ)

Result:

 Dynamic range of original image : 36
 Dynamic range of equalized image : 100

Original Image:

enter image description here

Equalized Image:

enter image description here

Now since you have the value between 0 - 100, you can select a threshold value (say 85) and say that images having value of 85 and above are qualified as machine-readable. If the value is below the threshold, discard the image.

Jeru Luke
  • 20,118
  • 13
  • 80
  • 87