C#,图像二值化(24)——局部阈值算法的NiBlack算法及源程序

news/2024/12/5 13:23:13/

1、局部阈值算法的NiBlack算法

摘要-医学图像的处理最为复杂人和计算机。磁性捐赠的脑组织共振成像(MRI)在许多领域是非常重要的问题例如手术和治疗。最常见的分割图像的最简单方法是使用阈值。在这项工作中,我们提出了一个有效的实现阈值,并给出详细的比较了现有的局部阈值算法。

Niblack阈值算法在预处理的输入MRI图像。输出结果如下根据区域不均匀性质量度量进行处理,以及

高效实施的质量。我们的实施是适用于处理MR脑图像分割对象的交互式平滑边界。

关键词-磁共振成像,阈值,Niblack,区域不均匀性

一、 引言

属于对象的像素的灰度级为与像素的灰度级完全不同属于背景,在图像的许多应用中处理。阈值处理变得简单,但将前景对象与出身背景我们可以将图像中的像素分成两个主要群体,根据其灰度等级。这些灰度级可以用作“检测器”,以区分背景和对象被视为前景图像[1]。在这两个主要颜色之间选择一个灰度级

灰度级组,将作为阈值区分两组(对象和背景)。图像分割由边界等执行检测或区域相关技术。但是阈值技术更加完善、简单广泛使用[2]。不同的二值化方法执行以评估不同类型的数据。这个在灰度级中使用局部自适应二值化方法低对比度、背景强度变化的图像以及噪声的存在。Niblack的方法用于灰度图像中的阈值处理效果更好,但它仍然是对其进行了修改,以获得更好的结果[3]。在这项工作中,Niblock算法的输入数据为在一些预处理下增强输出数据。这个MRI脑图像自然具有低对比度。这低对比度图像也得到增强结果从背景分析对象。当地人直方图均衡对输入图像进行了增强[12],[13]. 直方图均衡生成灰度图。它更改图像的直方图并重新排列所有像素值尽可能接近用户指定的期望值直方图。直方图均衡丰富了较低的局部对比度以获得较高的对比度。本文的组织结构如下,第二节为目的是呈现关于图像阈值的信息。详细解释了局部自适应阈值技术在第三节中,第四节侧重于Niblack算法的实现。视觉结果和第四节的质量度量结果在第节中讨论五、 最后,第六节包含结论。

二、阈值

简单地,阈值的基本函数[5]创建通过旋转所有像素从灰度级图像中提取二值图像

低于某个阈值为零且所有像素高于该阈值阈值设置为一[1],[5]。如果g(x,y)是如果f(x,y)T在某个全局阈值T时等于1否则为零[1]。阈值技术一般可分为两类,如全局阈值和局部阈值阈值。全局阈值方法考虑单个强度阈值。局部阈值方法计算图像中每个像素的阈值其附近的内容[13]。它认为图像中所有强度级别的存在。所以当地人阈值方法通常对低质量图像[3]。我们将阈值方法分组根据他们利用的信息。直方图基于形状的方法,该方法使用了波峰、波谷并分析平滑直方图的曲率。

基于聚类的方法在灰度级样本分为两部分作为背景和前景(对象)。基于熵的方法导致使用原始数据之间的交叉熵的算法以及二值化图像、前景的熵和背景区域[3]、[4]。基于对象属性的方法;搜索灰度级和二值化图像,如边缘重合、模糊形状相似性空间方法使用了像素和/或高阶概率分布。地方的方法使每个像素上的阈值适应本地图像特征[4]。

Abstract— Medical images are most complicated to process by

human and computer. Brain tissue donated by magnetic

resonance imaging (MRI) is very important issue in many

applications such as surgery and treatments. Most common

and simplest approach to segment an image is using

thresholding. In this work we present an efficient

implementation for threshoding and give a detailed

comparison of some existing local thresholding algorithm.

Niblack thresholding algorithm is implemented on

preprocessed input MRI image. The output results are

processed under Region Nonuniformity quality metrics and

the quality of efficient implementation. Our implementation is

suitable for processing the MR brain images, making

interactive smooth boundaries to the segmented object.

Keywords— Magnetic resonance imaging, thresholding,

Niblack, Region Nonuniformity

I. INTRODUCTION

The gray levels of pixels belonging to the object are

entirely different from the gray levels of the pixels

belonging to the background, in many applications of image

processing. Thresholding becomes then a simple but

effective tool to separate those foreground objects from the

background. We can divide the pixels in the image into two

major groups, according to their gray-level. These graylevels may serve as “detectors” to distinguish between

background and objects is considering as foreground in the

image [1]. Select a gray-level between those two major

gray-level groups, which will serve as a threshold to

distinguish the two groups (objects and background).

Image segmentation is performed by such as boundary

detection or region dependent techniques. But the

thresholding techniques are more perfect, simple and

widely used [2]. Different binarization methods have been

performed to evaluate for different types of data. The

locally adaptive binarization method is used in gray scale

images with low contrast, Varity of background intensity

and presence of noise. Niblack’s method was found for

better thresholding in gray scale image, but still it has been

modified for fine and better result [3].

In this work the input data of the Niblock algorithm is

under some preprocess for enhanced the output data. The

MRI brain images are naturally having low contrast. This

low contrast images also enhanced and produce a better

result to analysis the object from the background. The Local

Histogram Equalization is enhanced the input image [12],

[13]. Histogram Equalization generates a gray map. It

changes the histogram of an image and rearranges all pixels

values to be as close as possible to a user specified desired

histogram. Histogram Equalization enriches the areas of

lower local contrast to gain a higher contrast.

This paper is organized as follows, section II is for the

purpose of presenting information about image thresholding.

Local adaptive thresholding technique is explained detailed

in section III. Section IV focused the efficient

implementation of Niblack algorithm. Visual results and

quality metric results of section IV are discussed in section

V. Finally section VI contains the conclusion.

II. THRESHOLDING

Simply the basic function [5] for thresholding creates the

binary image from gray level ones by turning all pixels

below some threshold to zero and all pixels above that

threshold to one [1],[5]. If g(x, y) is a threshold version of

f(x, y) at some global threshold T. g is equal to 1 if f(x, y) T

and zero otherwise [1].

Thresholding techniques can be classified generally into

two categories like Global thresholding and Local

thresholding. Global thresholding methods consider a single

intensity threshold value. Local thresholding methods

compute a threshold for each pixel in the image on the basis

of the content in its neighbourhood [13]. It considers

presences of all intensity level in the image. So the local

thresholding methods generally perform better for low

quality images [3].

We categorize the thresholding methods in groups

according to the information they are exploiting. Histogram

shape-based methods, this method used the peaks, valleys

and curvatures of the smoothed histogram are analyzed.

Clustering-based methods perform where the gray-level

samples are clustered in two parts as background and

foreground (object). Entropy-based methods result in

algorithms that use the cross-entropy between the original

and binarized image, the entropy of the foreground and

background regions [3], [4]. Object attribute-based methods;

search a similarity measure between the gray-level and the

binarized images, such as edge coincidence, fuzzy shape

similarity. The spatial methods use correlation between

pixels and/or higher-order probability distribution. Local

methods adapt the threshold value on each pixel to the local

image characteristics [4].

2、局部阈值算法的NiBlack算法源程序

二值算法综述请阅读:

C#,图像二值化(01)——二值化算法综述与二十三种算法目录

https://blog.csdn.net/beijinghorn/article/details/128425225?spm=1001.2014.3001.5502

支持函数请阅读:

C#,图像二值化(02)——用于图像二值化处理的一些基本图像处理函数之C#源代码

https://blog.csdn.net/beijinghorn/article/details/128425984?spm=1001.2014.3001.5502

namespace Legalsoft.Truffer.Binarization
{
public static partial class BinarizationHelper
{#region 灰度图像二值化 局部算法 NiBlack 算法/// <summary>/// 局部算法/// 图像二值化的 NiBlack 算法/// https://blog.csdn.net/lucayhaozi/article/details/9967963/// </summary>/// <param name="data">灰度化后的图像byte数组</param>/// <param name="k"></param>public static void Niblack_Algorithm(byte[,] data, double k = -0.1){int height = data.GetLength(0);int width = data.GetLength(1);int Niblack_s = Math.Max(5, width / 32);int Niblack_q = Math.Max(5, height / 32);byte[,] dump = (byte[,])data.Clone();for (int y = 0; y < height; y++){for (int x = 0; x < width; x++){int begin_y = Math.Max(0, y - Niblack_q);int begin_x = Math.Max(0, x - Niblack_s);int end_y = Math.Min(height, y + Niblack_q);int end_x = Math.Min(width, x + Niblack_s);//if (begin_y < 0) begin_y = 0;//if (begin_x < 0) begin_x = 0;//if (end_y > height) end_y = height;//if (end_x > width) end_x = width;//该领域内总的像素点数double mean = 0.0;int total = (end_y - begin_y) * (end_x - begin_x);for (int yy = begin_y; yy < end_y; yy++){for (int xx = begin_x; xx < end_x; xx++){mean += dump[yy, xx];}}//计算在该小领域内灰度值总和//该领域的平均灰度mean /= (double)total;double std_error = 0.0;for (int yy = begin_y; yy < end_y; yy++){for (int xx = begin_x; xx < end_x; xx++){std_error += (mean - dump[yy, xx]) * (mean - dump[yy, xx]);//std += sq;}}//求出该领域内总的方差和std_error /= (double)total;//求出标准差std_error = (Math.Abs(std_error) < float.Epsilon) ? 0.0 : Math.Sqrt(std_error);//求出所得到的的阈值double threshold = mean + k * std_error;data[y, x] = (byte)((dump[y, x] > threshold) ? 255 : 0);}}}#endregion}
}

3、局部阈值算法的NiBlack算法及源程序计算效果

POWER BY 315SOFT.COM & TRUFFER.CN


http://www.ppmy.cn/news/12443.html

相关文章

LeetCode080_80. 删除有序数组中的重复项 II

LeetCode080_80. 删除有序数组中的重复项 II 一、描述 给你一个有序数组 nums &#xff0c;请你 原地 删除重复出现的元素&#xff0c;使得出现次数超过两次的元素只出现两次 &#xff0c;返回删除后数组的新长度。 不要使用额外的数组空间&#xff0c;你必须在 原地 修改输…

【7】AMBA_SOC项目IC验证自学项目-EDA知识讲解

目录&#xff1a;1、三大EDA工具介绍&#xff1a;2、EDA具体是什么意思&#xff1f;3、大部分公司中用哪个最多&#xff1f;1、三大EDA工具介绍&#xff1a; Synopsys&#xff08;新思科技&#xff09;&#xff0c;美国 vcs Cadence&#xff08;楷登电子&#xff09;&#xf…

命令行批量 PDF 转换器:2PDF 2.0.8x Crack

命令行 PDF 转换器 2PDF 是一个专业的命令行实用程序&#xff0c;用于以批处理模式将办公文档和图像转换为 PDF。2PDF 基于命令行界面和语法&#xff0c;通过简单的标准命令提供对批量转换为 PDF 的完全控制。 从 Windows 命令提示符将文档和图像转换为 PDF 2PDF 可以将 PDF 和…

1.15日报

完成font.css global.css login.vue request.js 今天完成了前端与后端的联通&#xff0c;并成功响应请求。返回登录成功欣喜。 遇到的问题&#xff1a; 我的body设置了&#xff1a; margin:0; padding:0; 但是页面四周还有白色留边。原因&#xff1a;body设置无边框了&a…

YOLO家族系列模型的演变:从v1到v8(上)

YOLO V8已经在本月发布了&#xff0c;我们这篇文章的目的是对整个YOLO家族进行比较分析。了解架构的演变可以更好地知道哪些改进提高了性能&#xff0c;并且明确哪些版本是基于那些版本的改进&#xff0c;因为YOLO的版本和变体的命名是目前来说最乱的&#xff0c;希望看完这篇文…

漏洞挖掘之信息收集

简介 对单一指定目标网站进行黑盒测试&#xff0c;最重要的就是信息收集&#xff0c;因为网站管理员肯定会在用户经常访问的主网站进行经常维护&#xff0c;而那些子域名&#xff0c;没有什么人访问的&#xff0c;可能就会忘记维护&#xff0c;挖洞的突破点大都在于子域名上&am…

SPSS常用的10种统计分析

目录 实验一 地理数据的统计处理 一、实验目的 二、实验内容 三、实验步骤 实验二 双变量相关分析 一、实验目的 二、实验内容 三、实验步骤 实验三 主成分分析 一、实验目的 二、实验内容 三、实验步骤 实验四 因子分析 一、实验目的 二、实验内容 三、实…

mysql索引字段设计

表字段数量与row大小限制可以参考官方文档 https://dev.mysql.com/doc/refman/8.0/en/column-count-limit.html#column-count-limits 复合索引 参考&#xff1a;https://dev.mysql.com/doc/refman/8.0/en/innodb-limits.html 数量限制 一个复合索引最多可以包含16个列&…