Win8MetroC#数字图像处理--2.2图像二值化函数
原文:Win8MetroC#数字图像处理--2.2图像二值化函数
[函数代码]
/// <summary>
/// Binary process.
/// </summary>
/// <param name="src">Source image.</param>
/// <param name="threshould">Define a threshould value for binary processing, from 0 to 255.</param>
/// <returns></returns>
public static WriteableBitmap BinaryProcess(WriteableBitmap src, int threshould)////2 二值化处理
{
if(src!=null )
{
int w = src.PixelWidth;
int h = src.PixelHeight;
WriteableBitmap binaryImage = new WriteableBitmap(w,h);
byte[] temp = src.PixelBuffer.ToArray();
for (int i = 0; i < temp.Length; i += 4)
{
byte tempByte = (byte)(((temp[i] + temp[i + 1] + temp[i + 2]) / 3) < threshould ? 0 : 255);
temp[i] = tempByte;
temp[i + 1] = tempByte;
temp[i + 2] = tempByte;
}
Stream sTemp = binaryImage.PixelBuffer.AsStream();
sTemp.Seek(0, SeekOrigin.Begin);
sTemp.Write(temp, 0, w * 4 * h);
return binaryImage;
}
else
{
return null;
}
}
Win8MetroC#数字图像处理--2.2图像二值化函数的更多相关文章
- opencv-python图像二值化函数cv2.threshold函数详解及参数cv2.THRESH_OTSU使用
cv2.threshold()函数的作用是将一幅灰度图二值化,基本用法如下: #ret:暂时就认为是设定的thresh阈值,mask:二值化的图像 ret,mask = cv2.threshold(i ...
- Win8 Metro(C#)数字图像处理--2.59 P分位法图像二值化
原文:Win8 Metro(C#)数字图像处理--2.59 P分位法图像二值化 [函数名称] P分位法图像二值化 [算法说明] 所谓P分位法图像分割,就是在知道图像中目标所占的比率Rat ...
- Win8 Metro(C#)数字图像处理--2.55OSTU法图像二值化
原文:Win8 Metro(C#)数字图像处理--2.55OSTU法图像二值化 [函数名称] Ostu法图像二值化 WriteableBitmap OstuThSegment(Writ ...
- Win8 Metro(C#)数字图像处理--2.56简单统计法图像二值化
原文:Win8 Metro(C#)数字图像处理--2.56简单统计法图像二值化 [函数名称] 简单统计法图像二值化 WriteableBitmap StatisticalThSegment(Wr ...
- Win8 Metro(C#)数字图像处理--2.57一维最大熵法图像二值化
原文:Win8 Metro(C#)数字图像处理--2.57一维最大熵法图像二值化 [函数名称] 一维最大熵法图像二值化WriteableBitmap EntropymaxThSegment(Wr ...
- Win8 Metro(C#)数字图像处理--2.58双峰法图像二值化
原文:Win8 Metro(C#)数字图像处理--2.58双峰法图像二值化 [函数名称] 双峰法图像二值化 WriteableBitmap PeakshistogramThSegment( ...
- Win8 Metro(C#)数字图像处理--2.54迭代法图像二值化
原文:Win8 Metro(C#)数字图像处理--2.54迭代法图像二值化 [函数名称] 迭代法图像二值化 int IterativeThSegment(WriteableBitm ...
- Win8MetroC#数字图像处理--2.1图像灰度化
原文:Win8MetroC#数字图像处理--2.1图像灰度化 [函数说明] 图像灰度化函数GrayProcess(WriteableBitmap src) [算法说明] 图像灰度化就是去掉彩色 ...
- Python+OpenCV图像处理(十)—— 图像二值化
简介:图像二值化就是将图像上的像素点的灰度值设置为0或255,也就是将整个图像呈现出明显的黑白效果的过程. 一.普通图像二值化 代码如下: import cv2 as cv import numpy ...
随机推荐
- [Vue] Use Vue.js Component Computed Properties
You can add computed properties to a component to calculate a property on the fly. The benefit of th ...
- 【u032】均衡发展
Time Limit: 1 second Memory Limit: 128 MB [问题描述] 神牛小R在许多方面都有着很强的能力,具体的说,他总共有m种能力,并将这些能力编号为1到m.他的能力是一 ...
- 中国象棋V2:Java源代码、毕业设计等所有文档,已经全部提交到CSDN-Code平台
下载地址:https://code.csdn.net/FansUnion/chinesechess-v2 主要内容:Java源代码.毕业设计.API文档.声音图片等资源.Demo截图等一切的一切. 2 ...
- Oracle数据库分页查询的几种实现方法
没有Sql Server有top那么好用,但是Oracle含有隐藏的rownum列可以灵活使用,使实现分页效果,pageSize默认10行 方法一: select * from test where ...
- DYNAMIC CONTEXT SWITCHING BETWEEN ARCHITECTURALLY DISTINCT GRAPHICS PROCESSORS
FIELD OF INVENTION This invention relates to computer graphics processing, and more specifically to ...
- Architectures for concurrent graphics processing operations
BACKGROUND 1. Field The present invention generally relates to rendering two-dimension representatio ...
- 【先进的算法】Lasvegas算法3SAT问题(C++实现代码)
转载请注明出处:http://blog.csdn.net/zhoubin1992/article/details/46469557 1.SAT问题描写叙述 命题逻辑中合取范式 (CNF) 的可满足性问 ...
- [Erlang]Mnesia分布式应用
http://blog.csdn.net/erlib/article/details/40743687 情景: 设计一个图书管理系统,需求: 1. 基本的增删查改功能; 2. 支持多节点备份(其中一个 ...
- 让Duilib多线程编程更easy
一.Duilib不能开发多线程程序? 记得非常久曾经就听有人说过Duilib的多线程支持性不好,原因是Duilib里面的控件是用数组管理的全局变量,不能进行多线程訪问,加锁非常麻烦.事实上这个说法是非 ...
- 在C++ Builder6上使用Boost正则表达式库
本文关键词:正则表达式 c++ python 软件 正则表达式是一种模式匹配形式,它通常用在处理的文本程序中.比如我们经常使用的grep工具,还是perl语言都使用了正则表达式. 正则表达式是一种模式 ...