This paper discusses the shadow part extraction of image , reference 【 Blogger 】 thought , Process images ：
Image processing is better lighting conditions , So the brightness of the shadow will be significantly lower than that of other areas ; in addition , Because of the decrease in brightness , The color is lighter , therefore R、G、B The variance of the three channel values must be small . By adjusting the threshold , The extraction effect is better .
I'm just showing the algorithm here , There was no morphological treatment ,ROI Screening and coloring .
The shadow can be further removed by extracting the shadow .
import cv2 import numpy as np import matplotlib.pyplot as plt img = cv2.imread('yinying2.png') img_sum = np.sum(img,axis=2) std_img = np.std(img) std_img = np.where(img_sum<250,std_img,255) cv2.imwrite("std_img.png",std_img.astype(np.uint8)) plt.imshow(std_img)
The effect is not good
For other algorithms, see ： Conference articles