October 2018
Intermediate to advanced
472 pages
10h 57m
English
First, let's define the make_normalize() function, which accepts an image and performs the histogram normalization operation on it. The return object is a normalized array:
def make_normalize(img): """Function to histogram normalize images.""" norm_img = np.zeros((img.shape[0], img.shape[1], 3),np.float32) b=img[:,:,0] g=img[:,:,1] r=img[:,:,2] norm_img[:,:,0]=cv2.equalizeHist(b) norm_img[:,:,1]=cv2.equalizeHist(g) norm_img[:,:,2]=cv2.equalizeHist(r) return norm_imgplt.figure(figsize = (14,5))plt.subplot(1,2,1)plt.imshow(img_lst[9])plt.title(' Original Image')plt.subplot(1,2,2)plt.imshow(make_normalize(img_lst[9]))plt.title(' Histogram Normalized Image')
Following should be the output:
Read now
Unlock full access