对文本中的多行进行分割
直接上代码
#include<opencv2/imgproc/imgproc.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/core/core.hpp>
#include<iostream>
#include <stdio.h>
using namespace std;
using namespace cv;
Mat vertical_projection(Mat input_src) //基于Y轴垂直投影分割算法(输入的是二值图像)
{
/**************统计原图片中每行黑色像素数目******************************/
blur(input_src, input_src, Size(3, 3));//对输入的二值图像进行3*3均值滤波(blur是均值滤波函数)
int src_width = input_src.cols; //获得二值图像的列数(宽)(列的像素点个数)
int src_height = input_src.rows; //获得二值图像的行数(高)(行的像素点个数)
int* projectValArry = new int[src_height]();//创建用于储存每行黑色像素个数的数组
//在行的基础下遍历每一列,取列黑色像素个数,获得储存每行黑色像素个数的数组
for (int i = 0; i < src_height; i++){
for (int j = 0; j < src_width; j++)