Skip to content
Merged
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
22 changes: 22 additions & 0 deletions docs/examples/color_channels/rgb_grayscale.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ---
# title: RGB to GrayScale
# cover: assets/rgb_grayscale.png
# ---

# This example illustrates RGB to Grayscale Conversion


using ImageCore, TestImages

rgb_image = testimage("lighthouse")

# `I = Gray.(rgb_image)` converts an RGB image to Grayscale.

gray_image = Gray.(rgb_image)
mosaicview(rgb_image, gray_image; nrow = 1)

# Gray scale conversion form RGB follows a weighted sum of all channels, the coffecients are computed according to
# [Rec. ITU-R BT.601-7](https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.601-7-201103-I!!PDF-E.pdf) rounding off to 3 decimal places
# `0.299 * R + 0.587 * G + 0.114 * B`

save("assets/rgb_grayscale.png", gray_image) #src
31 changes: 31 additions & 0 deletions docs/examples/spatial_transformation/histogram_equalization.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# ---
# title: Histogram equalisation
# cover: assets/histogram_equalization.png
# ---

# This demo issustrates the use of [Histogram equalization](https://juliaimages.org/ImageContrastAdjustment.jl/stable/reference/#Equalization-1), [gamma correction matching](https://juliaimages.org/ImageContrastAdjustment.jl/stable/reference/#Matching-1)
# and [Contrast Limited Adaptive Histogram Equalization](https://juliaimages.org/ImageContrastAdjustment.jl/stable/reference/#AdaptiveEqualization-1)

# Histogram equalisation is used to imporve the contrast in an
# single-channel grayscale image. It distributes the intensity of the image
# in a uniform manner. 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. The transformation is based on mapping of
# cumulative histogram

using ImageContrastAdjustment, TestImages, ImageCore

img = testimage("moonsurface")

# Now we will apply Histogram equalisation, gamma correction and Adaptive histogram equalisation
# method to enhance contrast of the image

hist_equal = adjust_histogram(img, Equalization(nbins = 256))
gamma_correction = adjust_histogram(img, GammaCorrection(gamma = 2))
hist_adapt = adjust_histogram(img, AdaptiveEqualization(nbins = 256, rblocks = 4, cblocks = 4, clip = 0.2))

mosaicview(img, hist_equal, gamma_correction, hist_adapt; nrow = 1)

# --- save covers --- #src
using FileIO #src
save("assets/histogram_equalization.png", hist_equal) #src