parameters: (self, image, filename)
docstring: Plots bounding boxes into the image.
  
  		Input:
  			image: np.array (cv2.imread read) image
  			filename: Path to the image
docstring_summary: Plots bounding boxes into the image.
docstring_tokens: Plots bounding boxes into the image .
function: def _plot_bboxes(self, image, filename):
  		"""
  		Plots bounding boxes into the image.
  
  		Input:
  			image: np.array (cv2.imread read) image
  			filename: Path to the image
  		"""
  		if filename not in self.iml_detections:
  			return
  
  		bbs = self.iml_detections[filename]
  
  		if self.pgps is not None:
  			# Plot 3D bounding boxes
  			if filename not in self.pgps.keys():
  				print('ERROR: Missing PGP for file "' + filename + '"!')
  				exit(2)
  
  			pgp = self.pgps[filename]
  
  			for bb in bbs:
  				if bb.confidence >= self.confidence:
  					# Get all 4 bounding box corners in 3D (FBL FBR RBR RBL FTL FTR RTR RTL)
  					X_3x8 = pgp.reconstruct_bb3d(bb)
  					# Project them back to image
  					x_2x8 = pgp.project_X_to_x(X_3x8)
  
  					color = hex2bgr(COLORS[self.detections_mapping[bb.label]])
  
  					# Plot front side
  					cv2.line(image, (ri(x_2x8[0,4]), ri(x_2x8[1,4])), (ri(x_2x8[0,5]), ri(x_2x8[1,5])), (0,255,0), 2)
  					cv2.line(image, (ri(x_2x8[0,5]), ri(x_2x8[1,5])), (ri(x_2x8[0,1]), ri(x_2x8[1,1])), (0,255,0), 2)
  					cv2.line(image, (ri(x_2x8[0,0]), ri(x_2x8[1,0])), (ri(x_2x8[0,1]), ri(x_2x8[1,1])), (0,255,0), 2)
  					cv2.line(image, (ri(x_2x8[0,0]), ri(x_2x8[1,0])), (ri(x_2x8[0,4]), ri(x_2x8[1,4])), (0,255,0), 2)
  					# Plot rear side
  					cv2.line(image, (ri(x_2x8[0,2]), ri(x_2x8[1,2])), (ri(x_2x8[0,3]), ri(x_2x8[1,3])), (0,0,255), 2)
  					cv2.line(image, (ri(x_2x8[0,7]), ri(x_2x8[1,7])), (ri(x_2x8[0,3]), ri(x_2x8[1,3])), (0,0,255), 2)
  					cv2.line(image, (ri(x_2x8[0,7]), ri(x_2x8[1,7])), (ri(x_2x8[0,6]), ri(x_2x8[1,6])), (0,0,255), 2)
  					cv2.line(image, (ri(x_2x8[0,6]), ri(x_2x8[1,6])), (ri(x_2x8[0,2]), ri(x_2x8[1,2])), (0,0,255), 2)
  					# Plot connections
  					cv2.line(image, (ri(x_2x8[0,4]), ri(x_2x8[1,4])), (ri(x_2x8[0,7]), ri(x_2x8[1,7])), color, 2)
  					cv2.line(image, (ri(x_2x8[0,5]), ri(x_2x8[1,5])), (ri(x_2x8[0,6]), ri(x_2x8[1,6])), color, 2)
  					cv2.line(image, (ri(x_2x8[0,1]), ri(x_2x8[1,1])), (ri(x_2x8[0,2]), ri(x_2x8[1,2])), color, 2)
  					cv2.line(image, (ri(x_2x8[0,0]), ri(x_2x8[1,0])), (ri(x_2x8[0,3]), ri(x_2x8[1,3])), color, 2)
  
  					# txt = self.detections_mapping[bb.label] + ' %.3f'%(bb.confidence)
  					# cv2.putText(image, txt, (ri(bb.fblx), ri(bb.ftly-5)), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, color)
  
  		else:
  			# Plot 2D bounding boxes
  			for bb in bbs:
  				if bb.confidence >= self.confidence:
  					color = hex2bgr(COLORS[self.detections_mapping[bb.label]])
  					cv2.rectangle(image, (ri(bb.xmin), ri(bb.ymin)), (ri(bb.xmax), ri(bb.ymax)), color, 2)
function_tokens: def _plot_bboxes ( self , image , filename ) : if filename not in self . iml_detections : return bbs = self . iml_detections [ filename ] if self . pgps is not None : # Plot 3D bounding boxes if filename not in self . pgps . keys ( ) : print ( 'ERROR: Missing PGP for file "' + filename + '"!' ) exit ( 2 ) pgp = self . pgps [ filename ] for bb in bbs : if bb . confidence >= self . confidence : # Get all 4 bounding box corners in 3D (FBL FBR RBR RBL FTL FTR RTR RTL) X_3x8 = pgp . reconstruct_bb3d ( bb ) # Project them back to image x_2x8 = pgp . project_X_to_x ( X_3x8 ) color = hex2bgr ( COLORS [ self . detections_mapping [ bb . label ] ] ) # Plot front side cv2 . line ( image , ( ri ( x_2x8 [ 0 , 4 ] ) , ri ( x_2x8 [ 1 , 4 ] ) ) , ( ri ( x_2x8 [ 0 , 5 ] ) , ri ( x_2x8 [ 1 , 5 ] ) ) , ( 0 , 255 , 0 ) , 2 ) cv2 . line ( image , ( ri ( x_2x8 [ 0 , 5 ] ) , ri ( x_2x8 [ 1 , 5 ] ) ) , ( ri ( x_2x8 [ 0 , 1 ] ) , ri ( x_2x8 [ 1 , 1 ] ) ) , ( 0 , 255 , 0 ) , 2 ) cv2 . line ( image , ( ri ( x_2x8 [ 0 , 0 ] ) , ri ( x_2x8 [ 1 , 0 ] ) ) , ( ri ( x_2x8 [ 0 , 1 ] ) , ri ( x_2x8 [ 1 , 1 ] ) ) , ( 0 , 255 , 0 ) , 2 ) cv2 . line ( image , ( ri ( x_2x8 [ 0 , 0 ] ) , ri ( x_2x8 [ 1 , 0 ] ) ) , ( ri ( x_2x8 [ 0 , 4 ] ) , ri ( x_2x8 [ 1 , 4 ] ) ) , ( 0 , 255 , 0 ) , 2 ) # Plot rear side cv2 . line ( image , ( ri ( x_2x8 [ 0 , 2 ] ) , ri ( x_2x8 [ 1 , 2 ] ) ) , ( ri ( x_2x8 [ 0 , 3 ] ) , ri ( x_2x8 [ 1 , 3 ] ) ) , ( 0 , 0 , 255 ) , 2 ) cv2 . line ( image , ( ri ( x_2x8 [ 0 , 7 ] ) , ri ( x_2x8 [ 1 , 7 ] ) ) , ( ri ( x_2x8 [ 0 , 3 ] ) , ri ( x_2x8 [ 1 , 3 ] ) ) , ( 0 , 0 , 255 ) , 2 ) cv2 . line ( image , ( ri ( x_2x8 [ 0 , 7 ] ) , ri ( x_2x8 [ 1 , 7 ] ) ) , ( ri ( x_2x8 [ 0 , 6 ] ) , ri ( x_2x8 [ 1 , 6 ] ) ) , ( 0 , 0 , 255 ) , 2 ) cv2 . line ( image , ( ri ( x_2x8 [ 0 , 6 ] ) , ri ( x_2x8 [ 1 , 6 ] ) ) , ( ri ( x_2x8 [ 0 , 2 ] ) , ri ( x_2x8 [ 1 , 2 ] ) ) , ( 0 , 0 , 255 ) , 2 ) # Plot connections cv2 . line ( image , ( ri ( x_2x8 [ 0 , 4 ] ) , ri ( x_2x8 [ 1 , 4 ] ) ) , ( ri ( x_2x8 [ 0 , 7 ] ) , ri ( x_2x8 [ 1 , 7 ] ) ) , color , 2 ) cv2 . line ( image , ( ri ( x_2x8 [ 0 , 5 ] ) , ri ( x_2x8 [ 1 , 5 ] ) ) , ( ri ( x_2x8 [ 0 , 6 ] ) , ri ( x_2x8 [ 1 , 6 ] ) ) , color , 2 ) cv2 . line ( image , ( ri ( x_2x8 [ 0 , 1 ] ) , ri ( x_2x8 [ 1 , 1 ] ) ) , ( ri ( x_2x8 [ 0 , 2 ] ) , ri ( x_2x8 [ 1 , 2 ] ) ) , color , 2 ) cv2 . line ( image , ( ri ( x_2x8 [ 0 , 0 ] ) , ri ( x_2x8 [ 1 , 0 ] ) ) , ( ri ( x_2x8 [ 0 , 3 ] ) , ri ( x_2x8 [ 1 , 3 ] ) ) , color , 2 ) # txt = self.detections_mapping[bb.label] + ' %.3f'%(bb.confidence) # cv2.putText(image, txt, (ri(bb.fblx), ri(bb.ftly-5)), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, color) else : # Plot 2D bounding boxes for bb in bbs : if bb . confidence >= self . confidence : color = hex2bgr ( COLORS [ self . detections_mapping [ bb . label ] ] ) cv2 . rectangle ( image , ( ri ( bb . xmin ) , ri ( bb . ymin ) ) , ( ri ( bb . xmax ) , ri ( bb . ymax ) ) , color , 2 )