Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I was able to solve the issue. I initialized the BOWImgDescriptorExtractor as a pointer and used the OpenCV function makePtr in my viewDidLoad. Here's the code, hopefully it can help someone in the future.

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

ImageProc *imgProc = [[ImageProc alloc] init];
Ptr<BOWImgDescriptorExtractor> bowDE;
Ptr<SVM> svm;

#pragma mark - System methods
- (void)viewDidLoad {
    [super viewDidLoad];

    bowDE = makePtr<BOWImgDescriptorExtractor>([imgProc generateBOW]);

    svm = [imgProc generateSVM2: bowDE];
}

- (void)processImage:(Mat&)image {
    // I want to use bowDE here
}