91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 2.07KB
    文件類型: .cpp
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-03-27
  • 語言: 其他
  • 標(biāo)簽: 其他??

資源簡(jiǎn)介


Niblack二值化算法在opencv2下的實(shí)現(xiàn)。參考文獻(xiàn):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;

//參數(shù)Win_width窗口寬度,Win_height窗口高度,k為修正系數(shù)(通常取-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? {
double?*srcptr?=?srcImg.ptr(j);
double?*dstptr?=?binImg.ptr(j);
for(int?i?=?0;?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? if(begin_x? 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?);??//該窗口內(nèi)總的像素點(diǎn)數(shù)

double?mean?=?0;//均值
double?std??=?0;//標(biāo)準(zhǔn)差

for(int?y?=?begin_y;?y {
double?*ptrWin?=?sr

評(píng)論

共有 條評(píng)論