学习图像处理知识---Emgu3.4 image类学习(六)

本文介绍了如何使用EmguCv3.4库进行图像处理,特别是二值化操作。通过实例展示了阀值处理在二值化中的应用,包括普通二值化、反变二值化、阈值截断,以及自适应阀值技术,帮助读者深入理解并实践图像处理技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

阀值处理-----一般应用在二值化上

其他颜色也是可以应用。

以下会生产新的图像。

public Image<TColor, TDepth> ThresholdAdaptive(
	TColor maxValue,
	AdaptiveThresholdType adaptiveType,
	ThresholdType thresholdType,
	int blockSize,
	TColor param1
)
public Image<TColor, TDepth> ThresholdBinary(
	TColor threshold,  
	TColor maxValue
)
public Image<TColor, TDepth> ThresholdBinaryInv(
	TColor threshold,
	TColor maxValue
)
public Image<TColor, TDepth> ThresholdToZero(  //低于值全为0
	TColor threshold
)
public Image<TColor, TDepth> ThresholdToZeroInv( TColor threshold)
//高于值全为255
public Image<TColor, TDepth> ThresholdTrunc(
	TColor threshold      //大于阀值,变成阀值
)
以下是对本图片进行处理:请注意!跟上面是一样模式。
public void _ThresholdBinary(
	TColor threshold,
	TColor maxValue
)
public void _ThresholdBinaryInv(
	TColor threshold,
	TColor maxValue
)
public void _ThresholdToZero(
	TColor threshold
)

public void _ThresholdToZeroInv(
	TColor threshold
)
public void _ThresholdTrunc(
	TColor threshold
)

实例练习学习

 Emgu.CV.Image<Gray,byte> GAY1 = new Image<Gray, byte>((Bitmap)pictureBox2.Image);
            pictureBox5.Image = GAY1.ThresholdBinary(new Gray((int)numericUpDown1.Value), new Gray(250)).Bitmap;
            pictureBox4.Image = GAY1.ToBitmap(); //灰度图片

 反变二值化

Emgu.CV.Image<Gray,byte> GAY1 = new Image<Gray, byte>((Bitmap)pictureBox2.Image);

            pictureBox5.Image = GAY1.ThresholdBinaryInv(new Gray((int)numericUpDown1.Value), new Gray(250)).Bitmap;
            pictureBox4.Image = GAY1.ToBitmap();


             pictureBox4.Image = GAY1.ToBitmap();
            pictureBox5.Image = GAY1.ThresholdToZero(new Gray((int)numericUpDown1.Value)).Bitmap;

          pictureBox4.Image = GAY1.ToBitmap();

            pictureBox5.Image = GAY1.ThresholdToZeroInv(new Gray((int)numericUpDown1.Value)).Bitmap;


           pictureBox4.Image = GAY1.ToBitmap();

            pictureBox5.Image = GAY1.ThresholdTrunc(new Gray((int)numericUpDown1.Value)).Bitmap;


自适应阀值

 pictureBox2.Image=YUAN.Convert<Gray,Byte>().ThresholdAdaptive(newGray(250), Emgu.CV.CvEnum.AdaptiveThresholdType.GaussianC,Emgu.CV.CvEnum.ThresholdType.Binary,3,new Gray(0)).ToBitmap();



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值