Win8 Metro(C#)数字图像处理--2.39二值图像投影
原文:Win8 Metro(C#)数字图像处理--2.39二值图像投影
[函数名称]
二值图像投影 ImageProjection(WriteableBitmap src)
[算法说明]
[函数代码]
<pre class="csharp" name="code"> /// <summary>
/// Get projections of X and Y direction.
/// </summary>
/// <param name="src">The source image.</param>
/// <returns></returns>
public static int[][] ImageProjection(WriteableBitmap src)////二值图像投影
{
if (src != null)
{
int w = src.PixelWidth;
int h = src.PixelHeight;
int[][] Centerpoint = new int[2][];
Centerpoint[0] = new int[w+1];
Centerpoint[1] = new int[h+1];
int b = 0, g = 0, r = 0;
byte[] temp = src.PixelBuffer.ToArray();
for (int y = 0; y < h; y++)
{
for (int x = 0; x < w * 4; x += 4)
{
b = temp[x + y * w * 4];
g = temp[x + 1 + y * w * 4];
r = temp[x + 2 + y * w * 4];
if (r + g + b == 0)
{
Centerpoint[1][y]++;
}
}
}
for (int x = 0; x < w * 4; x += 4)
{
for (int y = 0; y < h; y++)
{
b = temp[x + y * w * 4];
g = temp[x + 1 + y * w * 4];
r = temp[x + 2 + y * w * 4];
if (r + g + b == 0)
{
Centerpoint[0][(int)(x/4)]++;
}
}
}
return Centerpoint;
}
else
{
return null;
}
}
Win8 Metro(C#)数字图像处理--2.39二值图像投影的更多相关文章
- Win8 Metro(C#)数字图像处理--2.49Zhang二值图像细化算法
原文:Win8 Metro(C#)数字图像处理--2.49Zhang二值图像细化算法 [函数名称] 二值图像细化算法 WriteableBitmap ThinningProcess ...
- Win8 Metro(C#)数字图像处理--2.40二值图像轮廓提取算法
原文:Win8 Metro(C#)数字图像处理--2.40二值图像轮廓提取算法 [函数名称] 二值图像轮廓提取 ContourExtraction(WriteableBitm ...
- Win8 Metro(C#)数字图像处理--2.75灰度图像的形态学算法
原文:Win8 Metro(C#)数字图像处理--2.75灰度图像的形态学算法 前面章节中介绍了二值图像的形态学算法,这里讲一下灰度图的形态学算法,主要是公式,代码略. 1,膨胀算法 2,腐蚀算法 3 ...
- Win8 Metro(C#)数字图像处理--2.36角点检测算法
原文:Win8 Metro(C#)数字图像处理--2.36角点检测算法 [函数名称] Harris角点检测函数 HarrisDetect(WriteableBitmap src, int ...
- Win8 Metro(C#)数字图像处理--4图像颜色空间描述
原文:Win8 Metro(C#)数字图像处理--4图像颜色空间描述 图像颜色空间是图像颜色集合的数学表示,本小节将针对几种常见颜色空间做个简单介绍. /// <summary> / ...
- Win8 Metro(C#)数字图像处理--3.2图像方差计算
原文:Win8 Metro(C#)数字图像处理--3.2图像方差计算 /// <summary> /// /// </summary>Variance computing. / ...
- Win8 Metro(C#)数字图像处理--3.3图像直方图计算
原文:Win8 Metro(C#)数字图像处理--3.3图像直方图计算 /// <summary> /// Get the array of histrgram. /// </sum ...
- Win8 Metro(C#)数字图像处理--3.4图像信息熵计算
原文:Win8 Metro(C#)数字图像处理--3.4图像信息熵计算 [函数代码] /// <summary> /// Entropy of one image. /// </su ...
- Win8 Metro(C#)数字图像处理--3.5图像形心计算
原文:Win8 Metro(C#)数字图像处理--3.5图像形心计算 /// <summary> /// Get the center of the object in an image. ...
随机推荐
- 我的Java开发学习之旅------>Java经典排序算法之归并排序
一.归并排序 归并排序是建立在归并操作上的一种有效的排序算法,该算法是採用分治法(Divide and Conquer)的一个很典型的应用.将已有序的子序列合并,得到全然有序的序列.即先使每一个子序列 ...
- 小强的HTML5移动开发之路(32)—— JavaScript回顾7
BOM模型brower object model(浏览器对象模型),通过浏览器内置的一些对象可以操作浏览器本身. DOM是用来操作页面的,BOM是用来操作浏览器本身的. BOM是没有规范的,但是大部分 ...
- Unity3d 配置OpenCV(EmguCV) 周围环境
最近毕业.我们一直在研究如何Unity正在使用EmguCV,最后,有些吃老本的今天. 我的环境:Unity3d 4.3.1f libemgucv-windows-univers ...
- 用Canvas画一个刮刮乐
Canvas 通过 JavaScript 来绘制 2D图形.Canvas 是逐像素进行渲染的.开发者可以通过javascript脚本实现任意绘图.Canvas元素是HTML5的一部分,允许脚本语言动态 ...
- 【BZOJ 1016】 [JSOI2008]最小生成树计数(matrix-tree定理做法)
[题目链接]:http://www.lydsy.com/JudgeOnline/problem.php?id=1016 [题意] [题解] /* 接上一篇文章; 这里用matrix-tree定理搞最小 ...
- fatal error: expat.h: No such file or directory
在CentOS7最小安装版下,编译安装apr-util时报错: fatal error: expat.h: No such file or directory 解决办法:yum install exp ...
- python io操作
一次性读取 # 读取文件 # 默认打开文件的方式是只读 file = None try: file = open("f:/test.sql") print(file.name) # ...
- nextSibling.focus()报错的问题
<body> <div> <input type="button" tabindex="-1" value="点点点点点 ...
- 【23.33%】【codeforces 664C】International Olympiad
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- MATLAB使用入门
作者:朱金灿 来源:http://blog.csdn.net/clever101 初步学习了MATLAB的使用,发现MATLAB是一个很好的算法仿真工具.MATLAB也是一门语言,是否会使用这门语言编 ...