在实际的运用中,图像的边缘检测和轮廓提取很重要。
public Image<TColor, float> Sobel( int xorder, int yorder, int apertureSize )其中xorder为X方向的一阶,yorder为y方向的一阶,apertureSize为卷积大小,只能为1,3,5,7;不能为其他的。拉普拉斯算子
public Image<TColor, float> Laplace( int apertureSize )其中apertureSize为正奇数1,3,5,7
public Image<Gray, byte> Canny( double thresh, double threshLinking, int apertureSize, bool l2Gradient )//其中thresh,threshLinking,两个阈值--高阈值与低阈值。其中apertureSize为正奇数1,3,5,7,l2Gradient为TRUE或flase.
在CvInvoke中也是类似:
public static void Canny( IInputArray image, IOutputArray edges, double threshold1, double threshold2, int apertureSize = 3, bool l2Gradient = false )
进行实例练习:Emgu.CV.Image<Bgr, Byte> YUAN = new Image<Bgr, Byte>((Bitmap)pictureBox1.Image);
// pictureBox2.Image = YUAN.Convert<Gray, Byte>().Canny(180,250).ToBitmap();
//pictureBox2.Image = YUAN.Convert<Gray, Byte>().Canny(180, 250,5,true).ToBitmap();
//pictureBox1.Image = YUAN.Convert<Gray, Byte>().Bitmap;
pictureBox2.Image = YUAN.Canny(120,180, 5, true).Bitmap;
pictureBox2.Image=YUAN.Sobel(1,0,3).Bitmap;
pictureBox2.Image = YUAN.Laplace(3).Bitmap;