Professional Documents
Culture Documents
Lab2 Image Enhancement
Lab2 Image Enhancement
0.1 Topics
1. Adding one image with another to increase brightness
2. Subtracting an image from another to decrease brightness
3. Multiplying an image with a mask to increase or decrease the contrast of an image
[4]: plt.imshow(ms01)
1
[5]: ms01.shape
[6]: m1 = np.ones(ms01.shape,dtype='uint8')*50
m1.shape
2
[9]: m2 = np.ones(ms01.shape)*0.5
ms01_lc = np.uint8(cv2.multiply(np.float64(ms01),m2)) # Low contrast
[10]: plt.imshow(ms01_lc)
3
[11]: m3 = np.ones(ms01.shape)*1.08
ms01_hc = np.uint8(np.clip(cv2.multiply(np.float64(ms01),m3), 0, 255)) # High␣
↪contrast
[12]: plt.imshow(ms01_hc)
4
[ ]: