-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.py
69 lines (52 loc) · 1.57 KB
/
utils.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
62
63
64
65
66
67
import pyrealsense2.pyrealsense2 as rs
import numpy as np
import cv2
from os import makedirs
from os.path import exists, join
import shutil
import json
import random
from itertools import count
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
matplotlib.use('TkAgg')
plt.style.use('fivethirtyeight')
x_vals = [] # [0, 1, 2, 3, 4, 5]
y_vals = [] # [0, 1, 3, 2, 3, 5]
index = count()
def animate(i):
x_vals.append(next(index))
y_vals.append(random.randint(0, 5))
plt.cla()
plt.plot(x_vals, y_vals)
ani = FuncAnimation(plt.gcf(), animate, interval=10)
plt.tight_layout()
plt.show()
# def make_clean_folder(path_folder):
# if not exists(path_folder):
# makedirs(path_folder)
# else:
# user_input = input("%s not empty. Overwrite? (y/n) : " % path_folder)
# if user_input.lower() == 'y':
# shutil.rmtree(path_folder)
# makedirs(path_folder)
# else:
# exit()
# def save_intrinsic_as_json(filename, frame):
# intrinsics = frame.profile.as_video_stream_profile().intrinsics
# with open(filename, 'w') as outfile:
# json.dump(
# {
# 'width':
# intrinsics.width,
# 'height':
# intrinsics.height,
# 'intrinsic_matrix': [
# intrinsics.fx, 0, 0, 0, intrinsics.fy, 0, intrinsics.ppx,
# intrinsics.ppy, 1
# ]
# },
# outfile,
# indent=4)