Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Demo:Histogram Equalization #48

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/src/assets/demos/histogram_equalization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions docs/src/demos/histogram_equalization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# [Histogram Equalization](@id histogram_equalization)

This illustration enhances an image with low contrast, using
a method called histogram equalization. Observe that image (2)
has roughly linear cumulative distribution function.

Histogram equalisation was initially conceived to improve the contrast in a
single-channel grayscale image. The method transforms the
distribution of the intensities in an image so that they are as uniform as
possible [1]. The natural justification for uniformity
is that the image has better contrast if the intensity levels of an image span
a wide range on the intensity scale. As it turns out, the necessary
transformation is a mapping based on the cumulative histogram.

```julia
using Images, ImageView, Colors, TestImages, Gtk.ShortNames

img = testimage("moonsurface")
imgeq = histeq(img, 256)
imgadap = clahe(img, 256)

grid, frames, canvases = canvasgrid((1, 3))

imshow(canvases[1,1], img)
imshow(canvases[1,2], imgeq)
imshow(canvases[1,3], imgadap)

win = Window(grid)
Gtk.showall(win)
```
Here's the result in IJulia:

![moonsurface](../assets/demos/histogram_equalization.png)