상세 컨텐츠

본문 제목

Matlab/r2012a/mexopts.sh For Mac

카테고리 없음

by udwhimecam1989 2020. 2. 14. 19:00

본문

  1. Matlab/r2012a/mexopts.sh For Mac
  2. Matlab R2012a Crack Download
  3. Matlab/r2012a/mexopts.sh For Mac Os

Affine and B-spline grid based registration and data-fitting of two 2D color/grayscale images or 3D volumes or point-data. Registration can be done intensity / pixel based, or landmark / corresponding points based (See OpenSurf), or a combination. Description Pixel-based registration: This function is an (enhanced) implementation of the b-spline registration algorithm in D.

Once MATLAB updates the option files, we are done with our compiler selection. G For Mac OS X, /Users/MyName/.matlab/R2012a/mexopts.sh.

Rueckert et al. 'Nonrigid Registration Using Free-Form Deformations: Application to Breast MR Images'.

Including the smoothness penalty of Rueckert (thin sheet of metal bending energy), and Jacobian (diffeomorphic) function. Also including, localized normalized mutual information as registration error, allowing the images or volumes to be of a different type/modality for instance a MRI T1 and T2 patient scan.

How it works: A grid of b-spline control points is constructed which controls the transformation of an input image. An error measure is used to measure the registration error between the moving and static image. The quasi newton Matlab optimizer fminlbfgs (also on Mathworks) is used to move the control points to achieve the optimal registration between both images with minimal registration error. Usage: - The function imageregistration.m is easy to use, and contains examples in the help, and will fit most applications. (If you want to write your own specialized registration code study the registration examples) - The function pointregistration is fast fitting of a b-spline grid to 2D/3D corresponding points, for landmark based registration.

Matlab/r2012a/mexopts.sh

There is also the function manuallywarpimages which allow control grid changes with the mouse, to get better registration. First, you need to compile mex / C code with compilecfiles.m. (2D registration also works without mex files but will be slower) The multi-threaded mex code supports Windows, Linux (and Mac OS?) Some Features: - 2-D / 3-D Eulerian strain tensor images can be made from the transformations fields.

For example to describe cardiac motion in the images. Landmarks can be used for already known corresponding points (for example from Sift). Influence of every landmark on the registration process can be adjust.

It is possible to register a number of movie frames by using the registration grid of previous two images as initial registration grid of the next two images. It is possible to mask parts of the images, to decrease or increase the influence of an image structure on the registration result.

Literature: - D. Rueckert et al. 'Nonrigid Registration Using Free-Form Deformations: Application to Breast MR Images'. Seungyong Lee, George Wolberg, and Sung Yong Shing, 'Scattered Data interpolation with Multilevel B-splines' note: - B-spline registration is slower and more complex than demon registration see: - Why still use B-spine registration?, because the resulting transformation-field corresponds better to real-live deformation than transformation fields from fluid registration. Please report bugs, successes and questions. Hello, very nice code.could this be applied to point clouds?

Also the 3D example does not work for me? Error message: Error using imgaussian Requested 254760 (4.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive.

See array size limit or preference panel for more information. Error in example3dnonrigid (line 37) I1s=imgaussian(I1,1.3,6 6 6); Thank you. Best Regards.

I got the same issue. Error using affinetransform2ddouble Requested 23584257 (4.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information. UPDATE: The compiler issue below can be traced to virus scan software. Moving the compiler task to a removable drive (not monitored as closely by virus scan) solved the compiler problem. However, the program is now demanding absurdly large matricies for the examples provided in help documentation.

Prostate example gives the following error. Again, any help is appreciated: Error using affinetransform2ddouble Requested 204413953 (4.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information. I apologize in advance for my illiteracy when it comes to compiling.c files in MATLAB, but any help is much appreciated. In R2017a, using Microsoft Windows SDK 7.1, I get the following error when running compilecfiles.m: Error using mex Microsoft (R) Manifest Tool version 6.1.7716.0 Copyright (c) Microsoft Corporation 2009.

All rights reserved. Mt: general error c101008d: Failed to write the updated manifest to the resource of file 'bsplineerror2ddouble.mexw64'. The operation failed. Error in compilecfiles (line 8) mex(filename,'imageinterpolation.c','-v'). I need your help to know where landmark point would be after the nonregid registration. Let us consider the point currentcentroid=69 884 let say. I run the nonrigid registration and found U1 and U2 as follows Ireg,Otrans,Spacing,M,B,F=imageregistration(Imoving,Istatic); XM YM=ndgrid(0:size(im1,1)-1,0:size(im1,1)-1); U1=B(:,:,1)-XM; U2=B(:,:,2)-YM; How do I get use of U1 and U2 to see where my currentcentroid is after registration.

I tried currentcentroidnew(i,:) = currentcentroid(i,:)+U1(round(currentcentroid(i,1))) U2(round(currentcentroid(i,2))); but is not worrking. Thank you for your help. Thank you very much for this contribution, Drik-Jan! It is very helpful. I am using it to register a stack of images from angiography video.

I find the non-rigid transformation as O-trans for each pair of consecutive images. Now I would like to register all the images (the whole stack consisting of 14 images) into a common frame. I tried to use the registration grid of previous two images as initial registration grid of the next two images but I didn't succeed. Maybe I didn't define the registration grid correctly. Could you please help me how can I transform all the images into a common coordinate system? Thank you for this contribution, Dirk-Jan. I am having issues when using masks.

Indeed, I get an error in the subfunction registrationerrormutualinfo of imagedifference.m. The problematic block of code is the following:% Remove unmasked pixels if(isempty(Mask)), sizes=size(V); V=V(:); V(Mask)=; U=U(:); U(Mask)=; if(isempty(V)), t=0; I=; return, end V=reshape(V,sizes); U=reshape(U,sizes); end reshape throws the error: 'To RESHAPE the number of elements must not change.' Indeed, you are removing elements from an array V(Mask)=; and U(Mask)=; but then later you want this arrays to retain their original size: V=reshape(V,sizes); U=reshape(U,sizes); I will try to see how to solve this, but I first wanted to give you heads up. Best regards, Luca.

Hi Dirk, I've faced with a problem for running the 'example3dnonrigid.m' on Mac, i got this error: 'Undefined function or variable 'bsplinetransform3dsingle'. Error in bsplinetransform (line 51) I=bsplinetransform3dsingle(single(O(:,:,:,1)),single(O(:,:,:,2)),single(O(:,:,:,3)),single(I),single(Spacing(1)),single(Spacing(2)),single(Spacing(3)),single(mode)); Error in getexampledata (line 17) V1=bsplinetransform(Otrans,V2,Spacing); Error in example3dnonrigid (line 11) I1,I2=getexampledata; Error in run (line 96) evalin('caller', script ';');' Do you know why? What should I do for compile Mex file? Thanks in advance. Hi I am having trouble running the compile c files on a Windows 7 computer. Hi Dirk I keep getting the following error when trying to mex the files: In file included from bsplineerror2ddouble.c:1: In file included from /Applications/MATLABR2013a.app/extern/include/mex.h:58: In file included from /Applications/MATLABR2013a.app/extern/include/matrix.h:294: /Applications/MATLABR2013a.app/extern/include/tmwtypes.h:819:9: error: unknown type name 'char16t' typedef char16t CHAR16T; ^ 1 error generated.

Mex: compile of ' 'bsplineerror2ddouble.c' failed. Any ideas as to why? Running on a mac Thanks! Dear Dirk-Jan, Thanks for this useful toolbox. I am not able to compile the c files successfully. I have Matlab2013b version running on mac osx 10.9 and xcode 5. (Maybe that's the problem.) Running compilecfiles.m i get the following errors: xcodebuild: error: SDK 'macosx10.7' cannot be located.

Xcrun: error: unable to find utility 'clang', not a developer tool or in PATH mex: compile of ' 'bsplineerror2ddouble.c' failed. Unable to complete successfully. Error in compilecfiles (line 8) mex(filename,'imageinterpolation.c','-v'); Do you have an idea how to solve this? Many thanks in Advance! Dear Dirk, First of all, a great piece of code.

I have been using the B-spline point registration code and have been attempting to make the following changes to your code: I would like to constrain the control points that lie on the axis origin and maxima so that they cannot be moved from their positions. Ideally it would be possible to constrain these points in one dimension.

I have been attempting to remove the control points that lie outside of the image to create the same effect, but with my limited knowledge of B-spline registration and your code I am getting some errors. Would there be a 'quick fix' to achieve this? Great submission! I believe there is a slight bug in the 3D registration if one does non-rigid registration only. I get the following error:??? Attempted to access M(1,1); index out of bounds because size(M)=0,0. Error in makeinitgrid at 63 Otrans(:,:,:,1) = mean(1) + M(1,1).

xd + M(1,2).yd + M(1,3).zd + M(1,4). 1; Error in imageregistrationMakeInitialGrid at 475 Otrans=makeinitgrid(Spacing,size(Imoving),M); Error in imageregistration at 219 Otrans,Spacing,MaxItt=MakeInitialGrid(Otrans,Spacing,Options,Imoving,M,IS3D); If I had to guess, it seems like M (inverse transformation from rigid registration) isn't initialized in the 3D, non-rigid case.

I do not get this error when running 2D non-rigid. I also do not get this error when running 3D rigid + non-rigid.

I can't make this code work so perhaps I'm applying it incorrectly. I want to register a smaller image to a larger one where the scale of the images differ and the smaller image will match only a portion of the larger. For example, crop the rotated Lena image and try matching it with the full unrotated image using either rigid or affine transformations. It doesn't work. In particular, the code first resizes the smaller image to the size of the larger image. A rigid transformation now can't possibly work.

If I put a border around the cropped image, it still doesn't help. Suggestions will be welcomed. Hi, I encountered error while compiling the C files. Compiling: bsplineerror2ddouble.c Creating library C: DOCUME1 user3 LOCALS1 TEMP MEXFO1 templib.x and object C: DOCUME1 user3 LOCALS1 TEMP MEXFO1 templib.exp imageinterpolation.obj: error LNK2019: unresolved external symbol floorf referenced in function floorfloat bsplineerror2ddouble.mexw32: fatal error LNK1120: 1 unresolved externals C: PROGRA1 MATLAB R2008B BIN MEX.PL: Error: Link of 'bsplineerror2ddouble.mexw32' failed.??? Error using mex at 213 Unable to complete successfully. Error in compilecfiles at 8 mex(filename,'imageinterpolation.c'); I wonder why this error occurs?

I'm using matlab R2008b by the way. Hi Dirk, Thanks for your code.

The 2D B-spline works slower without compiling the C-files and I am getting a strange error while compiling the C-files. Could you please help me with this. Hi Dirk, I have just been trying to register an image to a template using your script, but unfortunately it did not work. I used all the default options. Here is a summary of the output: Start Affine part of Non-Rigid registration. Optimizer Results Algorithm Used: limited memory BFGS (L-BFGS) Exit message: Change in the objective function value was less than the specified tolerance TolFun.

(repeat twice) Start non-rigid b-spline grid registration Current Grid size: 7x7. Optimizer Results Algorithm Used: limited memory BFGS (L-BFGS) Exit message: Change in the objective function value was less than the specified tolerance TolFun.

Registration Refinement Current Grid size: 11x11. Optimizer Results Algorithm Used: limited memory BFGS (L-BFGS) Exit message: Line search cannot find an acceptable point along the current search. Registration Refinement Current Grid size: 19x19. Optimizer Results Algorithm Used: limited memory BFGS (L-BFGS) Exit message: Line search cannot find an acceptable point along the current search Then the program quits without doing any registration, as far as I can tell.

I was just wondering whether you had any suggestions that I might try. For example, could I increase the specified tolerance TolFun somehow? Thanks, Winnie. I get a different compile error under Linux - redefinition of a function. I think it's a typo in the code. In bsplineerror2ddouble.c, you have (line 150) #ifdef WIN32 unsigned stdcall transformvolumeerrorcolor(double.Args) #else void transformvolumeerrorcolor(double.Args) #endif and later (line 485) #ifdef WIN32 unsigned stdcall transformvolumegradientcolor(double.Args) #else void transformvolumeerrorcolor(double.Args) #endif Those function names should match on both? After I change this, it compiles but doesn't link.:-( compilecfiles compiling: bsplineerror2ddouble.c imageinterpolation.o: In function `mindex2': imageinterpolation.c:(.text+0x0): multiple definition of `mindex2' bsplineerror2ddouble.o:bsplineerror2ddouble.c:(.text+0x0): first defined here and 8-10 more like that.

Siamak Yousefi 1: The (inverse) Affine Matrix is returned as variable 'M' if you use the latest version (18) 2: It is faster to already set: - the 'similarity' option - not use all outputs but only Ireg,Grid,Spacing,M - do less refinements option 'MaxRef' - Gaussian filter your images with imfilter and fspecial to remove noise, before starting the registration. The fastest: is using no Mask, no Landmarks, in combination with 'sd' as similarity measure, because than it uses optimized gradient mex functions named bsplineerror. 3: Do you use version 18?, otherwise I'll try to find the bug. Hi, whenever I try using landmarks I get a matrix multiplication error:.??? Error using times Matrix dimensions must agree.christos Sorry a little late, but yesterday I had time to work on my b-spline registration method.

Your 1th question, must masks be zero and ones?: No the mask is just multiplied with the error image from the similarity measure, before summing up all errors. There is one exception mutual information, in which elements which are zero are simply discarded before calculation of the mutual information value. 2th, must images be the same size?: Yes, they must be the same size also the masks. I fixed the mask resize bug you mentioned in version 17a which will probably be accepted by Mathworks this evening. 3th, Code imagedifference reshape?: This is an bug, I fixed it in version 17 4th, Mask are they already been tested?: Only the 2D masks. I developed the masks to register the backgrounds of an angiogram, in which I masked out the coronary artery in the images.

After registration of the backgrounds I subtracted them from the original movie to make the coronary artery better visible. Thank you for your comments, and bug report. Very nice code. There are some issues though a) regarding the masks, could you please confirm what their structure should be?

Is it just an image that contains 0s and 1s (where 0s correspond to areas to be masked out) b) should the images to be registered be the same size? I also see that at some point in registerimages.m you resize the moving image to have the same size with static.

You don't do this for the masks and I think the system complains about this c) In imagedifference.m RE: (lines 243-252)% Remove unmasked pixels if(isempty(Mask)), sizes=size(V); V=V(:); V(Mask)=; V=reshape(V,sizes); U=U(:); U(Mask)=; U=reshape(U,sizes); end I don't understand how is it possible to expect, if you remove the masked pixels, to be able to reshape U or V to the same size prior to the pixel removal? A 32x32 image (vectorized 1024x1). Your remove lets say 5 pixels from the vector - now 1019x1, and then you ask it to be reshaped back to 32x32 (my version at least complains) could you please elaborate on the usages of masks and if they have been tested? - thanks alot for your time and effort and for sharing this with us.

Hi I'm sorry for all these questions, but I encountered another problem - I tried to run the examplenonrigid3d example and got the following output: Iteration Func-count Grad-count f(x) Step-size 0 1 1 0.048856 1 4 2 0.0488542 5 2 7 3 0.0488539 1 3 10 4 0.0488535 1 4 13 5 0.0488532 1 Optimizer Results Algorithm Used: limited memory BFGS (L-BFGS) Exit message: Number of iterations exceeded options.MaxIter or number of function evaluations exceeded options.FunEvals. Iterations: 5 Function Count: 16 Minimum found: 0.048853 Intern Time: 0.1239 seconds Total Time: 2884.6883 seconds??? Index exceeds matrix dimensions.

Error in refinegrid at 111 Onew=Onew(1:size(X,1),1:size(X,2),1:size(X,3),1:3); Error in example3dnonrigid at 51 Otrans,Spacing=refinegrid(Otrans,Spacing,size(I1)); Do I need to change any params? Thanks again, Aya. Dirk-Jan, thanks for sharing your code. I have a pretty basic question. I am trying to use the B-spline FFD part (bsplinetransform.m) of your code for image morphing.

More specifically, I am trying to find out how I can change transformation grid to manipulate a picture. Transformation grid determines where each of the control points of the new image should be.

Is that right? You have mentioned that you've used Fumihiko Ino et al. Just wondering if you have used the same x and y directions mentioned in that paper (meaning (x,y)=(0,0) as the lower left corner of image). Thanks a lot. Whenever I try to run registervolumes.m on my rgb images.It gives me following error:???

Out of memory. Type HELP MEMORY for your options. Error in fminlbfgs at 140 data.deltaX=zeros(data.numberOfVariables,optim.StoreN); Error in registervolumes at 272 Otrans = resizeper.fminlbfgs(@(x)bsplineregistrationgradient(x,sizes,Spacing/resizeper,imresize3d(ISmoving,1/resizeper,'linear','bound'),imresize3d(ISstatic,1/resizeper,'linear','bound') I tried to resize my image to smaller size like 50x50, it still gives me error. This does not work for arbitrary sized images.

I haven't tried above 256x256 yet, but it won't work for smaller ROIs, I get the following error:??? Attempted to access Ouniform(3,18,1); index out of bounds because size(Ouniform)=17,17,2. Am VR, It is not that difficult to change the c-code files to work multi-threaded on Linux, it is simply replacing the windows functions such as beginthreadex with pthreadcreate. The code is now optimized for 'shared caches': one thread does the even and another the odd image lines. With separate caches/processors it will be better to divide the image in several image regions. When you add a large number of cpu-cores, the memory and the single-threaded Matlab code will be come the bottleneck instead of the cpu power.

I hope to release version 12 which uses not 2 but all available cores, and uses a new optimizer FMINLBFGS (also on mathworks) in a few days. Dirk-Jan Kroon, Thanks a lot for sharing this great piece of work with us. This is a very nice contribution to the Mathworks file exchange repository. I have one question about your code though. I am looking at your submission on Mar 4. When I run one of your examples, e.g.

Example2dnonrigid1.m, the results figure shows four images, and I am not sure I understand what is being displayed. Shouldn't 'transformed image 1' (Icor in your code) be the result of registering Image 1 (I1) onto image 2 (I2)? If so, 'transformed image 1' should look similar to 'image 2', right? However, in your figure 'transformed image 1' resembles more image 1 than image 2.

Am I missing something? Is the registration really working in this example?

Thanks a lot! There must be something wrong on the C code because some error are poped out when I try to compile the c files.

16 Mar 2011 1.33.0.0 Solved Bugs in diffeomorphic functions. Tested in Ubuntu and with LCC compiler 15 Mar 2011 1.32.0.0 Added MakeDiffeomorphic for deformations without folding. New clean multi-threading c-code. 13 Sep 2010 1.31.0.0 Fixed Nan in SSD calculation. Added numerical b-spline inverse. Added bi-cubic code 2 Sep 2010 1.30.0.0 Major Update! Improved / fixed bugs in 'Mutual information', new affine weighting par.

Fixed bug, which caused the error to decrease after refining a few times to a very fine b-spline grid. Added Point Registration examples. 30 Aug 2010 1.29.0.0 Added Corresponding Point based registration of Lee. Merged 2D and 3D registration functions into one file. Replaced for-loops by faster 1D index operations.

11 Jan 2010 1.28.0.0 Added manuallywarpimages function. Now uses localized mutual information for the error calculation, not only for the gradient of the error. Split registerimages and registervolumes in sub-functions. 30 Sep 2009 1.27.0.0 Fixes for Linux Compiler 28 Sep 2009 1.26.0.0 Fixed bug, 3D registration empty Fx and Fz matrix. 8 Sep 2009 1.25.0.0 Fix Gaussian filter function 14 Aug 2009 1.23.0.0 Fixed Single cubic interpolation bug, and addpaths.m in lowlevelexamples 5 Aug 2009 1.22.0.0 Solved mask bug reported by siamak yousefi. Also changed default smoothness penalty from 0.001 to 0.01, which is probably better for most applications. 27 Jul 2009 1.21.0.0 Major code speed up by look up tables and separate SDD code.

Also some bug Fixes in Mask code. 15 Jul 2009 1.20.0.0 Major bug z-dimension fixed in volume registration 15 Jul 2009 1.19.0.0 Bug fixed in index 3D cubic interpolation, resulted in zero resulting volumes 14 Jul 2009 1.18.0.0 Minor bug, Mask is now resized to fit size Istatic (if not already). 13 Jul 2009 1.17.0.0 Added Cubic interpolation!, fixed bug and comment in masks mutual information, interpolation now in separate file c. File 4 Jun 2009 1.16.0.0 example 3d nonrigid fixed 2 Jun 2009 1.15.0.0 Bug LCC compiler doesn't link floorf fixed.

Also fixed NaN bug in imagedifference.m 29 May 2009 1.14.0.0 Tri Ngo provided me with Linux multi-threaded code, which I added, thus the registration now supports multi-threaded Windows, Linux and (Mac Os)? Also fixed last; bug. 27 May 2009 1.13.0.0 ';' removed to fix a boundary bug 26 May 2009 1.12.0.0 Speed up affine 3D registration (2x), and some other small improvements. 15 Apr 2009 1.11.0.0 Added 2D RGB image support 14 Apr 2009 1.10.0.0 Landmarks can now be used as transformation regularization. 25 Mar 2009 1.9.0.0 Fixed out of bounds bug, reported by D.C.

Karhoff 24 Mar 2009 1.8.0.0 Bug fixed in image dimensions in backwards2forward c-code and updated movepixels files to allow pixels outside image to be zero or nearest value inside image. 20 Mar 2009 1.7.0.0 Changed parameter 'size of region influenced by a control point' in final refinement step. Resulting in a speed up of 150% in gradient calculation in this last step. 19 Mar 2009 1.6.0.0 Fixed a bug: The moving grid was used to determine the region influenced by a control point in gradient registration, this is changed in a uniform static grid. (b-splines are always determined on a uniform grid).

16 Mar 2009 1.5.0.0 Multi-threaded registration now uses the number of threads set by maxNumCompThreads. New Quasi newton optimizer fminlbfgs. Speed ups in the smoothness penalty, and some other files. 4 Mar 2009 1.4.0.0 Single Threaded files are updated to all code in the Multiple Threaded files, and tested. 24 Feb 2009 1.3.0.0 2D available in 100% Matlab code.

Eulerian strain images available. Parts of images can be masked.

Forward transformation field now also available. 31 Oct 2008 1.1.0.0 Bug fixed: The rigid transformation optimizers crashed with images with strange dimensions 13 Oct 2008 1.0.0.0 Added registration smoothness penalty. 2 Oct 2008 Major bug fixes in 3D error gradient code, speed ups, out of the box registration 20 Aug 2008 Fixed NaN bug, which occurred in case of a grid cell size of zero. 1 Aug 2008 All functions are rewritten to be used with the Matlab optimization methods. 18 Jul 2008 Improved example code and interface updates 17 Jul 2008 Updated example code, and some function interface improvements.

28 May 2008 Added 3D matlab files. 27 May 2008 10x times faster version, and 3d beta code.

Matlab/r2012a/mexopts.sh For Mac

Mexopencv This software package provides matlab mex functions that interface a hundred of OpenCV APIs. Also the package contains a C class that converts between Matlab's native data types and OpenCV data types. The package is suitable for fast prototyping of OpenCV application in Matlab, use of OpenCV as an external toolbox in Matlab, and the development of a custom mex function. Note: Starting OpenCV 3.0, the official Matlab module is available in. Mexopencv is a private project independent of the official Matlab module. (May 2015). Note: Mathworks also provide an OpenCV development kit for Matlab in.

They have mexOpenCV function to compile a MEX file. (Oct 2015) There is for mexopencv (Thanks, Surya). Download Please refer the above link for how to compile the source code.

Matlab R2012a Crack Download

Usually it is as easy as typing mexopencv.make in matlab. If you're using git, git clone git://github.com/kyamagu/mexopencv.git Documentation. Getting started Here is an example of how simple it is to use an OpenCV function from matlab. % Connect to a camera camera = cv. VideoCapture ; pause ( 2 ); for i = 1: 50% Capture and show frame frame = camera. Read; imshow ( frame ); pause ( 0.3 ); end The package already contains more than 150 OpenCV functions/classes. You can check a list of supported functions in the.

Matlab/r2012a/mexopts.sh For Mac Os

Matlab/r2012a/mexopts.sh for mac pro

If there isn't your favorite one, you can easily add a new mex function through MxArray class. MxArray is a data conversion utility for Matlab's native array and OpenCV data types. With this class, your mex function is as simple as the following.

Alias matlab = 'LDPRELOAD=/usr/lib/x8664-linux-gnu/libstdc.so.6:/lib/x8664-linux-gnu/libgccs.so.1 matlab' Note that if you have the computer vision toolbox from Mathworks, you almost always see this error, because that toolbox internally loads its own version of opencv. In that case, use LDPRELOAD to force loading your opencv installation. Mac OS X Compile error In Mac OS X, Matlab may require additional setup to use mex depending on the OS version. See for more information. OS X 10.9 and XCode 5 Due to the change in the default C runtime in OS X 10.9, you probably need to tweak a few configurations in mexopts.sh to avoid compile issues.

If you haven't run mex -setup in Matlab, please do so first and edit mexopts.sh and change a few variables. Following shows an example. CC = 'clang' CXX = 'clang' SDKROOT = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/' MACOSXDEPLOYMENTTARGET = '10.9' CLIBS = '$CLIBS -lc' CXXFLAGS = '-fno-common -no-cpp-precomp -fexceptions -arch $ARCHS -isysroot $SDKROOT -mmacosx-version-min=$MACOSXDEPLOYMENTTARGET -std=c11 -stdlib=libc -DCHAR16T' CXXLIBS = '$MLIBS -lc' Invalid MEX file In OS X environment, runtime error can happen when the version of your system library conflicts with matlab's internal library. Try setting the DYLDINSERTLIBRARIES variable to force matlab to use the system's library. DYLDINSERTLIBRARIES =/opt/local/lib/libtiff.3.dylib /Applications/MATLABR2012a.app/bin/matlab To find which library is causing an error, use otool -L command. See the Invalid MEX file instruction in the Linux section above. General usage 0-based index vs 1-based index OpenCV uses 0-based index while matlab uses 1-based index.

That is, the top left pixel is (0,0) in OpenCV whereas matlab treats it as (1,1). Mexopencv does NOT convert image coordinates. Be careful when accessing a function that deals with image coordinates.

Channeled array OpenCV often uses channels as dimensions of coordinate representation, as seen in perspectiveTransform. In matlab, you can make these channeled array by creating 1-by-N-by-d array for an N element array of d-dimensional vectors. Hint: use shiftdim function to convert from/to N-by-d numeric array in matlab.