def find_vertical_bounds(hp, T):
	"""
	Finds the upper and lower bounds of the characters' zone on the plate based on threshold value T
	:param hp: horizontal projection (axis=1) of the plate image pixel intensities
	:param T: Threshold value for bound detection
	:return: upper and lower bounds
	"""

	N = len(hp)

	# Find lower bound
	i = 0
	while ~((hp[i] <= T) & (hp[i+1] > T)) & (i < int(N/2)):
		i += 1
	lower_bound = 0 if i == int(N/2) else i

	# Find superior bound
	i = N-1
	while ~((hp[i-1] > T) & (hp[i] <= T)) & (i > int(N/2)):
		i -= 1
	upper_bound = i

	return [lower_bound, upper_bound]