I have this function :
def give_peak_sum(file):
image = cv2.imread(file) # opencv’s image read function
image_copy = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # convertsimage from
# BGR color space to RGB color space
image_dims = image.shape
x_dim = image_dims[1]
# converting to gray scale
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
gray = np.float32(gray)
# detect corners
dst = cv2.cornerHarris(gray, 2, 3, 0.04)
# dilate corner image to enhance corner points
dst = cv2.dilate(dst, None)
thresh = 0.02*dst.max()
peak_sum = 0
mid_line = get_mid_line(image_copy) # using the previously definedfunction
for j in range(0, dst.shape[0]):
for i in range(0, dst.shape[1]):
if (dst[j, i] > thresh and i < 0.4*x_dim):
peak_sum += abs(j-mid_line)
return (peak_sum)
the function sums the amplitude of a group of edges (peaks andbottoms) on the left