Skip to content

How to solve TypeError: Expected Ptr<cv::UMat> for argument 'img'? #86

@calvin-valtz

Description

@calvin-valtz

I get the following error
TypeError: Expected Ptr<cv::UMat> for argument 'img'
the error is in the utils.py file in line 193

186 def draw_homography_points(img, x, resize=256, color=(255,0,0)):
187 y_start1 = (0.3+x[2])(resize-1)
188 y_start = 0.3
(resize-1)
189 y_stop = resize-1
190 src = np.float32([[0.45*(2resize-1),y_start],[0.55(2resize-1), y_start],[0.1(2resize-1),y_stop],[0.9(2resize-1), y_stop]])
191 dst = np.float32([[(0.45+x[0])
(2resize-1), y_start1],[(0.55+x[1])(2resize-1), y_start1],[(0.45+x[0])(2resize-1), y_stop],[(0.55+x[1])(2resize-1),y_stop]])
192 dst_ideal = np.float32([[0.45
(2resize-1), y_start],[0.55(2resize-1), y_start],[0.45(2resize-1), y_stop],[0.55(2*resize-1),y_stop]])
193 [cv2.circle(np.assarray(img), tuple(idx), radius=5, thickness=-1, color=(255,0,0)) for idx in src]
194 [cv2.circle(np.assarray(img), tuple(idx), radius=5, thickness=-1, color=(0,255,0)) for idx in dst_ideal]
195 [cv2.circle(np.assarray(img), tuple(idx), radius=5, thickness=-1, color=(0,0,255)) for idx in dst]

196 return img

I try to browse someone with similar error with me in other forums but i still can't solve the error. I try to change cv2.circle(np.assarray(img) into cv2.circle(np.float32(img), and then to cv2.circle(np.asarray(img, dtype=np.float32)) but the problem still not solved.
Does anyone have an idea? Does it because the difference of system version?

I'm using Python 3, Tensorflow 2.4.0-rc3, PyTorch 1.7+cu11.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions