Home / Project Blogs / Histogram Matching
Goal
In our last meeting, Dr. Fuentes showed me the method of histogram matching for the 7pt Fiber Scale project. I may elaborate regarding its application in the project, but for now, I want to talk about an idea I had. Dr. Fuentes and Bibek are devising a method that would take a high res grayscale image and a low res color image and produce a high res color image (images below).
high res gray
low res color
high res color
My idea was to match the grayscale image histogram to the color image histogram channel by channel. So I wrote this:
import matplotlib.pyplot as plt
directory = 'Research/data/histogramMatching/'
bw_hr = plt.imread(directory+'bw_hr.jpg')
color_lr = plt.imread(directory+'color_lr.jpg')
import numpy as np
from skimage.exposure import match_histograms
histIm = np.zeros(bw_hr.shape)
histIm[:,:,0] = match_histograms(bw_hr[:,:,0], color_lr[:,:,0])
histIm[:,:,1] = match_histograms(bw_hr[:,:,1], color_lr[:,:,1])
histIm[:,:,2] = match_histograms(bw_hr[:,:,2], color_lr[:,:,2])
plt.imshow(histIm)
histogram matched image
Welp! It didn't work 🤷🏽♂️ see you next time.