将图像从BGR更改为二进制图像0,1? [英] change Image from BGR to binary image 0,1?

查看:234
本文介绍了将图像从BGR更改为二进制图像0,1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道Emgu Cv是否有可能在我尝试将BGR更改为灰色时将图像从BGR转换为二进制图像

i wonder if it is possible with Emgu Cv to chnage image from BGR to binary image as i try to change the BGR to gray

 Image<Bgr, byte> image_pass = new Image<Bgr, byte>(bt1);


推荐答案

是的,有可能。
可以尝试一下:

Yes, it is possible. Maybe give this a try:

Image<Gray, Byte> image;
image = image_pass.convert<Gray,Byte>().ThresholdBinaryInv(new Gray(x), new Gray(255));
imageBox.Image(image);
CvInvoke.cvShowImage("binary", image); //To show in a new Window

其中 x 是您的阈值, 255 是最大值。
如果将阈值设置为 srcImage(x,y)>,则像素值将转换为0,否则将转换为255。
您显然可以更改阈值和最大值

Where x is your threshold value, and 255 the maximum value. This would convert the pixel value to 0 if the srcImage(x,y)> threshold or to 255, otherwise. You can, obviously, change the threshold and your max values

这篇关于将图像从BGR更改为二进制图像0,1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆