change Image from BGR to binary image 0,1?

試著忘記壹切 提交于 2019-12-12 01:59:33

问题


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

回答1:


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



来源:https://stackoverflow.com/questions/26874326/change-image-from-bgr-to-binary-image-0-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!