def side_binarization(image, mean_image, configuration): """ Binarization of side image based on mean shift difference :param image: BGR image :param mean_image: Mean image :param configuration: Object BinarizeConfiguration :return: Binary image """ roi_main = configuration.roi_main mask = cv2.add(roi_main.mask, configuration.roi_orange_band.mask) mask = cv2.add(mask, configuration.roi_panel.mask) result = b_algorithm.mixed_binarization( image, mean_image, configuration.roi_main.hsv_min, configuration.roi_main.hsv_max, configuration.meanshift_binarization_factor.threshold, configuration.meanshift_binarization_factor.dark_background, mask, configuration.roi_main.mask) mask_clean_noise = cv2.add(configuration.roi_orange_band.mask, configuration.roi_panel.mask) result = b_processing.clean_noise(result, mask_clean_noise) return result
def side_binarization_elcom(image, mean_image, configuration): """ Binarization of side image based on mean shift difference :param image: BGR image :param mean_image: Mean image :param configuration: Object BinarizeConfiguration :return: Binary image """ result = b_algorithm.mixed_binarization( image, mean_image, configuration.roi_stem.hsv_min, configuration.roi_stem.hsv_max, configuration.meanshift_binarization_factor.threshold, configuration.meanshift_binarization_factor.dark_background, configuration.roi_main.mask, configuration.roi_stem.mask) result = cv2.medianBlur(result, 3) return result