Error in warpperspective()
I am trying to use the homography transform function but am getting this error
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-21-9d9128efcecc> in <module>()
---> 33 im_dst = cv2.warpPerspective(im, h, (im.shape[1],im.shape[0]))
TypeError: M data type = 19 is not supported
Below is my code
import numpy as np
import cv2
import matplotlib.pyplot as plt
# read homography matrix
h = []
with open('/home/ast/datasets/ewap/seq_eth/H.txt', 'r') as f:
for line in f:
print(line.strip().split())
h.append(line.strip().split())
h = np.array(h)
# read image
im = cv2.imread('/home/haziq/datasets/ewap/seq_eth/seq_eth_1.jpg')
# transform
im_dst = cv2.warpPerspective(frame, h, (im.shape[1],im.shape[0]))
Here is the doc for the warpperspective()
function https://docs.opencv.org/3.0-beta/modu...
this is what i have for h. i printed its content and shape
[['2.8128700e-02' '2.0091900e-03' '-4.6693600e+00']
['8.0625700e-04' '2.5195500e-02' '-5.0608800e+00']
['3.4555400e-04' '9.2512200e-05' '4.6255300e-01']]
(3, 3)
please don't use 3 years old beta docs.
show, what you have in
h
please. (it expects a 3x3 matrix)i have edited to show what I have for h. its a numpy.ndarray
oops i think h is a string not float