I read the image with ndimage and the image result as follows:
I want to SHOW THIS PICTURE
Black → White and White → Black
Thus, iteration with a watershed can destroy this black object.
Please help me. Thanks you
numpy.invert(close_img)
I use an inverted array. His work is for me. Thanks you
With scikit-image version (upcomming v0.13) you can use invert () . Example:
from skimage import util img = data.camera() inverted_img = util.invert(img)
, 1.0, 1 - close_image
1 - close_image
I like Pamungkas Jayuda anwer, but it only works if your data is integers. In my case, I just used a simple inverse with a small value in the denominator to avoid dividing by zero:
1 / (2e5 + img)
Here is another method using OpenCV
import cv2 image = cv2.imread('2.png') invert = cv2.bitwise_not(image) # OR # invert = 255 - image