-
Notifications
You must be signed in to change notification settings - Fork 0
/
frame_convert2.py
46 lines (31 loc) · 1.08 KB
/
frame_convert2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import numpy as np
def pretty_depth(depth):
"""Converts depth into a 'nicer' format for display
This is abstracted to allow for experimentation with normalization
Args:
depth: A numpy array with 2 bytes per pixel
Returns:
A numpy array that has been processed with unspecified datatype
"""
np.clip(depth, 0, 2**10 - 1, depth)
depth >>= 2
depth = depth.astype(np.uint8)
return depth
def pretty_depth_cv(depth):
"""Converts depth into a 'nicer' format for display
This is abstracted to allow for experimentation with normalization
Args:
depth: A numpy array with 2 bytes per pixel
Returns:
A numpy array with unspecified datatype
"""
return pretty_depth(depth)
def video_cv(video):
"""Converts video into a BGR format for display
This is abstracted out to allow for experimentation
Args:
video: A numpy array with 1 byte per pixel, 3 channels RGB
Returns:
A numpy array with with 1 byte per pixel, 3 channels BGR
"""
return video[:, :, ::-1] # RGB -> BGR