Skip to content

equalizeHist

Image processingfunctionOpenCV 5.0.0
import { equalizeHist } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

Equalizes the histogram of a grayscale image.

The function equalizes the histogram of the input image using the following algorithm:

  • Calculate the histogram H for src .
  • Normalize the histogram so that the sum of histogram bins is 255.
  • Compute the integral of the histogram:
H'_i =  \sum _{0  \le j < i} H(j)
  • Transform the image using H' as a look-up table: \texttt{dst}(x,y) = H'(\texttt{src}(x,y))

The algorithm normalizes the brightness and increases the contrast of the image.

equalizeHist(src: Mat, dst: Mat): void;
src

Source 8-bit single channel image.

dst

Output destination, filled by the native operation. Destination image of the same size and type as src .

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.