Problem with xcode and iOS 12
Hello Guys,
I want to use opencv in my iOS app only I have a problem there.
The OpenCV version: 3.4.3
My Class ImageDetection.mm
#ifdef __cplusplus
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
#import <opencv2/opencv.hpp>
#import <opencv2/imgcodecs/ios.h>
#include "ImageDetection.h"
#pragma clang pop
#endif
using namespace cv;
using namespace std;
#pragma mark - ImageDetection
@implementation ImageDetection
#pragma mark Public
+ (BOOL)processImage:(UIImage *)source {
UIImage *tplImg = [UIImage imageNamed:@"item1"];
cv::Mat tpl;
cv::Mat gtpl;
UIImageToMat(tplImg, tpl);
cv::cvtColor(tpl, gtpl, CV_BGR2GRAY);
cv::Mat img;
cv::Mat gimg;
UIImageToMat(source, img);
cv::cvtColor(img, gimg, CV_BGR2GRAY);
cv::Mat res(img.rows-gtpl.rows+1,gtpl.cols-gtpl.cols+1, CV_32FC1);
cv::matchTemplate(gimg, gtpl, res, CV_TM_CCOEFF_NORMED);
cv::threshold(res, res, 0.5, 1., CV_THRESH_TOZERO);
double minval, maxval, threshold = 0.9;
cv::Point minloc, maxlog;
cv::minMaxLoc(res, &minval, &maxval, &minloc, &maxlog);
// If is´s a enought match
if (maxval >= threshold) {
return YES;
}
return NO;
}
@end
and xcode say
Analyze ImageDetection.mm
In file included from /Users/default/Desktop/iOS Projects/Reader/Reader/Frameworks/OpenCV/ImageDetection.mm:13:
In file included from /Users/default/Desktop/iOS Projects/Reader/opencv2.framework/Headers/opencv.hpp:62:
In file included from /Users/default/Desktop/iOS Projects/Reader/opencv2.framework/Headers/dnn.hpp:76:
In file included from /Users/default/Desktop/iOS Projects/Reader/opencv2.framework/Headers/dnn/dnn.hpp:914:
/Users/default/Desktop/iOS Projects/Reader/opencv2.framework/Headers/dnn/dnn.inl.hpp:280:5: error: use of undeclared identifier 'CV_ErrorNoReturn'
CV_ErrorNoReturn(Error::StsInternal, "");
^
1 error generated.
Command Analyze failed with a nonzero exit code
I wonder where the mistake is.
With kind regards CrafterGamer
Are you using cocoapods?
No not use cocoapods. Import this in project folder. An older version working, The new version not working.
Have you been able to solve this ? I noticed that although the project does not build, it runs ok.