ErenBalatkan / DepthVisualizer-Examples

Constains Various examples for Depth Visualizer
MIT License
3 stars 2 forks source link

no result after running the code #1

Closed sunhufly closed 3 years ago

sunhufly commented 3 years ago

Hi, thanks for your code, there is no error in the code,but no results are displayed in the end. There is only one window named "depth visualizer", and there is no diaplay content. Can you tell me how to solve it?

ErenBalatkan commented 3 years ago

Can you share with me your calls to DepthVisualizer API?

sunhufly commented 3 years ago
from DepthVisualizer import DepthRenderer, Utils
import cv2
import numpy as np
from matplotlib import pyplot as plt

renderer = DepthRenderer(1200, 800, camera_fov=100)
renderer.set_camera_coords(0, 0, 0)  # Camera originally starts at [0, 10, -10]
renderer.change_camera_rotation(0, 10)  # Camera originally has pitch of -10

rgb_image = cv2.cvtColor(cv2.imread("image.png"), cv2.COLOR_BGR2RGB)
sample_depth_map = np.ones((rgb_image.shape[0], rgb_image.shape[1], 1))  # A depth map where depth of every pixel is 1

kitti_calib = Utils.read_kitti_calibration("calib.txt")
focal_length = kitti_calib["focal_length"]
principal_point = kitti_calib["principal_point"]

points = Utils.convert_depthmap_to_points(sample_depth_map, focal_length, principal_point, rgb_image)
renderer.set_points(points)
renderer.render()

frame = renderer.get_rendered_frame()
plt.imshow(frame)

renderer.set_camera_coords(0, 1.5, -1)  
renderer.change_camera_rotation(0, -25)  

renderer.add_axis_lines()
renderer.render()

frame = renderer.get_rendered_frame()
plt.imshow(frame)

predicted_depth_map = Utils.read_depth_map("predicted_depth.png")  

points = Utils.convert_depthmap_to_points(predicted_depth_map, focal_length, principal_point, rgb_image)
renderer.set_points(points)
renderer.render()

frame = renderer.get_rendered_frame()
plt.imshow(frame)

renderer.show_window()
renderer.render_loop() 
renderer.hide_window() 

renderer.close()

2021-05-26 21-44-04屏幕截图

ErenBalatkan commented 3 years ago

Something seems to be broken, I will check whats going on after work and hopefully fix the issue soon.

ErenBalatkan commented 3 years ago

Fixed the issue with latest update