matlabimage-processingcluster-analysisimage-segmentationarpack

Normalized cuts with Matlab 2013a


I am using the normalized cuts package from http://www.cis.upenn.edu/~jshi/software/Ncut_9.zip (on Windows 7)

This used to work fine with Matlab2010a. However I have upgraded to Matlab2013a (32 bit student version) and I now get the following error:

Error using arpackc
Expect 2 output arguments

Error in eigs_new (line 240)
        arpackc( aupdfun, ido, ...

Error in ncut (line 83)
[vbar,s,convergence] =
eigs_new(@mex_w_times_x_symmetric,size(P,1),nbEigenValues,'LA',options,tril(P));

Error in ncutW (line 9)
[NcutEigenvectors,NcutEigenvalues] =
ncut(W,nbcluster);

Error in NcutImage (line 18)
[NcutDiscrete,NcutEigenvectors,NcutEigenvalues]
= ncutW(W,nbSegments);

Error in demoNcutImage (line 25)
[SegLabel,NcutDiscrete,NcutEigenvectors,NcutEigenvalues,W,imageEdges]=
NcutImage(I,nbSegments);

Obviously the new_eigs() function in ncuts is incompatible with the ARPACK version in the latest Matlab.


Solution

  • There are two solutions to this:

    1. Use Matlab's eigs() function instead of the eigs_new() provided in the normalized cuts package. I guess eigs_new() was designed to solve some compatibility issue with a previous version of Matlab, and is now itself causing an issue.

    2. Modify eigs_new(). Where there is a call to arpackc() in eigs_new(), make the call like in the tool box version of eigs(). So, e.g.:

      arpackc( aupdfun, ido, ...
       bmat, intconvert(n), whch, nev, tol, resid, ncv, ...
          v, ldv, iparam, ipntr, workd, workl, lworkl, info );
      

    becomes

        [ido, info] = arpackc( aupdfun, ido, bmat, intconvert(n), whch, ...
            nev, tol, resid, ncv, v, ldv, iparam, ipntr, workd, workl, ...
            lworkl, info );
    

    There were only two places where this had to be changed to make it work (although there other calls to arpackc() which don't actually get executed).

    I am still not sure why eigs_new() exists at all.