iPhone 的 OpenCV / SURF 跟踪:创建结构时值错误
我正在使用 Objective-C 中的 OpenCV 库(交叉编译),它基本上工作得很好。
不幸的是,当使用 find_obj.cpp 中找到的示例时,我得到了 CvSURFParams 的奇怪值,必须将其作为参数传递给 cvExtractSURF 功能。
features2d.hpp (openCV 的一部分):
typedef struct CvSURFParams
{
int extended;
double hessianThreshold;
int nOctaves;
int nOctaveLayers;
} CvSURFParams;
surf.cpp (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 (我的主视图控制器):
CvSURFParams params = cvSURFParams(500, 1);
之后调用ViewController.mm中的cvSURFParams函数,参数值为:
extended = (int) 1
hessianThreshold = (double) 0
nOctaves = (int) 1082081280
nOctaveLayers = (int) 4
修正hessianThreshold的值,一旦我将params传递给我的cvExtractSURF,ViewController.mm中的nOctaves,..就没有帮助函数,在 surf.cpp 中调试此函数时出现错误值:
extended = (int) 1
upright = (int) 0
hessianThreshold = (double) 500
nOctaves = (int) 4
nOctaveLayers = (int) 0
有人可以帮忙吗?
提前致谢,
--斯蒂芬
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来 OpenCV 中结构的表示与 ViewController.mm 的表示方式不同。要么 hessianThreshold 大小不同,要么存在对齐问题。需要检查的一些事项:
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: