Advertisement
Guest User

Untitled

a guest
May 24th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.13 KB | None | 0 0
  1. def right_graph(axes, objectsY, objectsDist, path_save, where_save, path_for_graph, color_red, color_green):
  2.     fig, ax = plt.subplots(axes, 1)
  3.     fig.subplots_adjust(top = 0.9, wspace = 0, hspace = 0.6)
  4.     j = 0
  5.     if axes > 1:        
  6.         for i in ax:  
  7.             #gc.collect()
  8.             i.set_xlim(0, 1)
  9.             i.set_ylim(0, 400)
  10.             i.tick_params(axis = 'both', which = 'major', labelsize = 7)
  11.             for k in range(len(objectsDist[j])):
  12.                 if objectsDist[j][k] <= color_red:
  13.                     if objectsDist[j][k] <= color_green:
  14.                         i.scatter(1/(1 + math.log(objectsDist[j][k] + 1)), objectsY[j][k], marker = 'o', color = 'green', s = 30)
  15.             j += 1
  16.             i.set_title('Object #' + str(j))
  17.         ax[-1].set_ylabel("HeigHt", fontsize=10)
  18.         ax[-1].set_xlabel("Confidence", fontsize=10)
  19.        
  20.     else:          
  21.             ax.set_xlim(0, 1)
  22.             ax.set_ylim(0, 400)
  23.             ax.tick_params(axis = 'both', which = 'major', labelsize = 7)
  24.             ax.set_ylabel("HeigHt", fontsize=10)
  25.             ax.set_xlabel("Confidence", fontsize=10)
  26.             for i in range(len(objectsDist[j])):
  27.                 #gc.collect()    
  28.                 if objectsDist[j][i] <= color_red:
  29.                     if objectsDist[j][i] <= color_green:
  30.                         ax.scatter(1/(1 + math.log(objectsDist[j][i] + 1)), objectsY[j][i], marker = 'o', color = 'green', s = 30)
  31.             j += 1
  32.             ax.set_title('Object #' + str(j))
  33.            
  34.            
  35.     set_size(1500/(96*4), 2000/(96*4))
  36.    
  37.     plt.savefig(where_save  + path_for_graph + '/right/' + path_save + '.png', dpi = 200)
  38.     graphic_final = cv2.imread(where_save  + path_for_graph + '/right/' + path_save + '.png', cv2.IMREAD_COLOR)
  39.     img = cv2.imread(where_save  + path_for_graph + '/' + path_save + '.png', cv2.IMREAD_COLOR)
  40.     graphic_final = cv2.resize(graphic_final, (1920,1780), interpolation = cv2.INTER_AREA)
  41.     vis = np.concatenate((img, graphic_final), axis = 1)
  42.     cv2.imwrite(where_save  + path_for_graph + '/' + path_save + '.png', vis)
  43. plt.close(fig)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement