#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 10 23:57:10 2019 @author: K. Anthony E. (kanthonye) """ import cv2 import hw2lib as hw2 img = cv2.imread('q1-gamma-underexposed.jpg') gry = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) eqh = cv2.equalizeHist( gry ) hw2.ShowHisto( eqh ) cv2.imwrite('Q2-eql_hist-underexposed.jpg',eqh)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat May 11 01:00:18 2019 @author: kanthonye """ import numpy as np import hw2lib as hw2 import cv2 img = cv2.imread('q1-gamma-underexposed.jpg') hist = np.zeros([256], int) for n in range(256): hist[n] = n hw2.ShowHisto(hist) himg = hw2.HistMatch(img, hist) hw2.ShowHisto(himg) cv2.imwrite('q3-hist_match-overexposed.jpg', himg)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat May 4 15:50:45 2019 @author: K. Anthony E. (kanthonye) """ import cv2 import hw2lib as hw2 img = cv2.imread('q1-underexposed.jpg') gimg = hw2.GrayScale(img) cv2.imwrite('q1-gray-underexposed.jpg', gimg) hw2.ShowHisto(gimg) gimg = hw2.ApplyGamma(gimg, 2.2) cv2.imwrite('q1-gamma-underexposed.jpg', gimg) hw2.ShowHisto(gimg)