iOS: Trouble initializing BOWImgDescriptorExtractor as top level variable
Hi, I have a function generateBOW that returns a working BOWImgDescriptorExtractor. I want to set this as a top level variable in my ViewController.mm so that I can use it in another method (not viewDidLoad), but when I try, I am getting this error message: No matching constructor for cv::BOWImgDescriptorExtractor.
I tried just calling the function at the top level (outside of viewDidLoad), but it gave me this runtime error: Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)
How should I initialize bowDE so can I create the object with my function? Here is my code:
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
ImageProc *imgProc = [[ImageProc alloc] init];
BOWImgDescriptorExtractor bowDE; //Error here
Ptr<SVM> svm;
#pragma mark - System methods
- (void)viewDidLoad {
[super viewDidLoad];
bowDE = [imgProc generateBOW];
svm = [imgProc generateSVM2: bowDE];
}
- (void)processImage:(Mat&)image {
// I want to use bowDE here
}
I tried making bowDE a pointer, and I get no compile errors, but I still run into the same runtime error: Thread 1: EXC_BAD_ACCESS (code=1, address=0x40