Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -111,7 +111,6 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits'):
|
|
111 |
#out = cv2.VideoWriter(output_path, fourcc, frame_rate, (output_width, frame_height))
|
112 |
count=0
|
113 |
depth_frames = []
|
114 |
-
gdepth_frames = []
|
115 |
orig_frames = []
|
116 |
while raw_video.isOpened():
|
117 |
ret, raw_frame = raw_video.read()
|
@@ -155,8 +154,6 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits'):
|
|
155 |
orig_frames.append(f"f{count}.jpg")
|
156 |
cv2.imwrite(f"f{count}_dmap.jpg", depth_color)
|
157 |
depth_frames.append(f"f{count}_dmap.jpg")
|
158 |
-
cv2.imwrite(f"f{count}_gmap.jpg", depth_gray)
|
159 |
-
gdepth_frames.append(f"f{count}_gmap.jpg")
|
160 |
count += 1
|
161 |
|
162 |
final_vid = create_video(depth_frames, frame_rate, "depth")
|
@@ -165,7 +162,7 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits'):
|
|
165 |
# out.release()
|
166 |
cv2.destroyAllWindows()
|
167 |
|
168 |
-
return final_vid, final_zip, orig_frames[0],
|
169 |
|
170 |
def depth_edges_mask(depth):
|
171 |
"""Returns a mask of edges in the depth map.
|
@@ -210,8 +207,11 @@ def pano_depth_to_world_points(depth):
|
|
210 |
|
211 |
return pts3d
|
212 |
|
|
|
|
|
|
|
213 |
def get_mesh(image, depth, keep_edges=False):
|
214 |
-
pts3d = pano_depth_to_world_points(depth)
|
215 |
print('radius from depth - ok')
|
216 |
|
217 |
# Create a trimesh mesh from the points
|
|
|
111 |
#out = cv2.VideoWriter(output_path, fourcc, frame_rate, (output_width, frame_height))
|
112 |
count=0
|
113 |
depth_frames = []
|
|
|
114 |
orig_frames = []
|
115 |
while raw_video.isOpened():
|
116 |
ret, raw_frame = raw_video.read()
|
|
|
154 |
orig_frames.append(f"f{count}.jpg")
|
155 |
cv2.imwrite(f"f{count}_dmap.jpg", depth_color)
|
156 |
depth_frames.append(f"f{count}_dmap.jpg")
|
|
|
|
|
157 |
count += 1
|
158 |
|
159 |
final_vid = create_video(depth_frames, frame_rate, "depth")
|
|
|
162 |
# out.release()
|
163 |
cv2.destroyAllWindows()
|
164 |
|
165 |
+
return final_vid, final_zip, orig_frames[0], depth_frames[0] #output_path
|
166 |
|
167 |
def depth_edges_mask(depth):
|
168 |
"""Returns a mask of edges in the depth map.
|
|
|
207 |
|
208 |
return pts3d
|
209 |
|
210 |
+
def rgb2gray(rgb):
|
211 |
+
return np.dot(rgb[...,:3], [0.33, 0.33, 0.33])
|
212 |
+
|
213 |
def get_mesh(image, depth, keep_edges=False):
|
214 |
+
pts3d = pano_depth_to_world_points(rgb2gray(depth))
|
215 |
print('radius from depth - ok')
|
216 |
|
217 |
# Create a trimesh mesh from the points
|