我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用cv2.fastNlMeansDenoisingColored()。
def skin_detect(self, raw_yrb, img_src): # use median blurring to remove signal noise in YCRCB domain raw_yrb = cv2.medianBlur(raw_yrb, 5) mask_skin = cv2.inRange(raw_yrb, self.mask_lower_yrb, self.mask_upper_yrb) # morphological transform to remove unwanted part kernel = np.ones((5, 5), np.uint8) #mask_skin = cv2.morphologyEx(mask_skin, cv2.MORPH_OPEN, kernel) mask_skin = cv2.dilate(mask_skin, kernel, iterations=2) res_skin = cv2.bitwise_and(img_src, img_src, mask=mask_skin) #res_skin_dn = cv2.fastNlMeansDenoisingColored(res_skin, None, 10, 10, 7,21) return res_skin # Do background subtraction with some filtering
def denoise_image(image, value): if (value < 0): value = 0 elif (value > 100): value = 100 return cv2.fastNlMeansDenoisingColored(image, None, value, value)
def non_local_means_color_py(imgs, search_window, block_size, photo_render): import cv2 ret_imgs = opencv_wrapper(imgs, cv2.fastNlMeansDenoisingColored, [None,photo_render,photo_render,block_size,search_window]) return ret_imgs