| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- import os
- import sys
- import time
- import pandas as pd
- import json
- import numpy as np
- import math
- import matplotlib.pyplot as plt
- #import sklearn.datasets as data
- #import hdbscan ##NOTE: hdbscan needs Cython. please install Cython before use.
- import seaborn as sns
- import pandas as pd
-
-
-
-
- def draw_plot_cam_1(dataframe, path):
- df = dataframe
- imgpath = path
- sns.set_context('poster')
- sns.set_style('white')
- sns.set_color_codes()
- plot_kwds = {'alpha': 0.5, 'linewidths':0 }
- plt.rcParams['figure.figsize'] = 9, 7
-
- fig = plt.figure()
- ax = fig.add_subplot(projection = '3d')
- ax.scatter(df['x'],df['y'],df['z'], color='g', s=0.3, **plot_kwds)
- plt.savefig(path, dpi=660)
- plt.clf()
-
- def draw_plot_cam_2(dataframe, path):
- df = dataframe
- sns.set_context('poster')
- sns.set_style('white')
- sns.set_color_codes()
- plot_kwds = {'alpha': 0.5, 'linewidths':0 }
- plt.rcParams['figure.figsize'] = 9, 7
-
- fig = plt.figure()
- ax = fig.add_subplot(projection = '3d')
- ax.scatter(df['x'],df['y'],df['z'], color='r', s=0.3, **plot_kwds)
- plt.savefig(path, dpi=660)
- plt.clf()
-
- def draw_xy(dataframe,path):
- df = dataframe
- path_list=path.split('/')
- plt.rcParams['figure.figsize'] = 9, 7
- fig=plt.figure()
- plt.scatter(df['x'], df['y'], s=0.2)
- plt.title(path_list[-1])
- plt.savefig(path, dpi=600)
- plt.clf()
-
-
- def draw_yz(dataframe, path):
- df = dataframe
- path_list=path.split('/')
- plt.rcParams['figure.figsize'] = 9, 7
- fig=plt.figure()
- plt.scatter(df['y'], df['z'], s=0.2)
- plt.title(path_list[-1])
- plt.savefig(path, dpi=600)
- plt.clf()
-
- def draw_xz(dataframe, path):
- df = dataframe
- path_list=path.split('/')
- plt.rcParams['figure.figsize'] = 9, 7
- fig=plt.figure()
- plt.scatter(df['z'], df['x'], s=0.2)
- plt.title(path_list[-1])
- plt.savefig(path, dpi=600)
- plt.clf()
-
- def draw_plot_total(dataframe, path):
- df = dataframe
- sns.set_context('poster')
- sns.set_style('white')
- sns.set_color_codes()
- plot_kwds = {'alpha': 0.5, 'linewidths':0 }
- plt.rcParams['figure.figsize'] = 9, 7
-
- fig = plt.figure()
- ax = fig.add_subplot(projection = '3d')
- ax.axes.set_xlim3d(left=-1.8, right=1.8)
- ax.axes.set_ylim3d(bottom=-1.8, top=1.8)
- ax.axes.set_zlim3d(bottom=0, top=1.8)
- ax.set_xlabel('x (left_right)')
- ax.set_ylabel('y (head_tail)')
- ax.set_zlabel('z (floor_ceiling)')
-
- cam_1 = df[df['cam'] == 1]
- cam_2 = df[df['cam'] == 2]
- ax.scatter(cam_1['x'],cam_1['y'],cam_1['z'], color='g', s=0.3, **plot_kwds)
- ax.scatter(cam_2['x'],cam_2['y'],cam_2['z'], color='r', s=0.3, **plot_kwds)
-
- plt.savefig(path, dpi=660)
- plt.clf()
-
- def draw_diff_diff(dataframe, path):
- data = dataframe
- plt.rcParams['figure.figsize'] =30, 7
- #plt.axes().set_aspect('equal')
- plt.xlim(data['frame'].min()-10, data['frame'].max()+10)
- #l = range(0, len(data['diff_diff']))
- #plt.xticks(l*10, data['diff_diff'])
- plt.ylim(data['diff_diff'].min(), data['diff_diff'].max())
- fig = plt.figure()
- plt.plot(data['frame'], data['diff_diff'], color='g')
- #plt.gca().set_aspect('auto')
- plt.savefig('./diff.png', dpi=600)
- plt.clf()
|