-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplot.py
More file actions
30 lines (21 loc) · 672 Bytes
/
plot.py
File metadata and controls
30 lines (21 loc) · 672 Bytes
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
import cv2
# from matplotlib import pyplot as plt
import numpy as np
import pprint
colors = []
def plotColorBar(colorInformation):
colors = []
#Create a 500x100 black image
color_bar = np.zeros((100,500,3), dtype="uint8")
top_x = 0
for x in colorInformation:
bottom_x = top_x + (x["color_percentage"] * color_bar.shape[1])
color = tuple(map(int,(x['color'])))
colors.append(list(color))
cv2.rectangle(color_bar , (int(top_x),0) , (int(bottom_x),color_bar.shape[0]) ,color , -1)
top_x = bottom_x
return color_bar
def prety_print_data(color_info):
for x in color_info:
text = str(pprint.pformat(x))
return text