Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def part4():
- f, axarr = plt.subplots(2, 3)
- frostfogSrc = cv.imread("a2images/frostfog.png", 0)
- frostfogEH=cv.equalizeHist(frostfogSrc)
- axarr[0,0].set_title("equalizeHist")
- axarr[0, 0].imshow(frostfogEH,cmap='gray')
- histN, b, l = axarr[0,1].hist(frostfogEH.ravel(), histSize, histRange, True, label="normal",color='blue')
- histC = axarr[0, 2].hist(frostfogEH.ravel(), histSize, histRange, True, None, True, label="cumulative",color='green')
- axarr[0, 1].bar(b[:-1], histN * (1/max(histN)), np.diff(b),color='b')
- mn,mx,mmnl,mxl=cv.minMaxLoc(frostfogSrc)
- print(mn,mx,mmnl,mxl)
- x,y=frostfogSrc.shape
- frostfogCS=frostfogSrc.copy()
- for i in range(0,x):
- for j in range(0,y):
- frostfogCS[i,j]= ((frostfogCS[i,j]-mn)/(mx-mn))*255
- axarr[1, 0].set_title("constant stretching")
- axarr[1, 0].imshow(frostfogCS, cmap='gray')
- histN, b, l = axarr[1, 1].hist(frostfogCS.ravel(), histSize, histRange, True, label="normal", color='blue')
- histC = axarr[1, 2].hist(frostfogCS.ravel(), histSize, histRange, True, None, True, label="cumulative",
- color='green')
- axarr[1, 1].bar(b[:-1], histN * (1 / max(histN)), np.diff(b), color='b')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement