I have some binary images with text, like below:
image 1:
image 2:
And the corresponding horizontal projection is:
It seems that I can segmentation by the horizontal projection, but how?
Thanks in advance!
PS: code to do the projection:
from matplotlib import pyplot as plt
import pylab
(rows,cols)=img.shape
h_projection = np.array([ x/255/rows for x in img.sum(axis=0)])
plt.plot(range(cols), h_projection.T)
pylab.savefig(outfile, bbox_inches='tight')
plt.clf()
And to remove misunderstanding, when I say horizontal projection, I mean a projection made on a plane parallel to the horizon.