How can I convert image data to float? Or is there something wrong with the code?

0

I'm testing a code and I had problems: I can not see the image. The message that appears is: TypeError: Image data can not be converted to float (image data can not be converted to float) I could not solve this, please help me

CODE:

from matplotlib import pyplot as plt
import numpy as np
import cv2

img1 = cv2.imread('teste8/inco.png',0)          # queryImage
img2 = cv2.imread('teste8/incoRec.png',0) # trainImage

# Initiate SIFT detector
orb = cv2.ORB_create()

# find the keypoints and descriptors with SIFT
kp1, des1 = orb.detectAndCompute(img1,None)
kp2, des2 = orb.detectAndCompute(img2,None)

# create BFMatcher object
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)

# Match descriptors.
matches = bf.match(des1,des2)

# Sort them in the order of their distance.
matches = sorted(matches, key = lambda x:x.distance)

# Draw first 10 matches.
img3 = cv2.drawMatches(img1,kp1,img2,kp2,matches,None, flags=2)

plt.imshow(img3),plt.show()
    
asked by anonymous 20.05.2018 / 18:18

0 answers