2016-10-14 1 views
0

Simple Blog DetectorをSwiftとOpenCV Objective C++ラッパーとOpenCV 3.1.0 for iOS 。しかし、いくつかのエラーが発生しています。私はstitching.hppを使用していることを暗示しているので、私はそれらを理解していませんが、私はそうではありません。助言がありますか?私はなぜそれがステッチングのブレンダーと露出補正を呼び出すのか分かりません。 Simple Blob Detectorを使用している場合、ネームスペース 'cv :: detail'の 'Blender'という名前のメンバーがstitching.hppエラーを受け取りました

エラー

はありません:名前空間の「ExposureCompensator」「のcv ::詳細」stitching.hppと名付けられませメンバー:名前空間の「ブレンダー」という名前のないメンバー

ヘッダだった「CV ::詳細」stitching.hpp私はもともとParse Issuesをマクロ内のExpected Identifier 'NO'から取得していたので、最初に追加されました。これらのヘッダーを追加することで、ソースファイルで推奨されているようにParse Issuesを削除しましたが、上記のように新しいエラーが発生しました。

#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 

答えて

4

シンプルな初心者ミス。 OpenCVのドキュメントには、すべてのOpenCV文をすべてのAppleコードに置き、列挙エラーを防ぐことが明記されています。つまり、Obj C++ import header文の前にopencv import文を置くことです。

関連する問題