Can you spot the difference? Image Differencing using Python

Image from Reader’s Digest
from skimage.color import rgb2gray
from skimage.io import imread, imshow
import matplotlib.pyplot as plt
import numpy as np
image = imread('spotdiff.jpg')
image1 = image[:,:500,:]
image2 = image[:,500:,:]
image1_gray = rgb2gray(image1)
image2_gray = rgb2gray(image2)
image3 = imread('diff.jpg')
image3 = image3[:,500:,:]
diff = image1_gray - image2_grayfig, ax = plt.subplots(1,4, figsize = (15,5))
ax[0].imshow(image1_gray, cmap="gray")
ax[0].set_title("First Image in Grayscale")
ax[1].imshow(image2_gray, cmap="gray")
ax[1].set_title("Second image in Grayscale")
ax[2].imshow(diff, cmap = "hsv")
ax[2].set_title("Difference in Grayscale Values")
ax[3].imshow(image3)
ax[3].set_title("Differences")
plt.tight_layout(0.1)
Image Difference from Author
Image from Author
Image Difference from Author

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Predicting donation likelihood for a charity organisation

‘Ideal’ day as a Data Scientist

Data Preprocessing : COVID-19 Dataset Practical Implementation

Democratic republic of Data Science : Building enterprise wide data science platform

Saver journeys: momentum, deep engagement & dynamic segments

Trading Strategy: Back testing with Backtrader

A 2021 NLP Retrospective

Data Quality Is Paramount

Data quality underpins everything we do.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kdtabong

Kdtabong

More from Medium

How to apply filters to images with Python

Steps to Publish Your Own Python Package to The Python Package Index (PyPI)

Cartoonize an Image using OpenCV

Python Face Recognition

Face Detection using python