I have a heat map plotted using the pressure values, I am trying to convert that into a 3D heatmap using pyqtgraph in order to use this data for pose estimation. This is the current code for a 2D Graph.
# input parameters which depend on the mattress size
length = 7
width = 4
fsr_list = []
# Opening JSON file
f = open('Session_16-09-21-01-49-27_modified.json')
# returns JSON object as a dictionary
data = json.load(f)
for j in range(1,length*width + 1):
l_node = []
for i in range(len(data)):
if data[i]['num'] == j:
l = []
for fsr_value in data[i]['fsr']:
l.append(fsr_value)
node = np.array(l)
node = node.reshape((6,6))
l_node.append(node)
fsr_list.append(l_node)
# print(len(fsr_list))
# print(min_length)
min_length = len(min(fsr_list, key = len))
# condition to check if all the node data is present in the JSON file
if min_length == 0:
print('Data of all the nodes is not uploaded in the JSON file. Cannot generate the heatmap of entire mattress')
else:
gs = gridspec.GridSpec(length, width, wspace=0.05, hspace=0.025, top=0.95, bottom=0.05, left=0.17, right=0.5)
for i in range(length):
for j in range(width):
ax= plt.subplot(gs[i,j])
# im = ax.imshow(fsr_list[i*4 + j][0] ,cmap=blue_red1, interpolation = "none",vmin = 140, vmax = 200)
ax = sns.heatmap(fsr_list[i*width + j][0], linewidths=1, vmin = 140, vmax=180, cmap='jet', cbar=False)
ax.axis('off')
#plt.tight_layout() # do not use this!!
plt.show()

