TRI-ML / vidar

Other
554 stars 65 forks source link

visualize the depth_pred #58

Open Tartisan opened 7 months ago

Tartisan commented 7 months ago

Sorry I'm new in this area, how to visualize the depth_pred from ZeroDepth or PackNet ?

ximader commented 1 month ago
cap = cv2.VideoCapture('video.mp4')

ret, frame = cap.read()

frame = cv2.resize(frame, (640, 384))

rgb = torch.tensor(frame).permute(2,0,1).unsqueeze(0)/255.

with torch.no_grad():
    depth_pred = zerodepth_model(rgb, intrinsics)

depthmap = depth_pred.permute(0,2,3,1).squeeze().detach().cpu().numpy()
depthmap = np.uint8(depthmap/np.max(depthmap) * 255)
depthmap = cv2.applyColorMap(depthmap, cv2.COLORMAP_JET)

out = np.hstack([frame, depthmap])

cv2.imshow("depthmap", out)