Ask Your Question

hjiang1's profile - activity

2017-03-29 12:55:22 -0600 received badge  Scholar (source)
2017-03-28 21:16:34 -0600 asked a question Feature extraction with variable backgrounds

I am trying to create an iOS app that is able to recognize simple hand gestures. I am currently using SURF, Bag-of-words, and SVMs to do this. I trained my SVM in bright lighting with a blank (white) background, and my app currently works when used in similar environments. I want it to be able to work with any background. For example, it doesn't work when I use it in my school's lab, which has pipes running along the ceiling (i.e. the background).

I thought about using the BackgroundSubtractorMOG algorithm to remove the background, but I don't know how effective that will be, since over time the algorithm relegates the center of the hand to the background, since it doesn't look it is moving.

How can I get my feature extraction and classifier working with variable backgrounds?

2017-03-28 21:10:18 -0600 received badge  Enthusiast
2017-03-27 12:45:13 -0600 answered a question iOS: Trouble initializing BOWImgDescriptorExtractor as top level variable

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
}
2017-03-23 21:39:16 -0600 commented question iOS: Trouble initializing BOWImgDescriptorExtractor as top level variable

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

2017-03-23 21:39:15 -0600 asked a question 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
}