I am working on a project, where I need to merge to images. These images are being printed, that means intensity 255 is the background. To merge the two images I wanted to use cv::min(const Mat& src1, const Mat& src2, Mat& dst), because that would give me always the correct gray scale value and I wouldn’t have to use a weighted add function. Starting from yesterday, neither the compiler, nor IntelliSense picks up on that function. Is this function not implemented in 4.10.0? This is a completely strange behaviour and I have no clue how to solve this.
This is my code:
std::string img1 = “D:\Test Tif\test1.png”;
std::string img2 = “D:\Test Tif\test2.png”;
std::string img3 = “D:\Test Tif\test3.png”;
cv::Mat m1 = cv::imread(img1, cv::ImreadModes::IMREAD_GRAYSCALE);
cv::Mat m2 = cv::imread(img2, cv::ImreadModes::IMREAD_GRAYSCALE);
cv::Mat m3 = cv::imread(img3, cv::ImreadModes::IMREAD_GRAYSCALE);
cv::Mat dst;
cv::min(m1, m2, dst); ← this does not work, says it’s the wrong parameters and only finds “#define min(a,b) as valid function.
If someone could point me to something I am doing wrong, that would be great. I know, this question may has been asked before, but I have no further ideas how to search for “function xy not recognized by compiler”.
To me it looks if the header is missing the whole function, but when I look into the header, it’s defined and should be working.
please don’t use negations in questions. that makes them impossible to answer to without misunderstandings or being painfully verbose.
your implication is incorrect. these functions have always been there. they have not been removed. any issue you experience is due to how you told (or didn’t tell) your Visual Studio where to find the parts of the library that you need. or maybe your own source code does something wrong.
the issue is not with OpenCV.
the issue is with whatever you changed about your Visual Studio environment.
did you upgrade OpenCV? you imply this but did not state it. if you didn’t change the OpenCV library, then you wouldn’t have suggested the issue to be related to any version or change of version.
all you said is that “over night” things stopped working. what happened? what did you do?
your code snippet is too little to debug. you should present a proper MRE. present the error messages and state where they came from (compiler or intellisense).
this forum is not made for generic tool support (visual studio). some of us may be able to help with your choice of IDE/build environment but we aren’t experts on Visual Studio. you are most likely to receive help in a place that specializes in learning to use Visual Studio.
OMG. I am a moron and I deeply apologize for asking this question. I have found the culprit:
Order of includes matter (I didn’t know that). Over the last 4 hours I first discovered, that windows.h is causing my problem. After I found this to be the problem, I started to move that include around in my .cpp and it resolved my issue.
thanks for posting the results of your investigation. #include order and Windows.h being a factor in this issue will probably help someone else in the future.