Professional Documents
Culture Documents
1. CONTRAST STRETCHING
import cv2
import numpy as np
from google.colab.patches import cv2_imshow
img = cv2.imread('/content/jerry.jpg')
original = img.copy()
xp = [0, 64, 128, 192, 255]
fp = [0, 16, 128, 240, 255]
x = np.arange(256)
table = np.interp(x, xp, fp).astype('uint8')
img = cv2.LUT(img, table)
cv2_imshow(original)
cv2_imshow( img)
cv2.waitKey(0)
cv2.destroyAllWindows()
Original Image Stretched Image
4. MEDIAN BLUR
# Reading the image
image = cv2.imread('/content/minions.jpg')
plt.subplot(121)
plt.title("Original Image")
plt.imshow(image, cmap='gray')
plt.subplot(122)
plt.title("Processed Image")
plt.imshow(morph_gradient, cmap='gray')
plt.tight_layout()
plt.show()