opencv - Adding noise to image with specific signal to noise ratio (Python) -
i want add noise image specific snr. easiest way in python? use below code add noise can't control snr:
matrix_noise = 255 * np.random.randint(0, 2, (image.shape[0], image.shape[1])) matrix_noise = matrix_noise.astype('uint8') image = cv2.add(blur, matrix_noise)
one way reducing noise power below code:
matrix_noise = 255 * np.random.randint(0, 2, (image.shape[0], image.shape[1])) in range(0, 4): temp_noise = 255 * np.random.randint(0, 2, (image.shape[0], image.shape[1])) matrix_noise = cv2.bitwise_and(temp_noise, matrix_noise) matrix_noise = matrix_noise.astype('uint8')
but code can't control power of noise , not efficient.
Comments
Post a Comment