我正在尝试使用Swift的简单博客检测器和OpenCV Objective C++包装器以及iOS的OpenCV 3.1.0。然而,我得到了几个错误。我不理解他们,因为他们暗示我在使用stitching.hpp,但我没有。有什么建议吗?我不明白为什么它会调用stitching.hpp搅拌器和曝光补偿。
错误是:在命名空间'cv::detail‘stitching.hpp中没有名为'ExposureCompensator’的成员,在命名空间'cv::detail‘stitching.hpp中没有名为'Blender’的成员
头被添加到开头,因为我最初从宏中的预期标识符‘NO’中得到解析问题。通过添加这些头文件,我删除了源文件中建议的解析问题,但如上所述,这会导致新的错误。
#ifndef OPENCV_STITCHING_BLENDERS_HPP
#define OPENCV_STITCHING_BLENDERS_HPP
#if defined(NO)
#warning Detected Apple 'NO' macro definition, it can cause build conflicts. Please, include this header before any Apple headers.
#endif
#ifndef OPENCV_STITCHING_EXPOSURE_COMPENSATE_HPP
#define OPENCV_STITCHING_EXPOSURE_COMPENSATE_HPP
#if defined(NO)
#warning Detected Apple 'NO' macro definition, it can cause build conflicts. Please, include this header before any Apple headers.
#endif
#import "OpenWrapper.h"
#import <opencv2/opencv.hpp>
#import <opencv2/core/core.hpp>
#import <opencv2/imgcodecs/ios.h>
#import <opencv2/imgproc.hpp>
using namespace std;
using namespace cv;
@implementation OpenWrapper
+(UIImage *) makeGrayscale:(UIImage *)myImage{
// Convert UIImage to Mat
Mat imageMat;
UIImageToMat(myImage, imageMat);
// Convert from color to grayscale image
Mat graymat;
cvtColor(imageMat, graymat, CV_BGR2GRAY);
// Set up Simple Blob Parameters
SimpleBlobDetector::Params params;
params.minThreshold = 10;
params.maxThreshold = 200;
params.filterByArea = true;
params.minArea = 1500;
params.filterByCircularity = true;
params.minConvexity = 0.87;
params.filterByInertia = true;
params.minInertiaRatio = 0.01;
// Creat dectector with keypoints
vector<KeyPoint> keypoints;
Ptr<SimpleBlobDetector> detector = SimpleBlobDetector::create(params);
detector->detect(graymat, keypoints);
// Mat im_with_keypoints;
Mat im_with_keypoints;
drawKeypoints(graymat, keypoints, im_with_keypoints, Scalar(0,0,255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
// Show blobs
imshow("keypoints", im_with_keypoints );
waitKey(0);
// Output results as UIIMage
return MatToUIImage(graymat);
}
#endif
#endif
@end发布于 2016-10-15 04:51:54
简单的初学者错误。OpenCV文档清楚地声明将所有OpenCV语句放在任何苹果代码之前,以防止枚举错误。这意味着要确保将opencv import语句放在Obj C++导入标题语句之前。
https://stackoverflow.com/questions/40050326
复制相似问题