0

Currently, I am doing histogram equalization on a 16 bit image, would the range change from [0, 65536] after the process?

import numpy as np
hist, bins = np.histogram(img.flatten(), 65536, [0, 65536])  # Collect 16 bits histogram (65536 = 2^16)
maximus
  • 335
  • 2
  • 16
  • 1
    What do you mean by "change"? I think `np.histogram` is certainly not the most suited function here. Consider looking [`np.digitize`](https://numpy.org/doc/stable/reference/generated/numpy.digitize.html) (it should be faster and guarantee the size of the output) – Jérôme Richard Jul 28 '22 at 15:19

1 Answers1

0

The range of pixel intensities would stay [0, 65536] due to the weight factor of 65536 in the transform map. More details in link below.

transform_map = np.floor(65536* chistogram_array).astype(np.uint8)

https://levelup.gitconnected.com/introduction-to-histogram-equalization-for-digital-image-enhancement-420696db9e43

maximus
  • 335
  • 2
  • 16