200 lines
8.3 KiB
Python
200 lines
8.3 KiB
Python
import os, sys
|
|
import seaborn
|
|
from pylab import rcParams
|
|
import cv2
|
|
|
|
import numpy as np
|
|
from numpy import linalg as LA
|
|
from time import time
|
|
from itertools import combinations
|
|
|
|
import matplotlib.pyplot as plt
|
|
from matplotlib.pyplot import *
|
|
import matplotlib.patches as mpatches
|
|
|
|
# activate latex text rendering
|
|
#rc('text', usetex=True)
|
|
|
|
def main(argv):
|
|
# path = str(argv[0])
|
|
# path ="/home/Julian/3D_Pupil_Project/work/results/2D2D/"
|
|
|
|
# Data1 = np.load(path + "p5_2d2d_all.npy")
|
|
# Data2 = np.load(path + "p7_2d2d_all.npy")
|
|
# Data3 = np.load(path + "p10_2d2d_all.npy")
|
|
# Data4 = np.load(path + "p11_2d2d_all.npy")
|
|
# Data5 = np.load(path + "p12_2d2d_all.npy")
|
|
# Data6 = np.load(path + "p13_2d2d_all.npy")
|
|
# Data7 = np.load(path + "p14_2d2d_all.npy")
|
|
# Data8 = np.load(path + "p15_2d2d_all.npy")
|
|
# Data9 = np.load(path + "p16_2d2d_all.npy")
|
|
# Data10 = np.load(path + "p20_2d2d_all.npy")
|
|
# Data11 = np.load(path + "p21_2d2d_all.npy")
|
|
# Data12 = np.load(path + "p24_2d2d_all.npy")
|
|
# Data13 = np.load(path + "p25_2d2d_all.npy")
|
|
D2D2 = np.load("MeansC1D2D2.npy")
|
|
D2D3 = np.load("MeansC1D2D3.npy")
|
|
|
|
|
|
mean02D2D = np.mean([D2D2[0][0],D2D2[1][1], D2D2[2][2], D2D2[3][3], D2D2[4][4]])
|
|
mean12D2D = np.mean([D2D2[0][1],D2D2[1][2], D2D2[2][3], D2D2[3][4]])
|
|
mean22D2D = np.mean([D2D2[0][2],D2D2[1][3], D2D2[2][4]])
|
|
mean32D2D = np.mean([D2D2[0][3],D2D2[1][4]])
|
|
mean42D2D = np.mean([D2D2[0][4]])
|
|
|
|
# mean2D2D = [mean02D2D,mean12D2D,mean22D2D,mean32D2D,mean42D2D]
|
|
|
|
minmean02D2D = np.mean([D2D2[1][0],D2D2[2][1], D2D2[3][2], D2D2[4][3]])
|
|
minmean12D2D = np.mean([D2D2[2][0],D2D2[3][1], D2D2[4][2]])
|
|
minmean22D2D = np.mean([D2D2[3][0],D2D2[4][1]])
|
|
minmean32D2D = np.mean([D2D2[4][0]])
|
|
|
|
# minmean2D2D = [minmean02D2D,minmean12D2D,minmean22D2D,minmean32D2D]
|
|
|
|
std02D2D = np.std([D2D2[0][0],D2D2[1][1], D2D2[2][2], D2D2[3][3], D2D2[4][4]])
|
|
std12D2D = np.std([D2D2[0][1],D2D2[1][2], D2D2[2][3], D2D2[3][4]])
|
|
std22D2D = np.std([D2D2[0][2],D2D2[1][3], D2D2[2][4]])
|
|
std32D2D = np.std([D2D2[0][3],D2D2[1][4]])
|
|
std42D2D = np.std([D2D2[0][4]])
|
|
|
|
# std2D2D = [std02D2D,std12D2D,std22D2D,std32D2D,std42D2D]
|
|
|
|
minstd02D2D = np.std([D2D2[1][0],D2D2[2][1], D2D2[3][2], D2D2[4][3]])
|
|
minstd12D2D = np.std([D2D2[2][0],D2D2[3][1], D2D2[4][2]])
|
|
minstd22D2D = np.std([D2D2[3][0],D2D2[4][1]])
|
|
minstd32D2D = np.std([D2D2[4][0]])
|
|
|
|
# minstd2D2D = [minstd02D2D,minstd12D2D,minstd22D2D,minstd32D2D]
|
|
|
|
mean2D2D = [minmean32D2D,minmean22D2D,minmean12D2D,minmean02D2D,mean02D2D,mean12D2D,mean22D2D,mean32D2D,mean42D2D]
|
|
std2D2D = [minstd32D2D,minstd22D2D,minstd12D2D,minstd02D2D,std02D2D,std12D2D,std22D2D,std32D2D,std42D2D]
|
|
|
|
mean02D3D = np.mean([D2D3[0][0],D2D3[1][1], D2D3[2][2], D2D3[3][3], D2D3[4][4]])
|
|
mean12D3D = np.mean([D2D3[0][1],D2D3[1][2], D2D3[2][3], D2D3[3][4]])
|
|
mean22D3D = np.mean([D2D3[0][2],D2D3[1][3], D2D3[2][4]])
|
|
mean32D3D = np.mean([D2D3[0][3],D2D3[1][4]])
|
|
mean42D3D = np.mean([D2D3[0][4]])
|
|
|
|
# mean2D3D = [mean02D3D,mean12D3D,mean22D3D,mean32D3D,mean42D3D]
|
|
|
|
std02D3D = np.std([D2D3[0][0],D2D3[1][1], D2D3[2][2], D2D3[3][3], D2D3[4][4]])
|
|
std12D3D = np.std([D2D3[0][1],D2D3[1][2], D2D3[2][3], D2D3[3][4]])
|
|
std22D3D = np.std([D2D3[0][2],D2D3[1][3], D2D3[2][4]])
|
|
std32D3D = np.std([D2D3[0][3],D2D3[1][4]])
|
|
std42D3D = np.std([D2D3[0][4]])
|
|
|
|
# std2D3D = [std02D3D,std12D3D,std22D3D,std32D3D,std42D3D]
|
|
|
|
minmean02D3D = np.mean([D2D3[1][0],D2D3[2][1], D2D3[3][2], D2D3[4][3]])
|
|
minmean12D3D = np.mean([D2D3[2][0],D2D3[3][1], D2D3[4][2]])
|
|
minmean22D3D = np.mean([D2D3[3][0],D2D3[4][1]])
|
|
minmean32D3D = np.mean([D2D3[4][0]])
|
|
|
|
# minmean2D3D = [minmean02D3D,minmean12D3D,minmean22D3D,minmean32D3D]
|
|
|
|
minstd02D3D = np.std([D2D3[1][0],D2D3[2][1], D2D3[3][2], D2D3[4][3]])
|
|
minstd12D3D = np.std([D2D3[2][0],D2D3[3][1], D2D3[4][2]])
|
|
minstd22D3D = np.std([D2D3[3][0],D2D3[4][1]])
|
|
minstd32D3D = np.std([D2D3[4][0]])
|
|
|
|
# minstd2D3D = [minstd02D3D,minstd12D3D,minstd22D3D,minstd32D3D]
|
|
|
|
mean2D3D = [minmean32D3D,minmean22D3D,minmean12D3D,minmean02D3D,mean02D3D,mean12D3D,mean22D3D,mean32D3D,mean42D3D]
|
|
std2D3D = [minstd32D3D,minstd22D3D,minstd12D3D,minstd02D3D,std02D3D,std12D3D,std22D3D,std32D3D,std42D3D]
|
|
|
|
N = 5
|
|
ind = np.asarray([0.25,1.25,2.25,3.25,4.25])
|
|
|
|
width = 0.5 # the width of the bars
|
|
|
|
# x1 = [0.4,1.4,2.4,3.4,4.4]
|
|
x2 = [-3.55,-2.55,-1.55,-0.55,0.45,1.45,2.45,3.45,4.45]
|
|
# x3 = [0.5,1.5,2.5,3.5,4.5]
|
|
x4 = [-3.45,-2.45,-1.45,-0.45,0.55,1.55,2.55,3.55,4.55]
|
|
# x5 = [0.6,1.6,2.6,3.6,4.6]
|
|
|
|
fig = plt.figure(figsize=(14.0, 10.0))
|
|
|
|
|
|
|
|
ax = fig.add_subplot(111)
|
|
|
|
# print mean2D2D
|
|
# print mean2D3D
|
|
|
|
# ax.axhline(linewidth=2, y = np.mean(mean2D2D),color='r')
|
|
# ax.axhline(linewidth=2, y = np.mean(mean2D3D),color='blue')
|
|
|
|
|
|
# ax.axhline(linewidth=2, y = minvaluevalue,color='black')
|
|
|
|
# ax.text(0.98, Participantmeanvalue+0.5, "Mean %.2f" % Participantmeanvalue,fontsize=12, fontweight='bold',color='r')
|
|
# ax.text(0.98, maxvaluevalue+0.5, "Maximum %.2f" % maxvaluevalue,fontsize=12, fontweight='bold',color='black')
|
|
# ax.text(0.98, minvaluevalue+0.5, "Minimum %.2f" % minvaluevalue,fontsize=12, fontweight='bold', color='black')
|
|
|
|
# rects1 = ax.bar(ind, Participantmean,width, color='r',edgecolor='black',)#, hatch='//')
|
|
rects1 = ax.errorbar(x2, mean2D2D,yerr=[std2D2D,std2D2D],fmt='o',color='red',ecolor='red',lw=3, capsize=5, capthick=2)
|
|
plt.plot(x2, mean2D2D, marker="o", linestyle='-',lw=3,color='red',label = r'2D-to-2D')
|
|
|
|
rects2 =ax.errorbar(x4, mean2D3D,yerr=[std2D3D,std2D3D],fmt='o',color='blue',ecolor='blue',lw=3, capsize=5, capthick=2)
|
|
plt.plot(x4, mean2D3D, marker="o", linestyle='-',lw=3,color='blue', label = r'2D-to-3D')
|
|
|
|
legend(fontsize=20,loc='upper right')
|
|
|
|
# rects3 = ax.errorbar(x3, meanC3,yerr=[stdC3,stdC3],fmt='o',color='black',ecolor='black',lw=3, capsize=5, capthick=2)
|
|
# plt.plot(x3, meanC3, marker="o", linestyle='-',lw=3,color='black')
|
|
#
|
|
# rects4 =ax.errorbar(x4, meanC4,yerr=[stdC4,stdC4],fmt='o',color='green',ecolor='green',lw=3, capsize=5, capthick=2)
|
|
# plt.plot(x4, meanC4, marker="o", linestyle='-',lw=3,color='green')
|
|
#
|
|
# rects5 =ax.errorbar(x5, meanC5,yerr=[stdC5,stdC5],fmt='o',color='orange',ecolor='orange',lw=3, capsize=5, capthick=2)
|
|
# plt.plot(x5, meanC5, marker="o", linestyle='-',lw=3,color='orange')
|
|
|
|
|
|
ax.set_ylabel(r'Angular Error',fontsize=22)
|
|
ax.set_xlabel(r'Distance Difference',fontsize=22)
|
|
ax.set_xticks(ind+0.25)
|
|
ax.set_xticklabels( ('D1', 'D2', 'D3','D4', 'D5') ,fontsize=18)
|
|
|
|
TOPICs = [-3.5,-2.5,-1.5,-0.5,0.5,1.5,2.5,3.5,4.5]#,110]#,120]
|
|
print TOPICs
|
|
LABELs = [r'-1m',r'-0.75m', r'-0.5m', r'-0.25m', r'0m',r'0.25m', r'0.5m', r'0.75m', r'1.0m', ""]#, ""]#, ""]
|
|
|
|
# fig.canvas.set_window_title('Distance Error Correlation')
|
|
plt.xticks(TOPICs, LABELs,fontsize=18)
|
|
|
|
# legend([rects1,rects2], [r'\LARGE\textbf{2D2D}', r'\LARGE\textbf{2D3D}'], loc='lower right')
|
|
|
|
TOPICS = [0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5]#,110]#,120]
|
|
print TOPICS
|
|
LABELS = [r'0.5',r'1', r'1.5', r'2', r'2.5', r'3', r'3.5', r'4', r'4.5', r'5', r'5.5', r'6', r'6.5', r'7', r'7.5', r'8', r'8.5']#, ""]#, ""]
|
|
|
|
# fig.canvas.set_window_title('Accuracy - Activity Statistics')
|
|
plt.yticks(TOPICS, LABELS,fontsize=18)
|
|
|
|
def autolabel(rects):
|
|
# attach some text labels
|
|
for rect in rects:
|
|
height = rect.get_height()
|
|
ax.text(0.26+rect.get_x()+rect.get_width()/2., height +0.35, "%.2f"%float(height),
|
|
ha='center', va='bottom',fontweight='bold',fontsize=13.5)
|
|
|
|
# autolabel(rects1)
|
|
|
|
|
|
left = 0.1 # the left side of the subplots of the figure
|
|
right = 0.975 # the right side of the subplots of the figure
|
|
bottom = 0.075 # the bottom of the subplots of the figure
|
|
top = 0.925 # the top of the subplots of the figure
|
|
wspace = 0.2 # the amount of width reserved for blank space between subplots
|
|
hspace = 0.4 # the amount of height reserved for white space between subplots
|
|
|
|
plt.subplots_adjust(left=left, bottom=bottom, right=right, top=top, wspace=wspace, hspace=hspace)
|
|
plt.show()
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main(sys.argv[1:])
|
|
|