videocapture.py
def rectangle_text(arImage, sColor, sUpper, sLower = None, tuRectangle = (224, 224)):
	""" Returns new image (not altering arImage)
	"""

	nHeigth, nWidth, _ = arImage.shape
	nRectHeigth, nRectWidth = tuRectangle
	x1 = int((nWidth - nRectWidth) / 2)
	y1 = int((nHeigth - nRectHeigth) / 2)

	if sColor == "green": bgr = (84, 175, 25)
	elif sColor == "orange": bgr = (60, 125, 235)
	else: #sColor == "red": 
		bgr = (27, 13, 252)

	arImageNew = np.copy(arImage)
	cv2.rectangle(arImageNew, (x1, y1), (nWidth-x1, nHeigth-y1), bgr, 3)

	# display a text to the frame 
	font = cv2.FONT_HERSHEY_SIMPLEX
	fFontSize = 0.5
	textSize = cv2.getTextSize(sUpper, font, 1.0, 2)[0]
	cv2.putText(arImageNew, sUpper, (x1 + 7, y1 + textSize[1] + 7), font, fFontSize, bgr, 2)	

	# 2nd text
	if (sLower != None):
		textSize = cv2.getTextSize(sLower, font, 1.0, 2)[0]
		cv2.putText(arImageNew, sLower, (x1 + 7, nHeigth - y1 - 7), font, fFontSize, bgr, 2)

	return arImageNew
 Returns new image (not altering arImage)
	
Returns new image (not altering arImage)
Returns new image ( not altering arImage )
def rectangle_text(arImage, sColor, sUpper, sLower = None, tuRectangle = (224, 224)):
	nHeigth, nWidth, _ = arImage.shape
	nRectHeigth, nRectWidth = tuRectangle
	x1 = int((nWidth - nRectWidth) / 2)
	y1 = int((nHeigth - nRectHeigth) / 2)
	if sColor == "green": bgr = (84, 175, 25)
	elif sColor == "orange": bgr = (60, 125, 235)
	else: 
		bgr = (27, 13, 252)
	arImageNew = np.copy(arImage)
	cv2.rectangle(arImageNew, (x1, y1), (nWidth-x1, nHeigth-y1), bgr, 3)
	font = cv2.FONT_HERSHEY_SIMPLEX
	fFontSize = 0.5
	textSize = cv2.getTextSize(sUpper, font, 1.0, 2)[0]
	cv2.putText(arImageNew, sUpper, (x1 + 7, y1 + textSize[1] + 7), font, fFontSize, bgr, 2)	
	if (sLower != None):
		textSize = cv2.getTextSize(sLower, font, 1.0, 2)[0]
		cv2.putText(arImageNew, sLower, (x1 + 7, nHeigth - y1 - 7), font, fFontSize, bgr, 2)
	return arImageNew
def rectangle_text ( arImage , sColor , sUpper , sLower = None , tuRectangle = ( 224 , 224 ) ) : nHeigth , nWidth , _ = arImage . shape nRectHeigth , nRectWidth = tuRectangle x1 = int ( ( nWidth - nRectWidth ) / 2 ) y1 = int ( ( nHeigth - nRectHeigth ) / 2 ) if sColor == "green" : bgr = ( 84 , 175 , 25 ) elif sColor == "orange" : bgr = ( 60 , 125 , 235 ) else : bgr = ( 27 , 13 , 252 ) arImageNew = np . copy ( arImage ) cv2 . rectangle ( arImageNew , ( x1 , y1 ) , ( nWidth - x1 , nHeigth - y1 ) , bgr , 3 ) font = cv2 . FONT_HERSHEY_SIMPLEX fFontSize = 0.5 textSize = cv2 . getTextSize ( sUpper , font , 1.0 , 2 ) [ 0 ] cv2 . putText ( arImageNew , sUpper , ( x1 + 7 , y1 + textSize [ 1 ] + 7 ) , font , fFontSize , bgr , 2 ) if ( sLower != None ) : textSize = cv2 . getTextSize ( sLower , font , 1.0 , 2 ) [ 0 ] cv2 . putText ( arImageNew , sLower , ( x1 + 7 , nHeigth - y1 - 7 ) , font , fFontSize , bgr , 2 ) return arImageNew
Returns new image (not altering arImage)
Returns new image ( not altering arImage )
""" Returns new image (not altering arImage)
	""" #sColor == "red":  # display a text to the frame  # 2nd text
arImage
sColor
sUpper
sLower
tuRectangle