Image Processing
Digital Assignment – 1
Image Enhancement
Submitted by
Name – Shaikat Das Joy
Reg No – 17BCI0198
Slot – C1 +TC1
Submitted to
Prof. Anisha M Lal
Image Enhancement
Brain Tumor MRI Enhancement using Clache Contrast Enhancement
Input Image:
Implementation Code: (Written in python)
import cv2
import numpy as np
from matplotlib import pyplot as plt
import clache_equalize as c
import math
img0 = cv2.imread('C:/Users/ASUS/Desktop/image/brain.jpg',)
gray = cv2.cvtColor(img0, cv2.COLOR_BGR2GRAY)
img = cv2.GaussianBlur(gray, (3, 3), 0)
laplacian = cv2.Laplacian(img, cv2.CV_64F)
sharpen = img-laplacian
sobelx = cv2.Sobel(img, cv2.CV_64F, 1, 0, ksize=5) # x
sobely = cv2.Sobel(img, cv2.CV_64F, 0, 1, ksize=5) # y
sobel = sobelx+sobely
final = sharpen*sobel
kernel = np.ones((5, 5), np.float32)/25
avg = cv2.filter2D(sobel, -1, kernel)
prod = avg*sharpen
sum = img+prod
clache = c.equalize_light(img, 3, (7, 7), False,)
plt.subplot(4, 2, 1), plt.imshow(img, cmap='gray')
plt.title('Original'), plt.xticks([]), plt.yticks([])
plt.subplot(4, 2, 2), plt.imshow(laplacian, cmap='gray')
plt.title('Laplacian'), plt.xticks([]), plt.yticks([])
plt.subplot(4, 2, 3), plt.imshow(sharpen, cmap='gray')
plt.title('Sharpen'), plt.xticks([]), plt.yticks([])
plt.subplot(4, 2, 4), plt.imshow(sobelx, cmap='gray')
plt.title('Sobel X'), plt.xticks([]), plt.yticks([])
plt.subplot(4, 2, 5), plt.imshow(sobely, cmap='gray')
plt.title('Sobel Y'), plt.xticks([]), plt.yticks([])
plt.subplot(4, 2, 6), plt.imshow(final, cmap='gray')
plt.title('Sobel'), plt.xticks([]), plt.yticks([])
plt.subplot(4, 2, 7), plt.imshow(avg, cmap='gray')
plt.title('Smooth'), plt.xticks([]), plt.yticks([])
plt.subplot(4, 2, 8), plt.imshow(clache, cmap='gray')
plt.title('Clache'), plt.xticks([]), plt.yticks([])
cv2.imwrite('images/laplacian.jpg', laplacian)
cv2.imwrite('images/sharpen.jpg', sharpen)
cv2.imwrite('images/sobel.jpg', sobel)
cv2.imwrite('images/averaging.jpg', avg)
cv2.imwrite('images/clache.jpg', clache)
plt.show()
Following Steps of Output result :
Screenshots:
Output Image:
Comparison between input and output image
Input Image Output Image
Reference:
Kaur, Hardeep, and Jyoti Rani. "MRI brain image enhancement using Histogram equalization
Techniques." 2016 International Conference on Wireless Communications, Signal Processing and
Networking (WiSPNET). IEEE, 2016.
Thank You