我想在MATLAB中實現「基於GrabCut的對象分割技術」方法。爲了使馬爾科夫隨機場能量函數最小化,我使用了這裏提供的標準最大流/最小切割算法:http://vision.csd.uwo.ca/code/以最大流/最小切割算法鏈接mex文件時出錯
問題:當我嘗試創建一個mex文件來調用圖創建和最小化在MATLAB中,我得到以下錯誤:
Undefined symbols: "Graph::Graph(int, int, void ()(char))", referenced from: _mexFunction in GraphTest.o
ld: symbol(s) not found collect2: ld returned 1 exit status
mex: link of ' "GraphTest.mexmaci64"' failed.
我的代碼是真的很簡單,只是複製自述文件中提到的代碼的部分內容如下:
#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'(或其他實現此類的文件)? – 2011-05-02 06:56:25
謝謝艾塔瑪。我只是使用「mex GraphTest.cpp」編譯。 – 2011-05-02 21:56:37