OpenCV Image Subtraction: Python Example
This code reads two images, 'angiography_live_image.tif' and 'angiography_mask_image.tif', using the cv2.imread function.
The code then performs subtraction on the two images using the cv2.subtract function. Alternatively, it can also subtract the pixel values directly by converting the images to int32 data type and subtracting them.
The resulting image is then normalized using the cv2.normalize function to a range of 0-255, and converted back to the uint8 data type.
Finally, the original and result images are displayed using the cv2.imshow function, and the program waits for a key press to close the windows.
原文地址: https://www.cveoy.top/t/topic/pajQ 著作权归作者所有。请勿转载和采集!