Hi,
I am trying to save the images after calculation local entropy.
I followed https://scikit-image.org/docs/stable/auto_examples/filters/plot_entropy.html
.
I used cv2.imwrite
. I saved black images. I tried with io.imsave. It is saving the image in low contrast.
Below is my code.
for root, dirs, file in os.walk(image_path, topdown = False):
for name in dirs:
dir = root + os.sep + name
path = os.path.basename(dir)
for filename in os.listdir(dir):
file = dir + os.sep + filename
image = io.imread(file, plugin = ‘matplotlib’)
im = (rgb2gray(image))
print(type(im))
ent_image = entropy(im, disk(10))
img = resize(ent_image, (299,299))
image_saved_path = saved_path + os.sep + path
if not os.path.exists(image_saved_path ):
os.makedirs(image_saved_path)
image_base = os.path.basename(file)
# io.imsave(image_saved_path + os.sep + image_base, img.astype(np.uint8))
# img /= 255.0
cv2.imwrite(image_saved_path + os.sep + image_base,img_as_ubyte(img))
Please help me out to solve the issue.