Win8 Metro(C#)数字图像处理--2.65形态学轮廓提取算法
2015-04-25 08:52
656 查看
[函数名称]
形态学轮廓提取函数
WriteableBitmap MorcontourextractionProcess(WriteableBitmap src)
最后,分享一个专业的图像处理网站(微像素),里面有很多源代码下载:
http://www.zealpixel.com/portal.php
[函数名称]
形态学轮廓提取函数
WriteableBitmap MorcontourextractionProcess(WriteableBitmap src)
/// <summary> /// Morgraphy contour extraction process. /// </summary> /// <param name="src">The source image.</param> /// <returns></returns> public static WriteableBitmap MorcontourextractionProcess(WriteableBitmap src)////形态学轮廓提取 { if (src != null) { int w = src.PixelWidth; int h = src.PixelHeight; WriteableBitmap corrosionImage = new WriteableBitmap(w, h); byte[] temp = src.PixelBuffer.ToArray(); byte[] tempMask = (byte[])temp.Clone(); for (int j = 0; j < h; j++) { for (int i = 0; i < w; i++) { if (i == 0 || i == w - 1 || j == 0 || j == h - 1) { temp[i * 4 + j * w * 4] = (byte)255; temp[i * 4 + 1 + j * w * 4] = (byte)255; temp[i * 4 + 2 + j * w * 4] = (byte)255; } else { if (tempMask[i * 4 - 4 + j * w * 4] == 255 && tempMask[i * 4 + j * w * 4] == 255 && tempMask[i * 4 + 4 + j * w * 4] == 255 && tempMask[i * 4 + (j - 1) * w * 4] == 255 && tempMask[i * 4 + (j + 1) * w * 4] == 255) { temp[i * 4 + j * w * 4] = (byte)255; temp[i * 4 + 1 + j * w * 4] = (byte)255; temp[i * 4 + 2 + j * w * 4] = (byte)255; } else { temp[i * 4 + j * w * 4] = 0; temp[i * 4 + 1 + j * w * 4] = 0; temp[i * 4 + 2 + j * w * 4] = 0; } } } } for (int i = 0; i < temp.Length; i++) { temp[i] = (byte)(tempMask[i]-temp[i]); } Stream sTemp = corrosionImage.PixelBuffer.AsStream(); sTemp.Seek(0, SeekOrigin.Begin); sTemp.Write(temp, 0, w * 4 * h); return corrosionImage; } else { return null; } }
最后,分享一个专业的图像处理网站(微像素),里面有很多源代码下载:
http://www.zealpixel.com/portal.php
相关文章推荐
- Win8 Metro(C#)数字图像处理--2.40二值图像轮廓提取算法
- Win8 Metro(C#)数字图像处理--2.45图像雾化效果算法
- Win8 Metro(C#)数字图像处理--2.35图像肤色检测算法
- Win8 Metro(C#)数字图像处理--2.49Zhang二值图像细化算法
- Win8 Metro(C#)数字图像处理--2.51图像统计滤波算法
- Win8 Metro(C#)数字图像处理--2.36角点检测算法
- Win8 Metro(C#)数字图像处理--2.42图像光照效果算法
- Win8 Metro(C#)数字图像处理--2.60部分彩色保留算法
- Win8 Metro(C#)数字图像处理--2.44图像油画效果算法
- Win8 Metro(C#)数字图像处理--3.4图像信息熵计算
- Win8 Metro(C#)数字图像处理--2.47人脸红眼去除算法
- Win8 Metro(C#)数字图像处理--2.69中点滤波器
- Win8 Metro(C#)数字图像处理--2.48Canny边缘检测算法
- Win8 Metro(C#)数字图像处理--2.58双峰法图像二值化
- Win8 Metro(C#)数字图像处理--3.5图像形心计算
- Win8 Metro(C#)数字图像处理--2.59 P分位法图像二值化
- Win8 Metro(C#)数字图像处理--2.70修正后的阿尔法滤波器
- Win8 Metro(C#)数字图像处理--2.37Wallis图象锐化
- Win8 Metro(C#)数字图像处理--2.38Hough变换直线检测
- Win8 Metro(C#)数字图像处理--2.62图像对数增强