简体   繁体   English

如何在EmguCV中更改反转帧?

[英]How to change invert frames in EmguCV?

Currently, I am working on a real-time IRIS detection application. 目前,我正在开发一个实时IRIS检测应用程序。

I want to perform an invert operation to the frames taken from the web camera, like this: 我想对从网络摄像头拍摄的帧执行反转操作,如下所示:

在此输入图像描述

I managed to get this line of code, but this is not giving the above results. 我设法得到这行代码,但这并没有给出上述结果。 Maybe parameters need to be changed, but I am not sure. 也许参数需要改变,但我不确定。

CvInvoke.cvThreshold(grayframeright, grayframeright, 160, 255.0, Emgu.CV.CvEnum.THRESH.CV_THRESH_BINARY_INV);

From the images above it feels that the second image is the negative of the first image(correct me if I am wrong), 从上面的图像中可以看出第二张图像是第一张图像的负片(如果我错了,请纠正我),

The function you are using is a threshold function,ie will render everything as white if it falls between the specified color range and other wise it will render it as black. 您正在使用的功能是阈值功能,即如果它落在指定的颜色范围之间,则将所有内容呈现为白色,否则将其呈现为黑色。

To find the negative of an image you can use one of the following methods. 要查找图像的否定,可以使用以下方法之一。

Taking the NOT of an image. 取图像的NOT。

 Image<Bgr, Byte> img2 = img1.Not();// imag1 can be a static image or your current captured frame

for more details you can refer the documentation here . 有关详细信息,请参阅此处的文档。

If you want to invert an image you can do the following: 如果要反转图像,可以执行以下操作:

Mat white = Mat::ones(grayframeright.rows, grayframeright.cols, grayframeright.type);
Mat dst = white - grayframeright;

Also note that pupil can be detected with OpenCV detector initialized with HAAR cascade for eyes that OpenCV code comes with. 另请注意,对于OpenCV代码附带的眼睛,使用HAAR级联初始化的OpenCV检测器可以检测到瞳孔。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM