AForge.net 边缘检测 - 如何获取边缘点?
我正在使用 Aforge 对图像运行边缘检测,如何获取检测到的边缘点的 x,y?除了循环遍历图像位图的明显方式之外。
这是 Aforge 示例中的代码,但是如何获得边缘点?
// On Filters->Sobel edge detector
private void sobelEdgesFiltersItem_Click( object sender, System.EventArgs e )
{
// save original image
Bitmap originalImage = sourceImage;
// get grayscale image
sourceImage = Grayscale.CommonAlgorithms.RMY.Apply( sourceImage );
// apply edge filter
ApplyFilter( new SobelEdgeDetector( ) );
// delete grayscale image and restore original
sourceImage.Dispose( );
sourceImage = originalImage;
// this is the part where the source image is now edge detected. How to get the x,y for //each point of the edge?
sobelEdgesFiltersItem.Checked = true;
}
I am using Aforge to run edge detection on an image, how would I get the x,y for the detected edge(s) points? Other than the obvious way of looping through the image bitmaps.
This is the code from the Aforge samples, but how can I get the edge points?
// On Filters->Sobel edge detector
private void sobelEdgesFiltersItem_Click( object sender, System.EventArgs e )
{
// save original image
Bitmap originalImage = sourceImage;
// get grayscale image
sourceImage = Grayscale.CommonAlgorithms.RMY.Apply( sourceImage );
// apply edge filter
ApplyFilter( new SobelEdgeDetector( ) );
// delete grayscale image and restore original
sourceImage.Dispose( );
sourceImage = originalImage;
// this is the part where the source image is now edge detected. How to get the x,y for //each point of the edge?
sobelEdgesFiltersItem.Checked = true;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
过滤器只是顾名思义:过滤器(图像 -> 处理 -> NewImage)
我不知道是否有类似的边缘,但 AForge 有一个角检测器。我的示例加载图像,运行角检测器并在每个角周围显示红色小框。 (您需要一个名为“pictureBox”的 PictureBox 控件)。
它可能不完全是您正在寻找的东西,但也许它会有所帮助。
The filters are merely what the name suggests: Filters (Image -> Process -> NewImage)
I don't know, if there is something similar for edges, but AForge has a corner detector. My sample loads an image, runs the corner detector and displays little red boxes around every corner. (You'll need a PictureBox control named "pictureBox").
It might not be exactly what you're looking for, but maybe it helps.
您想要检测特定形状的边缘吗?因为如果是这样,您可以使用 BlobCounter 并推断出形状的坐标是什么。
希望这有帮助。
输入此内容后,我看到了问题的日期,但鉴于我已经输入了所有内容,我将发布它。希望这会对某人有好处。
Are the edges you want to detect from a certain shape? Because if so, you can use a BlobCounter and reason out what the coordinates of the shape are.
Hopefully this helps.
After typing this I saw the questions' date, but seeing as how I've already typed everything I'll just post it. Hopefully it will do good to someone.