简体   繁体   English

CV_HAAR_SCALE_IMAGE 未在 Windows 上的 OpenCv4 中定义

[英]CV_HAAR_SCALE_IMAGE is not defined in OpenCv4 on windows

I am using OpenCv4 on windows , tried to run C++ code in visual Studio 2017, but it says that CV_HAAR_SCALE_IMAGE and CV_HOUGH_GRADIENT is not defined , some solutions suggested to use cv2 prefix but cv2 is not defined too , i am using Opencv4 and setup the path.我在 windows 上使用 OpenCv4,试图在 Visual Studio 2017 中运行 C++ 代码,但它说 CV_HAAR_SCALE_IMAGE 和 CV_HOUGH_GRADIENT 没有定义,一些解决方案建议使用 cv2 前缀但 cv2 也没有定义,我正在使用 Opencv4 并设置路径.



cv::Mat grayscale;
 cv::cvtColor(frame, grayscale, cv::COLOR_BGR2GRAY); // convert image to grayscale
 cv::equalizeHist(grayscale, grayscale); // enhance image contrast 
 std::vector<cv::Rect> faces;
 faceCascade.detectMultiScale(grayscale, faces, 1.1, 2, 0 | CV_HAAR_SCALE_IMAGE, cv::Size(150, 150));
 if (faces.size() == 0) return; // none face was detected


More Details更多细节

I'm trying to implement Mouse eyeball tracking for mouse control using code from this repo.我正在尝试使用此 repo 中的代码为鼠标控制实现鼠标眼球跟踪。 https://abnerrjo.github.io/blog/2017/01/28/eyeball-tracking-for-mouse-control-in-opencv/ https://abnerrjo.github.io/blog/2017/01/28/eyeball-tracking-for-mouse-control-in-opencv/

Currently it shows some variable as sytax error so i cant build目前它显示一些变量作为语法错误,所以我无法构建

in this function defination CV_HAAR_SCALE_IMAGE is says undefined在这个函数定义中CV_HAAR_SCALE_IMAGE表示未定义

also CV_HOUGH_GRADIENT was same but i changed it to cv::COLOR_BGR2GRAY and it works now CV_HOUGH_GRADIENT也是一样的,但我把它改成了cv::COLOR_BGR2GRAY并且它现在可以工作了

在此处输入图片说明

Additional modules added in project项目中添加的其他模块在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

It's now called CASCADE_SCALE_IMAGE or cv::CASCADE_SCALE_IMAGE if you aren't using the cv namespace.如果您不using cv 命名空间,它现在称为 CASCADE_SCALE_IMAGE 或 cv::CASCADE_SCALE_IMAGE。 I think that change was with OCV 3.我认为这种变化发生在 OCV 3 上。

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

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