change Image from BGR to binary image 0,1?

2019-09-17 03:49发布

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);

标签: c# emgucv
1条回答
我想做一个坏孩纸
2楼-- · 2019-09-17 04:25

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

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

查看更多
登录 后发表回答