TypeError: Image data of dtype object cannot be converted to float

asked 2020-03-16 07:40:55 -0600

updated 2020-03-16 09:09:48 -0600

LBerger gravatar image

TypeError: Image data of dtype object cannot be converted to float

 # initialize the figure
fig = plt.figure("Images")
images = ("Original", original), ("Contrast", contrast), ("Photoshopped", shopped)
# loop over the images
for (i, (name, image)) in enumerate(images):
# show the image
    ax = fig.add_subplot(1, 3, i + 1)
    ax.set_title(name)
    plt.imshow(image, cmap = plt.cm.gray)
    plt.show()
    plt.axis("off")
# show the figure
# compare the images
compare_images(original, original, "Original vs. Original")
compare_images(original, contrast, "Original vs. Contrast")
compare_images(original, shopped, "Original vs. Photoshopped")
edit retag flag offensive close merge delete

Comments

1

Where is imread? Do you use opencv function?

LBerger gravatar imageLBerger ( 2020-03-16 09:10:21 -0600 )edit
1

i cannot see anything opencv related here

berak gravatar imageberak ( 2020-03-16 09:12:21 -0600 )edit

Where is line number to get an error?

supra56 gravatar imagesupra56 ( 2020-03-16 09:44:15 -0600 )edit