0

I have 2 Mat of 1 image with a little differences in some pixels. I want to find max for each pixel and show them. I wrote this code in Visual C++ 2010 (Console):

Mat dst;
max(result0, result1, dst);
imshow("dst", dst);

and the dst image was displayed perfectly, but when I copied this code in windows form I received this error: "error C2440: '?' : cannot convert from 'cv::MatExpr' to 'bool'" so I changed the code to this:

Mat dst;
max(&result0, &result1, &dst);
imshow("dst", dst);

but in run time this error was appeared: "An unhandled exception of type 'System.Runtime.InteropServices.SEHException' occurred in OpenCVProject.exe Additional information: External component has thrown an exception."

please help me to display the image. thanks in advance

4

3 回答 3

1

我也遇到了这个问题。我发现是minwindef.h导致了这个问题。所以你可以添加这个:</p>

#undef max
#undef min

在头文件下面(#include<...>),然后就可以成功使用cv::max了。

于 2015-12-10T04:56:10.113 回答
0

我认为存在名称空间冲突。尝试指定命名空间如下:

简历::最大值

于 2013-08-02T13:20:37.530 回答
0

正如 dekai 所建议的那样,添加了以下内容,但在 using 命名空间标头对我有用之后

#undef max
#undef min
于 2017-11-14T06:57:14.603 回答