-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Karina Tiemi
committed
Jul 5, 2020
1 parent
2a47a53
commit e6a3def
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import numpy as np | ||
from skimage.color import rgb2gray | ||
from skimage.exposure import match_histograms | ||
from skimage.metrics import structural_similarity | ||
|
||
def find_difference(image1, image2): | ||
assert image1.shape == image2.shape, "Specify 2 images with de same shape." | ||
gray_image1 = rgb2gray(image1) | ||
gray_image2 = rgb2gray(image2) | ||
(score, difference_image) = structural_similarity(gray_image1, gray_image2, full=True) | ||
print("Similarity of the images:", score) | ||
normalized_difference_image = (difference_image-np.min(difference_image))/(np.max(difference_image)-np.min(difference_image)) | ||
return normalized_difference_image | ||
|
||
def transfer_histogram(image1, image2): | ||
matched_image = match_histograms(image1, image2, multichannel=True) | ||
return matched_image |