-
Notifications
You must be signed in to change notification settings - Fork 0
/
load_kinect_rgbd_images.py
61 lines (52 loc) · 1.47 KB
/
load_kinect_rgbd_images.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import pickle
import numpy as np
def load_images_from_pickle(file_pickle):
"""
A generator function that yields a list of images from the given pickle file
---------
Arguments
---------
file_pickle: str
full path to the pickle file with images
------
Yields
------
a generator for the images in the pickle file
"""
with open(file_pickle, "rb") as file_handler:
while True:
try:
yield pickle.load(file_handler)
except EOFError:
break
return
def get_color_images(file_pickle_color):
"""
Function to get a list of color images from the saved pickle file
---------
Arguments
---------
file_pickle_color: str
full path to the pickle file with color images
-------
Returns
-------
color_images: A list of color images loaded from the pickle file as numpy arrays
"""
color_images = list(load_images_from_pickle(file_pickle_color))
return color_images
def get_depth_images(file_pickle_depth):
"""
Function to get a list of depth images from the saved pickle file
---------
Arguments
---------
file_pickle_depth: str
full path to the pickle file with depth images
-------
Returns
-------
depth_images: A list of depth images loaded from the pickle file as numpy arrays
"""
depth_images = list(load_images_from_pickle(file_pickle_depth))
return depth_images