Ask Your Question

Revision history [back]

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")

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

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)

shopped) # loop over the images

images for (i, (name, image)) in enumerate(images):

enumerate(images): # show the image

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

figure # compare the images

images compare_images(original, original, "Original vs. Original") compare_images(original, contrast, "Original vs. Contrast") compare_images(original, shopped, "Original vs. Photoshopped")

Photoshopped")