From: Dhoto <dh...@ao...> - 2004-05-26 05:40:05
|
i have this source, when i compiled it success, but when i run it, octave can not define this command mex vqlabel.c dhoto@earth:~> mex vqlabel.c building vqlabel.c + mkoctfile -DHAVE_OCTAVE_21 -v -o vqlabel.oct mex_vqlabel.cc /usr/octave-forge/mex.o -I/usr/octave-forge vqlabel.c gcc -c -fPIC -I/usr//include/octave-2.1.57 -I/usr//include/octave-2.1.57/octave -I/usr//include -g -O2 -I/usr/octave-forge -DHAVE_OCTAVE_21 vqlabel.c -o vqlabel.o g++ -c -fPIC -I/usr//include/octave-2.1.57 -I/usr//include/octave-2.1.57/octave -I/usr//include -g -O2 -I/usr/octave-forge -DHAVE_OCTAVE_21 mex_vqlabel.cc -o mex_vqlabel.o g++ -shared -o vqlabel.oct /usr/octave-forge/mex.o vqlabel.o mex_vqlabel.o -L/usr//lib/octave-2.1.57 -loctinterp -loctave -lcruft -llapack -lblas -lfftw3 -lreadline -lncurses -ldl -lhdf5 -lz -lm -L/usr/lib64/gcc-lib/x86_64-suse-linux/3.3.1 -L/usr/lib64/gcc-lib/x86_64-suse-linux/3.3.1/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc-lib/x86_64-suse-linux/3.3.1/../../../../lib64 -L/usr/lib64/gcc-lib/x86_64-suse-linux/3.3.1/../../.. -L/lib/../lib64 -L/usr/lib/../lib64 -lhdf5 -lz -lfrtbegin -lg2c -lm -lgcc_s vqlabel.c #include "mex.h" void mexFunction(int nlhs, mxArray *plhs[ ], int nrhs, const mxArray *prhs[ ]) { int N_center; int y1,y2,x1,x2; int height,width; int i,c,t,y,x,min; double *CENTER,*C1,*C2,*C3,*X1,*X2,*D,*I_vq; double V1,V2,V3,V4,V5; height = mxGetM(prhs[0]); width = mxGetN(prhs[0]); C1 = mxGetPr(prhs[0]); C2 = mxGetPr(prhs[1]); C3 = mxGetPr(prhs[2]); X1 = mxGetPr(prhs[3]); X2 = mxGetPr(prhs[4]); y1 = (int)*mxGetPr(prhs[5]); x1 = (int)*mxGetPr(prhs[6]); y2 = (int)*mxGetPr(prhs[7]); x2 = (int)*mxGetPr(prhs[8]); N_center = mxGetM(prhs[9]); CENTER = mxGetPr(prhs[9]); I_vq = (double *) mxMalloc(height*width*sizeof(double)); D = (double *) mxMalloc(N_center*sizeof(double)); for (i=0; i<height*width; i++) I_vq[i] = 0; for (y=y1; y<=y2; y++) for (x=x1; x<=x2; x++) { c = (x-1)*height+y-1; for (i=0; i<N_center; i++) { V1 = (CENTER[i]-C1[c]); t = i+N_center; V2 = (CENTER[t]-C2[c]); t += N_center; V3 = (CENTER[t]-C3[c]); t += N_center; V4 = (CENTER[t]-X1[c]); t += N_center; V5 = (CENTER[t]-X2[c]); D[i] = V1*V1+V2*V2+V3*V3+V4*V4+V5*V5; } min = 0; for (i=1; i<N_center; i++) if (D[i]<D[min]) min = i; I_vq[c] = min+1; } plhs[0] = mxCreateDoubleMatrix(height,width,mxREAL); mxSetPr(plhs[0],I_vq); } Thank you -- Best regard, Dhoto ----------------------------------------{@ dh...@ao... |