阈值的选择当然希望智能、简单一些。应该能应付一般的图片。

What is Binarization?
Binarization is the process of transforming data features of any entity into vectors of binary numbers to make classifier algorithms more efficient. In a simple example, transforming an image’s gray-scale from the 0-255 spectrum to a 0-1 spectrum is binarization.

How is Binarization used?
In machine learning, even the most complex concepts can be transformed into binary form. For example, to binarize the sentence “The dog ate the cat,” every word is assigned an ID (for example dog-1, ate-2, the-3, cat-4). Then replace each word with the tag to provide a binary vector. In this case the vector: <3,1,2,3,4> can be refined by providing each word with four possible slots, then setting the slot to correspond with a specific word: <0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1>. This is commonly referred to as the bag-of-words-method.

Since the ultimate goal is to make this data easier for the classifier to read while minimizing memory usage, it’s not always necessary to encode the whole sentence or all the details of a complex concept. In this case, only the current state of how the data is parsed is needed for the classifier. For example, when the top word on the stack is used as the first word in the input queue. Since order is quite important, a simpler binary vector is preferable.

二值算法综述请阅读:

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

联高简化版自适应算法是个不错的选择。


using System;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Drawing.Imaging;namespace Legalsoft.Truffer.ImageTools
{public static partial class BinarizationHelper{#region 灰度图像二值化 全局算法 联高 算法/// <summary>/// 计算图片的自适应灰度阈值/// </summary>/// <param name="data">灰度化的图片数据</param>/// <returns></returns>public static byte Adaptive_Threshold(byte[,] data, double ratio){int height = data.GetLength(0);int width = data.GetLength(1);int[] histogram = Gray_Histogram(data);double sum = (width * height) / ratio;int cnt = 0;byte left = 0;while (left < 255 && cnt < sum){cnt += histogram[left++];}cnt = 0;byte right = 255;while (right > left && cnt < sum){cnt += histogram[right--];}return (byte)((left + right) / 2);}/// <summary>/// 图像二值化的联高自适应算法/// </summary>/// <param name="data">灰度化的图片数据</param>/// <param name="ratio"></param>public static void Automatic_Adaptive_Algorithm(byte[,] data, double ratio = 8.0){byte threshold = Adaptive_Threshold(data, ratio);Threshold_Algorithm(data, threshold);}#endregion}
}

Binarization is important in digital image processing, mainly in computer vision applications. Thresholding is an efficient technique in binarization. The choice of thresholding technique is crucial in binarization. There are various thresholding algorithms have been proposed to define the optimal threshold value.

Binarization can be used in recognising text and symbols, e.g. document processing. Identifying objects with distinctive silhouettes, e.g. components on a conveyor in a manufacturing plant, and determining the orientation of objects are some other examples of binarization applications. Binarization generally involves two steps including the determination of a gray threshold according to some objective criteria and assigning each pixel to one class of background or foreground. If the intensity of the pixel is greater than the determined threshold then it belongs to the foreground class and otherwise to the background. The main problem in binarization is the choice of thresholding technique.

可见 ratio 的取值影响不大,该算法比较实用。

Image Thresholding

Image thresholding is a simple form of image segmentation. It is a way to create a binary image from a grayscale or full-color image. This is typically done in order to separate "object" or foreground pixels from background pixels to aid in image processing.

Thresholding is the simplest method of image segmentation, that replace each pixel in an image with a black pixel, if the image intensity is less than than some fixed constant, or a white pixel if image intensity is greater than the constant.

As the name implies, image thresholding allows us to apply a certain “threshold” to determine whether each pixel is of interest to us or not. Consequently, there are many practical and useful applications of image thresholding. For example we can use this to create a mask in order to isolate certain parts of an image. Alternatively, it can also be a good means to reduce noise within an image. With this in mind, let’s see how to use this in OpenCV.

C#,图像二值化(05)——全局阈值的联高自适应算法(Legal Self-Adaptive Thresholding)及其源代码相关推荐

  1. 图像二值化处理(全局阈值 自适应阈值 手动阈值操作以及直方图画法)

    文章目录 图像二值化处理 二值化原理 API介绍 手动设置阈值 均值法 迭代法 自动设置阈值 直方图法 全局阈值法 OTSU法 三角形法 自适应阈值法 API 绘制图像直方图 图像二值化处理 二值化原 ...

  2. 图像二值化_三角阈值法

    前言 一.三角阈值法是什么? 二.算法原理 1.算法 总结 参考文献 前言 图像二值化有很多方法,比较经典的为OTSU,三角阈值法,本文主要想一探三角阈值法的算法原理. 一.三角阈值法是什么? 三角阈 ...

  3. java 用遗传算法解决图像二值化问题 找阈值

    image类对图像处理 import java.awt.image.BufferedImage; public class Image {public int h; //高public int w; ...

  4. 【图像处理】——图像的二值化操作及阈值化操作(固定阈值法(全局阈值法——大津法OTSU和三角法TRIANGLE)和自适应阈值法(局部阈值法——均值和高斯法))

    目录 一.二值化的概念(实际上就是一个阈值化操作) 1.概念: 2.实现方法 3.常用方法 二.阈值类型 1.常见阈值类型(主要有五种类型) (1)公式描述 (2)图表描述 2.两种特殊的阈值算法(O ...

  5. OTSU_图像二值化分割阈值的算法

    简介: 大津法(OTSU)是一种确定图像二值化分割阈值的算法,由日本学者大津于1979年提出.从大津法的原理上来讲,该方法又称作最大类间方差法,因为按照大津法求得的阈值进行图像二值化分割后,前景与背景 ...

  6. 自适应阈值图像二值化

    一.二值化 关于二值化的介绍,以前的博客中有介绍,这里就不再描述了,二值化介绍:二值化分为固定阈值二值化和自适应阈值二值化,固定阈值二值化方式是我们常用的二值化方式,需要自己摸索一个经验阈值,不断调整 ...

  7. 图像二值化(选择阈值)

    目录 1. 双峰法 2. 大津法(Otsu法或最大类间方差法) 1. 双峰法 在一些简单的图像中,物体的灰度分布比较有规律,背景与各个目标在图像 的直方图各自形成一个波峰,即区域与波峰一一对应,每两个 ...

  8. 二值化图像的欧拉数_Android OpenCV(八):图像二值化

    图像二值化 简介 图像二值化( Image Binarization)就是将图像上的像素点的灰度值设置为0或255,也就是将整个图像呈现出明显的黑白效果的过程.在数字图像处理中,二值图像占有非常重要的 ...

  9. OpenCV-Python 图像二值化

    OpenCV-Python 图像二值化 一.什么是图像二值化 二.图像二值化 Ⅰ先获取阈值: Ⅱ根据阈值去二值化图像 ⅢOpenCV中的二值化方法 三.全局阈值函数cv2.threshold · 函数 ...

最新文章

  1. 部门名称部门结构叠用_金属结构分公司三部门联合开展工会小组活动
  2. debug和release的区别
  3. java 课后习题 键入日期输入星期几
  4. 游戏鼠标的dpi测试软件,有什么软件可以测试鼠标的dpi或着说cpi – 手机爱问
  5. 信捷plc485通信上位机_变频器、触摸屏和PLC建立MODBUS RTU通信的方法
  6. 屏幕适配的总结记录-重新起航
  7. Beta周王者荣耀交流协会第六次会议
  8. GUI编程入门到游戏实战
  9. 字幕文件与视频文件对不上的处理方式
  10. 神经网络—卷积神经网络CNN
  11. 将mysql语句转换为sql_数据库-转换sql语句
  12. K8S-解决报错--总结日记
  13. 爬虫出现AttributeError: ‘str‘ object has no attribute ‘items‘
  14. java显示日历 插件_JavaWeb项目FullCalendar日历插件使用的示例代码
  15. 创新工程-涂鸦移动面试总结
  16. Java DecimalFormat 格式化数字,取2位小数,按位取小数,按要求格式化小数 float,double,int,等类型都支持
  17. 04 Python基本数据类型
  18. 角平分线上的点到角两边的距离相等易混淆点
  19. 招聘管理系统简单设计
  20. Zeit.co 免费服务器平台

热门文章

  1. 2007-08-03 16:04 unresolved external symbol Direct3DCreate9
  2. 模块独立性与高内聚低耦合
  3. 主动降噪耳机什么牌子好?热门降噪耳机排行榜
  4. 用android实现GB28181监控客户端app
  5. 干货 | 这可能是最详细的「阻抗匹配」介绍
  6. R语言快速读写与矩阵运算
  7. @Autowired的基本使用
  8. 51单片机驱动ESP8266
  9. Logcat常见用法
  10. 设置linux 自动定时重启