gpt4 book ai didi

c++ - cv::Max 中的错误?

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

要么我做错了什么,要么 cv::max 有问题。我以最明显的方式调用它:

#include<iostream>
#include<opencv2/opencv.hpp>

int main() {
cv::Mat t1 = cv::Mat::zeros(cv::Size(3,3), CV_8UC1);
cv::Mat t2 = cv::Mat::zeros(cv::Size(3,3), CV_8UC1);
cv::Mat t3;

cv::max(t1,t2,&t3);
return 0;
}

并获得:

In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iostream:38:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ios:216:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__locale:15:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:500:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string_view:176:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__string:56:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:2627:12: error:
called object type 'cv::Mat *' is not a function or function pointer
return __comp(__a, __b) ? __b : __a;
^~~~~~

目前在 OSX Mojave、AppleClang 10 上。OpenCV4.1.0。我很快就会尝试另一个设置。

最佳答案

基于their documentation中的函数定义

void cv::max(const Mat& src1,
const Mat& src2,
Mat& dst
)

我怀疑你调用的函数是错误的,通过使用 &t3 你传递了一个指向 cv::Mat 的指针(即 cv::Mat *)。该定义需要对 cv::Mat 的引用。删除 & cv::max(t1,t2,t3); 它应该可以编译。

关于c++ - cv::Max 中的错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55695300/

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