LaneDetection_End2End icon indicating copy to clipboard operation
LaneDetection_End2End copied to clipboard

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

Open calvin-valtz opened this issue 3 years ago • 2 comments

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

calvin-valtz avatar Dec 07 '20 08:12 calvin-valtz

move

mask = torch.prod(gt_params != 0, 1).byte()

to

 mask = torch.prod(gt_params != 0, 1).bool()

gucasbrg avatar Jan 16 '21 02:01 gucasbrg

The above solution didn't work, did you ever solve this problem? I'm having the same issue.

ayushupneja avatar Mar 04 '21 02:03 ayushupneja