Advertisement

基于OpenCV 3.1.0的垂直投影算法及其C++实现用于图像分割

阅读量:

对文本中的多行进行分割


代码直接应用

复制代码
 #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 

全部评论 (0)

还没有任何评论哟~