【发布时间】:2011-05-02 04:08:00
【问题描述】:
我正在尝试在 MATLAB 中实现“基于 GrabCut 的对象分割技术”方法。为了最小化马尔可夫随机场能量函数,我使用这里提供的标准 Max-flow/min-cut 算法:http://vision.csd.uwo.ca/code/
问题:当我尝试在 MATLAB 中创建 mex 文件来调用 Graph 创建和最小化函数时,出现以下错误:
未定义的符号: “Graph::Graph(int, int, void ()(char))”,引用自: _mexFunction in GraphTest.o
ld: 未找到符号 collect2: ld 返回 1 个退出状态
mex: '"GraphTest.mexmaci64"' 的链接失败。
我的代码真的很简单,只是复制了README文件中提到的部分代码如下:
#include "mex.h"
#include <stdio.h>
#include <math.h>
#include "graph.h"
void mexFunction(int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[])
{
typedef Graph<int, int, int> GraphType;
GraphType *g = new GraphType(/*estimated # of nodes*/ 2, /*estimated # of edges*/1);
}
如果任何曾经使用过此软件包或遇到过类似错误的人能够提供一些关于该问题的见解,我将不胜感激。
提前致谢!
【问题讨论】:
-
您使用什么编译器/链接器?你能提供你用来编译/链接的命令吗?此外,您是否编译并链接到
Graph.cpp(或任何其他实现该类的文件)? -
谢谢伊塔玛。我只是使用“mex GraphTest.cpp”进行编译。
标签: matlab computer-vision mex image-segmentation