资源简介
Niblack二值化算法在opencv2下的实现。参考文献:http://www.cnblogs.com/nani/archive/2012/12/12/2814324.html http://blog.csdn.net/lucayhaozi/article/details/9967963 仅供参考。欢迎宝贵意见。
代码片段和文件信息
#include “stdafx.h“
#include
using namespace cv;
//using namespace std;
//参数Win_width窗口宽度,Win_height窗口高度,k为修正系数(通常取-0.1)
void Niblack(Mat &srcImg Mat &binImg int Win_width int Win_height double k)
{
srcImg.convertTo(srcImg CV_64F);
int width = srcImg.cols;
int height = srcImg.rows;
binImg.create(height width CV_64FC1);
for(int j = 0; j < height; j++)
{
double *srcptr = srcImg.ptr(j);
double *dstptr = binImg.ptr(j);
for(int i = 0; i < width; i++)
{
int begin_y = j - Win_height begin_x = i - Win_width;
int end_y = j + Win_height end_x = i + Win_width;
if(begin_y < 0) begin_y = 0;
if(begin_x < 0) begin_x = 0;
if(end_y >= height) end_y = height-1;
if(end_x >= width ) end_x = width -1;
int total = ( end_y - begin_y +1 ) * ( end_x - begin_x +1 ); //该窗口内总的像素点数
double mean = 0;//均值
double std = 0;//标准差
for(int y = begin_y; y {
double *ptrWin = sr
相关资源
- ElevatorSimulation.zip
- 14002454IPC-A-610DChinese(L).pdf
- SoftwareEngineering.pdf
- linfanrong_10164999.rar
- The.Art.Of.Unit.Testing.With.Examples.in.C.2nd
- myGame.rar
- 带手机版数据同步财税代理公司注册
- pdf课本及习题答案.rar
- 深度学习PDF非扫描版(中文版)麻省
- doudizhu_shffule_src.zip
- 随机信号分析解题指南.pdf
- ios12.3驱动.zip
- 百万邮件系统多机版.rar
- learnopengl-cn-2018年5月更新.pdf
- zw_学习OpenCV(中文版).zip
- 1-300.pdf
- pyqt5windows生成二维工具源码
- KNN疾病预测算法Demo
- ABAQUS单元失效浅析(单元删除
- Jtopo+json格式数据代码
- 解多目标规划的单纯形代码
- TerraVolVoxelTerrainEngine2.1c.7z
- VA_X_Setup2118.rar
- CHS_Ha_PasswarekitEnterprise10.0.exe
- 无线通信AndreaGoldsmith杨鸿文等译.rar
- 迅捷PDF转换器破解版.rar
- 迅捷PDF编辑器破解版.rar
- 金字塔原理1清晰扫描版.pdf
- TeamViewer_11已激活+破解版+随意换ID.z
- FieldtheoryofGuidedwavesCollin__2nd.pdf
评论
共有 条评论