import numpy as np

class BoundBox:
	def __init__(self, xmin, ymin, xmax, ymax, objness = None, classes = None):
		self.xmin = xmin
		self.ymin = ymin
		self.xmax = xmax
		self.ymax = ymax
		self.objness = objness
		self.classes = classes
		self.label = -1
		self.score = -1

	def get_label(self):
		if self.label == -1:
			self.label = np.argmax(self.classes)

		return self.label

	def get_score(self):
		if self.score == -1:
			self.score = self.classes[self.get_label()]

		return self.score
	
	def get_center(self):
		return ((int(self.xmin)+int(self.xmax))/2.0,(int(self.ymin)+int(self.ymax))/2.0)

	def to_string(self):
		return 'xmin: '+str(self.xmin)+' xmax: '+str(self.xmax)+' ymin: '+str(self.ymin)+' ymax: '+str(self.ymax)+' center:'+str(self.get_center())