任何人都可以告诉我sobel边缘检测的快速执行c#代码. [英] anyone please tell me the fast execting c# code for sobel edge detect..I am new to image processing
本文介绍了任何人都可以告诉我sobel边缘检测的快速执行c#代码.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我是图像处理的新手,请有人提出在c#中最快执行sobel边缘检测的方法.
我冲浪了很多,但是没有用....
在此先感谢....
hello,
I am new to the concept of image processing,please anyone suggest the fastest execution of sobel edge detection in c#.
I surfed a lot but no use....
thanks in advance....
推荐答案
这是一篇有关sobel边缘检测的好文章
使用C#和GDI +进行虚拟的傻瓜图像处理-第3部分-边缘检测过滤器 [
this is a good article for sobel edge detection
Image Processing for Dummies with C# and GDI+ Part 3 - Edge Detection Filters[^]
具有你看过OpenCV? opencv.willowgarage.com
不是C#,而是巨大的资源.与其尝试在C#中重做,不如考虑使用本机C/C ++ OpenCV东西,并根据需要从C#导入/链接到DLL API.可能不像C#那样友好,但是我相信它是快速可靠的.
Have you looked at OpenCV? opencv.willowgarage.com
Not C#, but a great resource. Rather than trying to redo things in C#, I''d probably consider using the native C/C++ OpenCV stuff and import / link to the DLL APIs from C# as required. Might not be quite as friendly as if it was all in C#, but I''d trust it to be fast and reliable.
感谢您的回复...
谁能告诉我如何将下面的代码转换为不安全的代码...
位图box1,box2;
int fxr,fyr,rr;
fxr = -1 * box1.GetPixel(i,j-1).R + box1.GetPixel(i,j).R-box1.GetPixel(i + 1,j).R + box1.GetPixel(i-1, j-1).R-box1.GetPixel(i-1,j + 1).R +
box1.GetPixel(i + 1,j + 1).R;
fyr = box1.GetPixel(i,j-1).R + box1.GetPixel(i-1,j).R + box1.GetPixel(i,j).R-box1.GetPixel(i-1,j + 1) ).R-box1.GetPixel(i + 1,j-1).R-box1.GetPixel(i + 1,j + 1).R;
rr = Math.Sqrt(Math.Abs(fxr * fxr)+ Math.Abs(fyr * fyr));
如果(rr< 0)rr = 0;
如果(rr> 255)rr = 255;
颜色cc = Color.FromArgb(Convert.ToInt32(rr),Convert.ToInt32(rr),Convert.ToInt32(rr));
box2.SetPixel(i,j,cc);
thanks for reply...
can anyone tell me how to convert below code into unsafe code...
Bitmap box1,box2;
int fxr,fyr,rr;
fxr = -1 * box1.GetPixel(i, j - 1).R + box1.GetPixel(i, j).R - box1.GetPixel(i + 1, j).R + box1.GetPixel(i - 1, j - 1).R - box1.GetPixel(i - 1, j + 1).R +
box1.GetPixel(i + 1, j + 1).R;
fyr = box1.GetPixel(i, j - 1).R + box1.GetPixel(i - 1, j).R + box1.GetPixel(i, j).R - box1.GetPixel(i - 1, j + 1).R - box1.GetPixel(i + 1, j - 1).R - box1.GetPixel(i + 1, j + 1).R;
rr = Math.Sqrt(Math.Abs(fxr * fxr) + Math.Abs(fyr * fyr));
if (rr < 0) rr = 0;
if (rr > 255) rr = 255;
Color cc = Color.FromArgb(Convert.ToInt32(rr), Convert.ToInt32(rr), Convert.ToInt32(rr));
box2.SetPixel(i, j, cc);
这篇关于任何人都可以告诉我sobel边缘检测的快速执行c#代码.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文