经过阀值处理后,我们开始进行图像边缘检测和分离。
public Image<TColor, float> Sobel( int xorder, //X方向 int yorder, //Y方向 int apertureSize //一定为奇数1.3.5.7等 )Emgu.CV.Image<Bgr, Byte> YUAN = new Image<Bgr, Byte>((Bitmap)pictureBox1.Image);
pictureBox2.Image = YUAN.Convert<Gray, Byte>().Sobel(1,0, 11).ToBitmap();
public Image<TColor, float> Laplace( int apertureSize //最大不能超过5 )
pictureBox2.Image = YUAN.Laplace(5).ToBitmap(); //最大不能超过5
Canny 边缘检测 ---注意一定要为灰图图像
public Image<Gray, byte> Canny( double thresh, double threshLinking )
public Image<Gray, byte> Canny( double thresh, double threshLinking, int apertureSize, //3-7之间,超过会报错 bool l2Gradient )
pictureBox2.Image = YUAN.Convert<Gray, Byte>().Canny(180, 250,5,true).ToBitmap();
pictureBox1.Image = YUAN.Convert<Gray, Byte>().Bitmap;