【问题标题】:No member named 'Blender' in namespace 'cv::detail' stitching.hpp error when using Simple Blob Detector使用简单 Blob 检测器时,命名空间“cv::detail”stitching.hpp 中没有名为“Blender”的成员
【发布时间】:2017-02-24 07:24:30
【问题描述】:

我正在尝试将 Simple Blog Detector 与 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

【问题讨论】:

    标签: c++ ios objective-c opencv uiimage


    【解决方案1】:

    简单的初学者错误。 OpenCV 文档明确声明将所有 OpenCV 语句置于任何 Apple 代码之前,以防止出现枚举错误。意思是确保将 opencv 导入语句放在 Obj C++ 导入头语句之前。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-13
      • 2012-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-25
      • 1970-01-01
      相关资源
      最近更新 更多