gpt4 book ai didi

c++ - 未在此范围内声明的 Opencv 变量

转载 作者:行者123 更新时间:2023-11-28 03:03:48 27 4
gpt4 key购买 nike

我刚刚开始尝试 opencv。并在我的另一台电脑(有两台电脑)上成功运行了该程序。

我已经按照与已成功构建的计算机相同的安装步骤进行操作,但是在我完成 cmakemake 之后,它提示下面的错误消息是行不通的 构建项目。

在官方网站上测试这个例子: http://docs.opencv.org/doc/tutorials/imgproc/histograms/template_matching/template_matching.html#code

/home/howard/Documents/opencv/opencv-sample/template_match/template_match.cpp:11:22: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
char* image_window = "Source Image";
^
/home/howard/Documents/opencv/opencv-sample/template_match/template_match.cpp:12:23: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
char* result_window = "Result window";
^
/home/howard/Documents/opencv/opencv-sample/template_match/template_match.cpp: In function ‘int main(int, char**)’:
/home/howard/Documents/opencv/opencv-sample/template_match/template_match.cpp:28:30: error: ‘CV_WINDOW_AUTOSIZE’ was not declared in this scope
namedWindow( image_window, CV_WINDOW_AUTOSIZE );
^
/home/howard/Documents/opencv/opencv-sample/template_match/template_match.cpp:32:26: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
char* trackbar_label = "Method: \n 0: SQDIFF \n 1: SQDIFF NORMED \n 2: TM CCORR \n 3: TM CCORR NORMED \n 4: TM COEFF \n 5: TM COEFF NORMED";
^
/home/howard/Documents/opencv/opencv-sample/template_match/template_match.cpp: In function ‘void MatchingMethod(int, void*)’:
/home/howard/Documents/opencv/opencv-sample/template_match/template_match.cpp:68:24: error: ‘CV_TM_SQDIFF’ was not declared in this scope
if( match_method == CV_TM_SQDIFF || match_method == CV_TM_SQDIFF_NORMED )
^
/home/howard/Documents/opencv/opencv-sample/template_match/template_match.cpp:68:56: error: ‘CV_TM_SQDIFF_NORMED’ was not declared in this scope
if( match_method == CV_TM_SQDIFF || match_method == CV_TM_SQDIFF_NORMED )
^
make[2]: *** [CMakeFiles/template_match.dir/template_match.cpp.o] Error 1
make[1]: *** [CMakeFiles/template_match.dir/all] Error 2
make: *** [all] Error 2

有人知道发生了什么吗?我该如何解决?

最佳答案

我发现问题了,因为我安装了一个不稳定的版本,你不应该从 repo 安装 opencv https://github.com/Itseez/openc/直接转到发布版本并下载最新版本。

关于c++ - 未在此范围内声明的 Opencv 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20159579/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com