标题:图像边界的提取,怎么用
只看楼主
郭俊森
Rank: 1
等 级:新手上路
帖 子:27
专家分:3
注 册:2013-2-28
结帖率:57.14%
 问题点数:0 回复次数:0 
图像边界的提取,怎么用
privatevoidBound_Click(objectsender, EventArgs e)
{     
if(bitMap !=null)     
{         
BoundExtract boundExtract =newBoundExtract(bitMap);         
boundExtract.Draw();         
Invalidate();      
}
}
public class BoundExtract:ImageFeature
{
bool bBound;    //是否是边界点的判断
public BoundExtract(Bitmap bitmap):base(bitmap)
{
}
/// <summary>
///3X3的边界提取
/// </summary>
public void Extract()
{
for (int j=1;j<h-1;j++)
for (int i = 1; i < w - 1; i++)
{
bBound = false;
if (binary[i, j] == 0) continue;
for(int k=-1;k<=1;k++)
for (int l = -1; l <= 1; l++)
{
if (binary[i + k, j + l] == 0)
{
bBound = true;
k = 2;
l = 2;
}
}
if (!bBound) bitMap.SetPixel(i, j, Color.FromArgb(255, 255, 255));   
//不是边界点将其置为白色
}
}
 public override void Draw()
{
ToBianry();
Extract();
}
}
搜索更多相关主题的帖子: public false null 
2013-09-14 09:57



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-420554-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017584 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved