I'm using the OpenCV library in Objective-C (cross-compiled), which works fine basically.
Unfortunately, when using the example which can be found in find_obj.cpp, I get strange values for the CvSURFParams that has to be passed as an argument to the cvExtractSURF function.
features2d.hpp (part of openCV):
typedef struct CvSURFParams
{
int extended;
double hessianThreshold;
int nOctaves;
int nOctaveLayers;
} CvSURFParams;
surf.cpp (part of openCV):
CvSURFParams cvSURFParams(double threshold, int extended)
{
CvSURFParams params;
params.hessianThreshold = threshold;
params.extended = extended;
params.upright = 0;
params.nOctaves = 4;
params.nOctaveLayers = 2;
return params;
}
ViewController.mm (my main view controller):
CvSURFParams params = cvSURFParams(500, 1);
After calling the cvSURFParams function in ViewController.mm, the valus of params are:
extended = (int) 1
hessianThreshold = (double) 0
nOctaves = (int) 1082081280
nOctaveLayers = (int) 4
Correcting the values for hessianThreshold, nOctaves, .. in ViewController.mm doesn't help, as soon as I pass params to my cvExtractSURF function, the wrong values appear when debugging this function in surf.cpp:
extended = (int) 1
upright = (int) 0
hessianThreshold = (double) 500
nOctaves = (int) 4
nOctaveLayers = (int) 0
Can anyone help please?
Thanks in advance,
-- Stephan
It sounds like the representation of the structure in OpenCV is different from how your ViewController.mm represents it. Either hessianThreshold is a different size, or else there is an alignment problem. Some things to check: