1. Basic principles
Obtaining pixel values [0, L] reversed image of the image range, that is negative. Suitable for enhanced image in white or gray areas , especially when the black occupy the main position in the picture when
$$T(r) = L-r$$
2. Run results
FIG derived skimage
3. Code
1 import numpy as np 2 3 def image_reverse(input_image): 4 ''' 5 图像反转 6 :param input_image: 原图像 7 :return: 反转后的图像 8 ''' 9 input_image_cp = np.copy(input_image) # 输入图像的副本 10 11 pixels_value_max = np.max(input_image_cp) # 输入图像像素的最大值 12 13 output_imgae = pixels_value_max - input_image_cp # 输出图像 14 15 return output_imgae