使用Simple Blob Detector时,名称空间'cv :: detail'stitching.hpp中没有名为'Blender'的成员

bec*_*ckp 0 c++ opencv objective-c uiimage ios

我正在尝试使用Swift的Simple Blog Detector和适用于iOS的OpenCV Objective C++包装器和OpenCV 3.1.0.但是,我收到了几个错误.我不理解他们,因为他们暗示我正在使用stitching.hpp,但我不是.有什么建议?我无法弄清楚为什么它会调用stitching.hpp搅拌器和曝光补偿.

错误是:在名称空间'cv :: detail'suting.hpp中没有名为'ExposureCompensator'的成员和:名称空间'cv :: detail'中没有名为'Blender'的成员'stitching.hpp

标题添加到开头,因为我最初从宏中的预期标识符'否'获得解析问题.通过添加这些标头,我删除了源文件中建议的解析问题,但这导致了如上所述的新错误.

#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
Run Code Online (Sandbox Code Playgroud)

bec*_*ckp 6

简单的初学者错误.OpenCV文档明确规定将所有OpenCV语句置于任何Apple代码之前以防止枚举错误.这意味着确保将opencv import语句放在Obj C++ import header语句之前.