def remove_noise(image, kernel=(2, 2)): ''' removes noisy pixels in the area. ''' return cv.morphologyEx(image, cv.MORPH_OPEN, kernel)