Hamed Shah-Hosseini
  • Home
  • Data Science
    Data Science with Python Data Science with KNIME
  • Learning in AI
    Deep Learning Machine Learning Reinforcement Learning
  • Computer Vision
    Scikit-image OpenCV
  • Robotics
    Autonomous Mobile Robots Multi-robot Systems
  • Optimization
    Mathematical Optimization Swarm Intelligence and Metaheuristics
  • Information Hiding
    Data Hiding Watermarking
  • Computer Graphics
    OpenGL Blender Processing and p5.js
  • About
part 1: Hello world Part 2: Histograms Part 3: Histogram Matching and CDFs Part 4: Template Matching Part 5: Cross-Correlation and Convolution Part 6:

About loading and showing images

We import libraries such as:
from skimage import data
From data we can load some available images of scikit-image:
image=data.chelsea()
Or, we may load our own image from a file such as Penguins.jpg by:
from skimage import io as io
image=io.imread("penguins.jpg")

How to get histograms of images

First, we import the module color to convert an RGB color image into a gray-level image via:
from skimage import color
image_gray=color.rgb2gray(image)
Then, we may write our own function to compute the histogram into an array of size 256, as explained in the video.
Or, we may use one of built-in functions for computing histogram, such as hist of pyplot.

Compute Cumulative Distribution Functions (CDFs) from histograms and then do Histogram Matching

We may import histogram and cumulative from the module exposure:
from skimage.exposure import histogram, cumulative_distribution
We may change the gray-levels or colors of the content via CDFs of the style image. We may call the changed image as generated

Template Matching and its application

We are looking for parts of a given image, which are similar to a template
For this purpose, we may use match_template to find the matches.
Also, peak_local_max may be used after to locate the most similar parts to the template.
Both of the aforementioned functions are imported from skimage.feature as shown here:
from skimage.feature import match_template, peak_local_max

Using scipy modules to implement spatial filtering such as convolution and cross-correlation

We may import correlate and convolve from scipy.ndimage
from scipy.ndimage import correlate, convolve
Or, we may use some available filters in scikit-image such as prewitt and sobel
from skimage.filters import prewitt, sobel, roberts
6...