├── LICENSE ├── README.md ├── alignSetup.m ├── cyclefilter.m ├── demo.m ├── eval3cycle.m ├── evaluate.m ├── external ├── MinMaxSelection │ ├── Contents.txt │ ├── Internal_mxArray.h │ ├── Internal_mxArray_2010B.h │ ├── buildInternal_mxArrayDef.m │ ├── getmexopts.m │ ├── inplacecolumnmex.c │ ├── inplacecolumnmex.mexa64 │ ├── inplacecolumnmex.mexmaci64 │ ├── inplacecolumnmex.mexw64 │ ├── maxk.m │ ├── maxkmex.c │ ├── maxkmex.m │ ├── maxkmex.mexa64 │ ├── maxkmex.mexmaci64 │ ├── maxkmex.mexw64 │ ├── mink.m │ ├── minkmex.c │ ├── minkmex.m │ ├── minkmex.mexa64 │ ├── minkmex.mexmaci64 │ ├── minkmex.mexw64 │ ├── minmax_install.m │ ├── minmaxk.m │ ├── releaseinplace.c │ ├── releaseinplace.mexa64 │ ├── releaseinplace.mexmaci64 │ ├── releaseinplace.mexw64 │ └── testminmax.m ├── dsp-code │ ├── DSPDemo.m │ ├── DSPDemo_CT101.m │ ├── DSPDemo_LMO.m │ ├── DSPMatch.m │ ├── DT.cpp │ ├── DT.h │ ├── EvaluateCT101Match.m │ ├── EvaluateLMOMatch.m │ ├── ExtractSIFT.m │ ├── ExtractSIFT_WithPadding.m │ ├── MyUtil.h │ ├── PixelMatch.cpp │ ├── PixelMatch.h │ ├── PixelMatchMex.cpp │ ├── PixelMatchMex.mexa64 │ ├── PixelMatchMex.mexmaci64 │ ├── PixelMatchMex.mexw32 │ ├── README.txt │ ├── SPBP.cpp │ ├── SPBP.h │ ├── SPBPMex.cpp │ ├── SPBPMex.mexa64 │ ├── SPBPMex.mexmaci64 │ ├── SPBPMex.mexw32 │ ├── SPGraph.cpp │ ├── SPGraph.h │ ├── SPNodeMatch.cpp │ ├── SPNodeMatch.h │ ├── SPNodeMatchMex.cpp │ ├── SPNodeMatchMex.mexa64 │ ├── SPNodeMatchMex.mexmaci64 │ ├── SPNodeMatchMex.mexw32 │ ├── TransferAnnotation.m │ ├── TransferLabelAndEvaluateAccuracy.m │ ├── ct101_example_data.mat │ ├── ct101_pca_basis.mat │ ├── gccopts.sh │ ├── im1.mat │ ├── im2.mat │ ├── imgs.mat │ ├── lmo_example_data.mat │ ├── lmo_pca_basis.mat │ ├── mex_compile.m │ ├── mexopts.bat │ ├── obj_colormap.mat │ ├── openmpflag.h │ ├── seg2color.m │ ├── sifts.mat │ ├── vlfeat-0.9.17 │ │ ├── .gitattributes │ │ ├── .gitignore │ │ ├── COPYING │ │ ├── Makefile │ │ ├── Makefile.mak │ │ ├── README │ │ ├── apps │ │ │ ├── phow_caltech101.m │ │ │ ├── recognition │ │ │ │ ├── encodeImage.m │ │ │ │ ├── experiments.m │ │ │ │ ├── extendDescriptorsWithGeometry.m │ │ │ │ ├── getDenseSIFT.m │ │ │ │ ├── readImage.m │ │ │ │ ├── setupCaltech256.m │ │ │ │ ├── setupFMD.m │ │ │ │ ├── setupGeneric.m │ │ │ │ ├── setupScene67.m │ │ │ │ ├── setupVoc.m │ │ │ │ ├── trainEncoder.m │ │ │ │ └── traintest.m │ │ │ └── sift_mosaic.m │ │ ├── data │ │ │ ├── box.pgm │ │ │ ├── box.sift │ │ │ ├── river1.jpg │ │ │ ├── river2.jpg │ │ │ ├── roofs1.jpg │ │ │ ├── roofs2.jpg │ │ │ └── spots.jpg │ │ ├── docsrc │ │ │ ├── about.html │ │ │ ├── aib.html │ │ │ ├── api.html │ │ │ ├── apps.html │ │ │ ├── compiling.html │ │ │ ├── covdet.html │ │ │ ├── doc.html │ │ │ ├── download.html │ │ │ ├── doxygen.conf │ │ │ ├── doxygen.css │ │ │ ├── doxytag.py │ │ │ ├── dsift.html │ │ │ ├── dtd │ │ │ │ └── xhtml1 │ │ │ │ │ ├── xhtml-lat1.ent │ │ │ │ │ ├── xhtml-special.ent │ │ │ │ │ ├── xhtml-symbol.ent │ │ │ │ │ ├── xhtml.soc │ │ │ │ │ ├── xhtml1-frameset.dtd │ │ │ │ │ ├── xhtml1-strict.dtd │ │ │ │ │ ├── xhtml1-transitional.dtd │ │ │ │ │ └── xhtml1.dcl │ │ │ ├── encode.html │ │ │ ├── figures │ │ │ │ ├── cell-bins.fig │ │ │ │ ├── dhog-bins.fig │ │ │ │ ├── dsift-geom.fig │ │ │ │ ├── liop.svg │ │ │ │ ├── mser-er.fig │ │ │ │ ├── mser-tree.fig │ │ │ │ ├── sift-angle.fig │ │ │ │ ├── sift-bins.fig │ │ │ │ ├── sift-can.fig │ │ │ │ ├── sift-conv-vlfeat.fig │ │ │ │ ├── sift-conv.fig │ │ │ │ ├── sift-descr-easy.fig │ │ │ │ ├── sift-frame.fig │ │ │ │ ├── sift-image-frame.fig │ │ │ │ ├── sift-orient.fig │ │ │ │ └── sift-ss.fig │ │ │ ├── formatter.py │ │ │ ├── gmm.html │ │ │ ├── hikm.html │ │ │ ├── hog.html │ │ │ ├── ikm.html │ │ │ ├── images │ │ │ │ ├── PASCAL2.png │ │ │ │ ├── caltech-collage.jpg │ │ │ │ ├── down.png │ │ │ │ ├── fulkerson.jpg │ │ │ │ ├── help.png │ │ │ │ ├── lenc.jpg │ │ │ │ ├── liop-neighbours-sampling.png │ │ │ │ ├── liop-patch-layout.png │ │ │ │ ├── perdoch.jpg │ │ │ │ ├── perrone.jpg │ │ │ │ ├── placeholder.jpg │ │ │ │ ├── sarbortova.jpg │ │ │ │ ├── sift-mosaic.jpg │ │ │ │ ├── sulc.jpg │ │ │ │ ├── using-vs-additional-deps.png │ │ │ │ ├── using-vs-additional-include.png │ │ │ │ ├── using-vs-additional-libdir.png │ │ │ │ ├── using-vs-all-configurations.png │ │ │ │ ├── using-vs-empty-project.png │ │ │ │ ├── using-vs-new-project.png │ │ │ │ ├── using-vs-nodll.png │ │ │ │ ├── using-vs-ok.png │ │ │ │ ├── using-vs-post-step.png │ │ │ │ ├── using-vs-project-properties.png │ │ │ │ ├── using-xcode-copy-2.png │ │ │ │ ├── using-xcode-copy.png │ │ │ │ ├── using-xcode-dylib.png │ │ │ │ ├── using-xcode-edit.png │ │ │ │ ├── using-xcode-err.png │ │ │ │ ├── using-xcode-info.png │ │ │ │ ├── using-xcode-new.png │ │ │ │ ├── using-xcode-ok.png │ │ │ │ ├── vedaldi.jpg │ │ │ │ ├── vl_blue.ico │ │ │ │ ├── vl_blue.png │ │ │ │ ├── vl_blue.pxm │ │ │ │ └── yandex.png │ │ │ ├── imdisttf.html │ │ │ ├── index.html │ │ │ ├── install-c.html │ │ │ ├── install-matlab.html │ │ │ ├── install-octave.html │ │ │ ├── install-shell.html │ │ │ ├── kdtree.html │ │ │ ├── kmeans.html │ │ │ ├── license.html │ │ │ ├── liop.html │ │ │ ├── mdoc.py │ │ │ ├── mser.html │ │ │ ├── notfound.html │ │ │ ├── plots-rank.html │ │ │ ├── pygmentize.css │ │ │ ├── quickshift.html │ │ │ ├── roadmap.html │ │ │ ├── sift.html │ │ │ ├── slic.html │ │ │ ├── svm.html │ │ │ ├── tutorials.html │ │ │ ├── using-gcc.html │ │ │ ├── using-vsexpress.html │ │ │ ├── using-xcode.html │ │ │ ├── utils.html │ │ │ ├── vlfeat-website-main-content.xml │ │ │ ├── vlfeat-website-preproc.xml │ │ │ ├── vlfeat-website-template.xml │ │ │ ├── vlfeat-website.xml │ │ │ ├── vlfeat.bib │ │ │ ├── vlfeat.css │ │ │ ├── webdoc.py │ │ │ └── wikidoc.py │ │ ├── make │ │ │ ├── bin.mak │ │ │ ├── dist.mak │ │ │ ├── dll.mak │ │ │ ├── doc.mak │ │ │ ├── matlab.mak │ │ │ ├── nmake_helper.mak │ │ │ ├── octave.mak │ │ │ └── update-mak.sh │ │ ├── src │ │ │ ├── aib.c │ │ │ ├── check.h │ │ │ ├── generic-driver.h │ │ │ ├── mser.1 │ │ │ ├── mser.c │ │ │ ├── sift.1 │ │ │ ├── sift.c │ │ │ ├── test_gauss_elimination.c │ │ │ ├── test_getopt_long.c │ │ │ ├── test_gmm.c │ │ │ ├── test_heap-def.c │ │ │ ├── test_host.c │ │ │ ├── test_imopv.c │ │ │ ├── test_kmeans.c │ │ │ ├── test_liop.c │ │ │ ├── test_mathop.c │ │ │ ├── test_mathop_abs.c │ │ │ ├── test_mathop_fast_resqrt.tc │ │ │ ├── test_mathop_fast_sqrt_ui.tc │ │ │ ├── test_nan.c │ │ │ ├── test_qsort-def.c │ │ │ ├── test_rand.c │ │ │ ├── test_stringop.c │ │ │ ├── test_svd2.c │ │ │ ├── test_threads.c │ │ │ ├── test_vec_comp.c │ │ │ └── vlfeat.7 │ │ ├── toolbox │ │ │ ├── aib │ │ │ │ ├── vl_aib.c │ │ │ │ ├── vl_aib.m │ │ │ │ ├── vl_aibcut.m │ │ │ │ ├── vl_aibcuthist.m │ │ │ │ ├── vl_aibcutpush.m │ │ │ │ ├── vl_aibhist.c │ │ │ │ └── vl_aibhist.m │ │ │ ├── demo │ │ │ │ ├── vl_demo_aib.m │ │ │ │ ├── vl_demo_alldist.m │ │ │ │ ├── vl_demo_cmd.m │ │ │ │ ├── vl_demo_covdet.m │ │ │ │ ├── vl_demo_dsift.m │ │ │ │ ├── vl_demo_gmm_2d_rand.m │ │ │ │ ├── vl_demo_gmm_2d_twist.m │ │ │ │ ├── vl_demo_gmm_3d.m │ │ │ │ ├── vl_demo_gmm_convergence.m │ │ │ │ ├── vl_demo_hog.m │ │ │ │ ├── vl_demo_imdisttf.m │ │ │ │ ├── vl_demo_kdtree.m │ │ │ │ ├── vl_demo_kdtree_ann.m │ │ │ │ ├── vl_demo_kdtree_forest.m │ │ │ │ ├── vl_demo_kdtree_plot.m │ │ │ │ ├── vl_demo_kdtree_self.m │ │ │ │ ├── vl_demo_kdtree_sift.m │ │ │ │ ├── vl_demo_kmeans_2d.m │ │ │ │ ├── vl_demo_kmeans_ann_speed.m │ │ │ │ ├── vl_demo_kmeans_init.m │ │ │ │ ├── vl_demo_kmeans_vs_builtin.m │ │ │ │ ├── vl_demo_mser_basic.m │ │ │ │ ├── vl_demo_mser_cmd.m │ │ │ │ ├── vl_demo_mser_delta.m │ │ │ │ ├── vl_demo_plots_rank.m │ │ │ │ ├── vl_demo_print.m │ │ │ │ ├── vl_demo_quickshift.m │ │ │ │ ├── vl_demo_sift_basic.m │ │ │ │ ├── vl_demo_sift_cmd.m │ │ │ │ ├── vl_demo_sift_edge.m │ │ │ │ ├── vl_demo_sift_match.m │ │ │ │ ├── vl_demo_sift_or.m │ │ │ │ ├── vl_demo_sift_peak.m │ │ │ │ ├── vl_demo_sift_vs_ubc.m │ │ │ │ ├── vl_demo_slic.m │ │ │ │ ├── vl_demo_svm.m │ │ │ │ └── vl_demo_svm_data.mat │ │ │ ├── fisher │ │ │ │ ├── vl_fisher.c │ │ │ │ └── vl_fisher.m │ │ │ ├── geometry │ │ │ │ ├── vl_hat.m │ │ │ │ ├── vl_ihat.m │ │ │ │ ├── vl_irodr.c │ │ │ │ ├── vl_irodr.m │ │ │ │ ├── vl_rodr.c │ │ │ │ └── vl_rodr.m │ │ │ ├── gmm │ │ │ │ ├── vl_gmm.c │ │ │ │ └── vl_gmm.m │ │ │ ├── imop │ │ │ │ ├── vl_dwaffine.m │ │ │ │ ├── vl_imarray.m │ │ │ │ ├── vl_imarraysc.m │ │ │ │ ├── vl_imdisttf.c │ │ │ │ ├── vl_imdisttf.m │ │ │ │ ├── vl_imdown.m │ │ │ │ ├── vl_imgrad.m │ │ │ │ ├── vl_imintegral.c │ │ │ │ ├── vl_imintegral.m │ │ │ │ ├── vl_impattern.m │ │ │ │ ├── vl_imreadbw.m │ │ │ │ ├── vl_imreadgray.m │ │ │ │ ├── vl_imsc.m │ │ │ │ ├── vl_imsmooth.c │ │ │ │ ├── vl_imsmooth.m │ │ │ │ ├── vl_imup.m │ │ │ │ ├── vl_imwbackward.m │ │ │ │ ├── vl_imwbackwardmx.c │ │ │ │ ├── vl_imwhiten.m │ │ │ │ ├── vl_rgb2xyz.m │ │ │ │ ├── vl_tps.m │ │ │ │ ├── vl_tpsu.m │ │ │ │ ├── vl_tpsumx.c │ │ │ │ ├── vl_waffine.m │ │ │ │ ├── vl_witps.m │ │ │ │ ├── vl_wtps.m │ │ │ │ ├── vl_xyz2lab.m │ │ │ │ ├── vl_xyz2luv.m │ │ │ │ └── vl_xyz2rgb.m │ │ │ ├── info.xml │ │ │ ├── kmeans │ │ │ │ ├── vl_hikmeans.c │ │ │ │ ├── vl_hikmeans.m │ │ │ │ ├── vl_hikmeanshist.m │ │ │ │ ├── vl_hikmeanspush.c │ │ │ │ ├── vl_hikmeanspush.m │ │ │ │ ├── vl_ikmeans.c │ │ │ │ ├── vl_ikmeans.m │ │ │ │ ├── vl_ikmeanshist.m │ │ │ │ ├── vl_ikmeanspush.c │ │ │ │ ├── vl_ikmeanspush.m │ │ │ │ ├── vl_kmeans.c │ │ │ │ └── vl_kmeans.m │ │ │ ├── mexutils.h │ │ │ ├── misc │ │ │ │ ├── inthist.tc │ │ │ │ ├── kdtree.h │ │ │ │ ├── samplinthist.tc │ │ │ │ ├── svms_common.h │ │ │ │ ├── vl_alldist.c │ │ │ │ ├── vl_alldist2.c │ │ │ │ ├── vl_alldist2.m │ │ │ │ ├── vl_alphanum.m │ │ │ │ ├── vl_argparse.m │ │ │ │ ├── vl_binsearch.c │ │ │ │ ├── vl_binsearch.m │ │ │ │ ├── vl_binsum.c │ │ │ │ ├── vl_binsum.def │ │ │ │ ├── vl_binsum.m │ │ │ │ ├── vl_colsubset.m │ │ │ │ ├── vl_cummax.c │ │ │ │ ├── vl_cummax.def │ │ │ │ ├── vl_cummax.m │ │ │ │ ├── vl_getpid.c │ │ │ │ ├── vl_getpid.m │ │ │ │ ├── vl_grad.m │ │ │ │ ├── vl_histmarg.m │ │ │ │ ├── vl_hog.c │ │ │ │ ├── vl_hog.m │ │ │ │ ├── vl_homkermap.c │ │ │ │ ├── vl_homkermap.m │ │ │ │ ├── vl_ihashfind.c │ │ │ │ ├── vl_ihashfind.m │ │ │ │ ├── vl_ihashsum.c │ │ │ │ ├── vl_ihashsum.m │ │ │ │ ├── vl_inthist.c │ │ │ │ ├── vl_inthist.m │ │ │ │ ├── vl_isoctave.m │ │ │ │ ├── vl_kdtreebuild.c │ │ │ │ ├── vl_kdtreebuild.m │ │ │ │ ├── vl_kdtreequery.c │ │ │ │ ├── vl_kdtreequery.m │ │ │ │ ├── vl_lbp.c │ │ │ │ ├── vl_lbp.m │ │ │ │ ├── vl_lbpfliplr.m │ │ │ │ ├── vl_localmax.c │ │ │ │ ├── vl_localmax.m │ │ │ │ ├── vl_numder.m │ │ │ │ ├── vl_numder2.m │ │ │ │ ├── vl_override.m │ │ │ │ ├── vl_pegasos.m │ │ │ │ ├── vl_sampleinthist.c │ │ │ │ ├── vl_sampleinthist.m │ │ │ │ ├── vl_simdctrl.c │ │ │ │ ├── vl_simdctrl.m │ │ │ │ ├── vl_svmdataset.m │ │ │ │ ├── vl_svmpegasos.m │ │ │ │ ├── vl_svmtrain.c │ │ │ │ ├── vl_svmtrain.m │ │ │ │ ├── vl_threads.c │ │ │ │ ├── vl_threads.m │ │ │ │ ├── vl_twister.c │ │ │ │ ├── vl_twister.m │ │ │ │ ├── vl_version.c │ │ │ │ ├── vl_version.m │ │ │ │ ├── vl_whistc.m │ │ │ │ └── vl_xmkdir.m │ │ │ ├── mser │ │ │ │ ├── vl_erfill.c │ │ │ │ ├── vl_erfill.m │ │ │ │ ├── vl_ertr.m │ │ │ │ ├── vl_mser.c │ │ │ │ └── vl_mser.m │ │ │ ├── plotop │ │ │ │ ├── vl_cf.m │ │ │ │ ├── vl_click.m │ │ │ │ ├── vl_clickpoint.m │ │ │ │ ├── vl_clicksegment.m │ │ │ │ ├── vl_det.m │ │ │ │ ├── vl_figaspect.m │ │ │ │ ├── vl_linespec2prop.m │ │ │ │ ├── vl_plotbox.m │ │ │ │ ├── vl_plotframe.m │ │ │ │ ├── vl_plotgrid.m │ │ │ │ ├── vl_plotpoint.m │ │ │ │ ├── vl_plotstyle.m │ │ │ │ ├── vl_pr.m │ │ │ │ ├── vl_printsize.m │ │ │ │ ├── vl_roc.m │ │ │ │ ├── vl_tightsubplot.m │ │ │ │ └── vl_tpfp.m │ │ │ ├── quickshift │ │ │ │ ├── vl_flatmap.m │ │ │ │ ├── vl_imseg.m │ │ │ │ ├── vl_quickseg.m │ │ │ │ ├── vl_quickshift.c │ │ │ │ ├── vl_quickshift.m │ │ │ │ └── vl_quickvis.m │ │ │ ├── sift │ │ │ │ ├── vl_covdet.c │ │ │ │ ├── vl_covdet.m │ │ │ │ ├── vl_dsift.c │ │ │ │ ├── vl_dsift.m │ │ │ │ ├── vl_frame2oell.m │ │ │ │ ├── vl_liop.c │ │ │ │ ├── vl_liop.m │ │ │ │ ├── vl_phow.m │ │ │ │ ├── vl_plotsiftdescriptor.m │ │ │ │ ├── vl_plotss.m │ │ │ │ ├── vl_sift.c │ │ │ │ ├── vl_sift.m │ │ │ │ ├── vl_siftdescriptor.c │ │ │ │ ├── vl_siftdescriptor.m │ │ │ │ ├── vl_ubcmatch.c │ │ │ │ ├── vl_ubcmatch.m │ │ │ │ └── vl_ubcread.m │ │ │ ├── slic │ │ │ │ ├── vl_slic.c │ │ │ │ └── vl_slic.m │ │ │ ├── special │ │ │ │ ├── vl_ddgaussian.m │ │ │ │ ├── vl_dgaussian.m │ │ │ │ ├── vl_dsigmoid.m │ │ │ │ ├── vl_gaussian.m │ │ │ │ ├── vl_rcos.m │ │ │ │ └── vl_sigmoid.m │ │ │ ├── vl_compile.m │ │ │ ├── vl_demo.m │ │ │ ├── vl_harris.m │ │ │ ├── vl_help.m │ │ │ ├── vl_noprefix.m │ │ │ ├── vl_root.m │ │ │ ├── vl_setup.m │ │ │ ├── vlad │ │ │ │ ├── vl_vlad.c │ │ │ │ └── vl_vlad.m │ │ │ └── xtest │ │ │ │ ├── vl_assert_almost_equal.m │ │ │ │ ├── vl_assert_equal.m │ │ │ │ ├── vl_assert_exception.m │ │ │ │ ├── vl_test.m │ │ │ │ ├── vl_test_aib.m │ │ │ │ ├── vl_test_alldist.m │ │ │ │ ├── vl_test_alldist2.m │ │ │ │ ├── vl_test_alphanum.m │ │ │ │ ├── vl_test_argparse.m │ │ │ │ ├── vl_test_binsearch.m │ │ │ │ ├── vl_test_binsum.m │ │ │ │ ├── vl_test_colsubset.m │ │ │ │ ├── vl_test_cummax.m │ │ │ │ ├── vl_test_dsift.m │ │ │ │ ├── vl_test_fisher.m │ │ │ │ ├── vl_test_gmm.m │ │ │ │ ├── vl_test_grad.m │ │ │ │ ├── vl_test_hikmeans.m │ │ │ │ ├── vl_test_hog.m │ │ │ │ ├── vl_test_homkermap.m │ │ │ │ ├── vl_test_ihashsum.m │ │ │ │ ├── vl_test_ikmeans.m │ │ │ │ ├── vl_test_imarray.m │ │ │ │ ├── vl_test_imdisttf.m │ │ │ │ ├── vl_test_imintegral.m │ │ │ │ ├── vl_test_imsmooth.m │ │ │ │ ├── vl_test_imwbackward.m │ │ │ │ ├── vl_test_init.m │ │ │ │ ├── vl_test_inthist.m │ │ │ │ ├── vl_test_kdtree.m │ │ │ │ ├── vl_test_kmeans.m │ │ │ │ ├── vl_test_lbp.m │ │ │ │ ├── vl_test_liop.m │ │ │ │ ├── vl_test_mser.m │ │ │ │ ├── vl_test_phow.m │ │ │ │ ├── vl_test_plotbox.m │ │ │ │ ├── vl_test_pr.m │ │ │ │ ├── vl_test_printsize.m │ │ │ │ ├── vl_test_roc.m │ │ │ │ ├── vl_test_sift.m │ │ │ │ ├── vl_test_slic.m │ │ │ │ ├── vl_test_svmtrain.m │ │ │ │ ├── vl_test_twister.m │ │ │ │ ├── vl_test_vlad.m │ │ │ │ └── vl_test_whistc.m │ │ ├── vl │ │ │ ├── aib.c │ │ │ ├── aib.h │ │ │ ├── array.c │ │ │ ├── array.h │ │ │ ├── covdet.c │ │ │ ├── covdet.h │ │ │ ├── dsift.c │ │ │ ├── dsift.h │ │ │ ├── fisher.c │ │ │ ├── fisher.h │ │ │ ├── float.th │ │ │ ├── generic.c │ │ │ ├── generic.h │ │ │ ├── getopt_long.c │ │ │ ├── getopt_long.h │ │ │ ├── gmm.c │ │ │ ├── gmm.h │ │ │ ├── heap-def.h │ │ │ ├── hikmeans.c │ │ │ ├── hikmeans.h │ │ │ ├── hog.c │ │ │ ├── hog.h │ │ │ ├── homkermap.c │ │ │ ├── homkermap.h │ │ │ ├── host.c │ │ │ ├── host.h │ │ │ ├── ikmeans.c │ │ │ ├── ikmeans.h │ │ │ ├── ikmeans_elkan.tc │ │ │ ├── ikmeans_init.tc │ │ │ ├── ikmeans_lloyd.tc │ │ │ ├── imopv.c │ │ │ ├── imopv.h │ │ │ ├── imopv_sse2.c │ │ │ ├── imopv_sse2.h │ │ │ ├── kdtree.c │ │ │ ├── kdtree.h │ │ │ ├── kmeans.c │ │ │ ├── kmeans.h │ │ │ ├── lbp.c │ │ │ ├── lbp.h │ │ │ ├── liop.c │ │ │ ├── liop.h │ │ │ ├── mathop.c │ │ │ ├── mathop.h │ │ │ ├── mathop_avx.c │ │ │ ├── mathop_avx.h │ │ │ ├── mathop_sse2.c │ │ │ ├── mathop_sse2.h │ │ │ ├── mser.c │ │ │ ├── mser.h │ │ │ ├── pgm.c │ │ │ ├── pgm.h │ │ │ ├── qsort-def.h │ │ │ ├── quickshift.c │ │ │ ├── quickshift.h │ │ │ ├── random.c │ │ │ ├── random.h │ │ │ ├── rodrigues.c │ │ │ ├── rodrigues.h │ │ │ ├── scalespace.c │ │ │ ├── scalespace.h │ │ │ ├── shuffle-def.h │ │ │ ├── sift.c │ │ │ ├── sift.h │ │ │ ├── slic.c │ │ │ ├── slic.h │ │ │ ├── stringop.c │ │ │ ├── stringop.h │ │ │ ├── svm.c │ │ │ ├── svm.h │ │ │ ├── svmdataset.c │ │ │ ├── svmdataset.h │ │ │ ├── vlad.c │ │ │ └── vlad.h │ │ ├── vlfeat.sln │ │ ├── vlfeat.vcproj │ │ └── vlfeat.xcodeproj │ │ │ ├── project.pbxproj │ │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── make doc-api.xcscheme │ │ │ ├── make info.xcscheme │ │ │ └── make.xcscheme │ └── warpImage.m └── pwmetric │ ├── dist2.m │ ├── normalizedKernel.m │ ├── pwhamming_cimp.cpp │ ├── pwhamming_cimp.mexa64 │ ├── pwhamming_cimp.mexglx │ ├── pwhamming_cimp.mexmaci64 │ ├── pwhamming_cimp.mexw32 │ ├── pwhamming_cimp.mexw64 │ ├── pwmetrics_cimp.cpp │ ├── pwmetrics_cimp.mexa64 │ ├── pwmetrics_cimp.mexglx │ ├── pwmetrics_cimp.mexmaci64 │ ├── pwmetrics_cimp.mexw32 │ ├── pwmetrics_cimp.mexw64 │ ├── readme.html │ ├── slmetric_pw.m │ └── slmetric_pw_compile.m ├── initflows.m ├── jointAlign.m ├── objective.m ├── pascal_toy └── data │ └── car_set_1 │ ├── 001.jpg │ ├── 001.mat │ ├── 002.jpg │ ├── 002.mat │ ├── 003.jpg │ ├── 003.mat │ ├── 004.jpg │ ├── 004.mat │ ├── 005.jpg │ ├── 005.mat │ ├── 006.jpg │ ├── 006.mat │ ├── 007.jpg │ ├── 007.mat │ ├── 008.jpg │ ├── 008.mat │ ├── 009.jpg │ ├── 009.mat │ ├── 010.jpg │ ├── 010.mat │ ├── 011.jpg │ ├── 011.mat │ ├── 012.jpg │ ├── 012.mat │ ├── 013.jpg │ ├── 013.mat │ ├── 014.jpg │ ├── 014.mat │ ├── 015.jpg │ ├── 015.mat │ ├── 016.jpg │ ├── 016.mat │ ├── 017.jpg │ ├── 017.mat │ ├── 018.jpg │ ├── 018.mat │ ├── 019.jpg │ ├── 019.mat │ ├── 020.jpg │ └── 020.mat ├── priority.m ├── prune2cycle.m ├── updateflows.m └── util ├── fdist.m ├── flowCellToMat.m ├── flowMatToCell.m ├── imgWarp.m └── loadImageSet.m /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Tinghui Zhou 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## FlowWeb: Joint Image Set Alignment by Weaving Consistent, Pixel-wise Correspondences 2 | 3 | This implements the joint image alignment algorithm described in our CVPR 2015 [paper](http://www.eecs.berkeley.edu/~tinghuiz/projects/flowWeb/). 4 | 5 | This is unsupported research code, with no warranty or claim of suitability for 6 | any particular purpose. However, feel free to contact me (tinghuiz at eecs dot berkeley dot edu) if you have any difficulty running the code or found a bug. 7 | 8 | ## Running the Code 9 | 10 | Check out demo.m for how to run our joint alignment algorithm as well as the evaluation described in our CVPR paper. 11 | 12 | ## CVPR experiments 13 | The PASCAL VOC data (images and annotations) used for producing results in Table 1 and 2 can be downloaded [here](http://www.eecs.berkeley.edu/~tinghuiz/data/pascal_data.tar.gz). The original data are collected from the [PASCAL3D+](http://cvgl.stanford.edu/projects/pascal3d.html) as well as the [PASCAL-Part](http://www.stat.ucla.edu/~xianjie.chen/pascal_part_dataset/pascal_part.html) datasets. 14 | 15 | Our alignment results on the above PASCAL VOC data are available [here](http://www.eecs.berkeley.edu/~tinghuiz/data/pascal_results.tar.gz). -------------------------------------------------------------------------------- /demo.m: -------------------------------------------------------------------------------- 1 | class = 'car'; 2 | setid = 1; 3 | baseDir = 'pascal_toy/'; 4 | initMethod = 'dsp'; 5 | % The intra-image phase is GPU accelerated 6 | gpu = 1; 7 | % Setup relavent paths and parameters 8 | alignSetup; 9 | % Load the input image set 10 | ims = loadImageSet(imgDir); 11 | % Initialize FlowWeb 12 | [pairvx, pairvy] = initflows(ims, initDir); 13 | % Joint alignment 14 | [pairvx, pairvy] = jointAlign(pairvx, pairvy, params); 15 | % Save aligned FlowWeb 16 | [pairvx, pairvy] = flowMatToCell(pairvx, pairvy, size(ims{1},1)); 17 | save([resDir, 'pairflows.mat'], 'pairvx', 'pairvy'); 18 | 19 | % Evaluation 20 | metric = 'keypoint'; % can also be 'part' 21 | 22 | evalParams = []; 23 | evalParams.metric = metric; 24 | evalParams.alpha = 0.05; 25 | evalParams.resRoot = [baseDir '/results/' imgset '/']; 26 | evalParams.annoDir = imgDir; 27 | 28 | evalParams.method = 'dsp'; 29 | resInit = evaluate(evalParams); 30 | evalParams.method = 'flowweb'; 31 | resOurs = evaluate(evalParams); 32 | fprintf('class = %s, setid = %d, metric = %s\n', class, setid, metric); 33 | fprintf('DSP (initialization) = %.3f, Ours = %.3f\n', resInit, resOurs) 34 | 35 | -------------------------------------------------------------------------------- /external/MinMaxSelection/Contents.txt: -------------------------------------------------------------------------------- 1 | Main Functions: 2 | mink.m -> Matlab file to look for k-smallest elements 3 | maxk.m -> Matlab file to look for k-largest elements 4 | 5 | Other files: 6 | minmaxk.m -> Common Matlab wrapper for mink.m and maxk.m 7 | minkmex.c -> Mex engine for mink.m 8 | minkmex.m -> Help file for Mex minkmex 9 | maxkmex.c -> Mex engine for maxk.m 10 | maxkmex.m -> Help file for Mex maxkmex 11 | buildInternal_mxArrayDef.m -> building the typedef for mxArray 12 | inplacecolumnmex.c -> Create inplace column of a full matrix 13 | releaseinplace.c -> release the data of the inplace array 14 | minmax_install.m -> Installation function (mex build) 15 | getmexopts.m -> Tool to get the current MEX setup 16 | testminmax.m -> Test program of Min/Max Selection Package 17 | Contents.txt -> This file 18 | Internal_mxArray_2010B.h -> Prototype file for R2010b 19 | 20 | Author Bruno Luong 21 | Contributor: Matt Fig, James Tursa 22 | Last update: 27-August-2011 23 | -------------------------------------------------------------------------------- /external/MinMaxSelection/Internal_mxArray.h: -------------------------------------------------------------------------------- 1 | /* 2 | Internal_mxArray.h 3 | Matlab version: 2010B 4 | */ 5 | 6 | typedef struct { 7 | void *reserved; 8 | int reserved1[2]; 9 | void *reserved2; 10 | size_t number_of_dims; 11 | unsigned int reserved3; 12 | struct { 13 | unsigned int flag0 : 1; 14 | unsigned int flag1 : 1; 15 | unsigned int flag2 : 1; 16 | unsigned int flag3 : 1; 17 | unsigned int flag4 : 1; 18 | unsigned int flag5 : 1; 19 | unsigned int flag6 : 1; 20 | unsigned int flag7 : 1; 21 | unsigned int flag7a: 1; 22 | unsigned int flag8 : 1; 23 | unsigned int flag9 : 1; 24 | unsigned int flag10 : 1; 25 | unsigned int flag11 : 4; 26 | unsigned int flag12 : 8; 27 | unsigned int flag13 : 8; 28 | } flags; 29 | size_t reserved4[2]; 30 | union { 31 | struct { 32 | void *pdata; 33 | void *pimag_data; 34 | void *reserved5; 35 | size_t reserved6[3]; 36 | } number_array; 37 | } data; 38 | } Internal_mxArray; -------------------------------------------------------------------------------- /external/MinMaxSelection/Internal_mxArray_2010B.h: -------------------------------------------------------------------------------- 1 | /* 2 | Internal_mxArray.h 3 | Matlab version: 2010B 4 | */ 5 | 6 | typedef struct { 7 | void *reserved; 8 | int reserved1[2]; 9 | void *reserved2; 10 | size_t number_of_dims; 11 | unsigned int reserved3; 12 | struct { 13 | unsigned int flag0 : 1; 14 | unsigned int flag1 : 1; 15 | unsigned int flag2 : 1; 16 | unsigned int flag3 : 1; 17 | unsigned int flag4 : 1; 18 | unsigned int flag5 : 1; 19 | unsigned int flag6 : 1; 20 | unsigned int flag7 : 1; 21 | unsigned int flag7a: 1; 22 | unsigned int flag8 : 1; 23 | unsigned int flag9 : 1; 24 | unsigned int flag10 : 1; 25 | unsigned int flag11 : 4; 26 | unsigned int flag12 : 8; 27 | unsigned int flag13 : 8; 28 | } flags; 29 | size_t reserved4[2]; 30 | union { 31 | struct { 32 | void *pdata; 33 | void *pimag_data; 34 | void *reserved5; 35 | size_t reserved6[3]; 36 | } number_array; 37 | } data; 38 | } Internal_mxArray; -------------------------------------------------------------------------------- /external/MinMaxSelection/getmexopts.m: -------------------------------------------------------------------------------- 1 | function res = getmexopts(Tag) 2 | % function res = getmexopts(Tag) 3 | % Get the MCC or MEX configuration 4 | % Author Bruno Luong 5 | % Last update: 29-Jun-2009 6 | 7 | if ispc() 8 | optpath=prefdir; 9 | optfile=[optpath filesep 'compopts.bat']; 10 | mexoptfile=[optpath filesep 'mexopts.bat']; 11 | else 12 | optpath=matlabroot; 13 | optfile=[optpath '/bin/mbuildopts.sh']; 14 | mexoptfile=[optpath '/bin/mexopts.sh']; % not sure correct path 15 | end 16 | 17 | % Try to get MEX option first 18 | fid=fopen(mexoptfile,'r'); 19 | if fid<=0 20 | % Next MCC options 21 | fid=fopen(optfile,'r'); 22 | end 23 | 24 | if fid>0 25 | iscompilerline=@(S) (strcmp(S,['set ' Tag])); 26 | C=textscan(fid,'%s %s', 'delimiter', '=', 'whitespace', ''); 27 | fclose(fid); 28 | cline=find(cellfun(iscompilerline,C{1})); 29 | if isempty(cline) 30 | error('getmexopt [Bruno]: cannot get Tag %s', Tag) 31 | end 32 | res=C{2}{cline}; 33 | root=regexprep(matlabroot,'\\','\\\\'); 34 | res = regexprep(res,'%MATLAB%',root); 35 | else 36 | error('getmexopts [Bruno]: cannot open comopts.bat file') 37 | end 38 | 39 | % Bruno -------------------------------------------------------------------------------- /external/MinMaxSelection/inplacecolumnmex.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/MinMaxSelection/inplacecolumnmex.mexa64 -------------------------------------------------------------------------------- /external/MinMaxSelection/inplacecolumnmex.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/MinMaxSelection/inplacecolumnmex.mexmaci64 -------------------------------------------------------------------------------- /external/MinMaxSelection/inplacecolumnmex.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/MinMaxSelection/inplacecolumnmex.mexw64 -------------------------------------------------------------------------------- /external/MinMaxSelection/maxk.m: -------------------------------------------------------------------------------- 1 | function varargout = maxk(varargin) 2 | % function res = MAXK(list, k) 3 | % 4 | % If LIST is a vector, MAXK returns in RES the K largest elements of LIST 5 | % RES is sorted in descending order 6 | % [res loc] = MAXK(...) 7 | % Location of the largest elements: RES=LIST(LOC) 8 | % If list is a matrix, MAXK operates along the first dimension 9 | % Use MAXK(..., dim) to operate along the dimension dim 10 | % MAXK(..., dim, 'sorting', false) to disable the post-sorting step 11 | % (true by default) 12 | % 13 | % Author Bruno Luong 14 | % Contributor: Matt Fig 15 | % Last update: 07/April/2009 16 | % 10/Jan/2010: possibility to disable post-sorting step 17 | 18 | nout=cell(1,max(1,nargout)); 19 | [nout{:}] = minmaxk(@maxkmex, varargin{:}); 20 | varargout=nout; 21 | 22 | -------------------------------------------------------------------------------- /external/MinMaxSelection/maxkmex.m: -------------------------------------------------------------------------------- 1 | % function [res loc] = maxkmex(list, k) 2 | % 3 | % Matlab C-Mex 4 | % Purpose: Same as MAXK, i.e., 5 | % Return in RES the K largest elements of LIST 6 | % LOC is Location of the largest values: RES=LIST(LOC) 7 | % This MEX works on double only, and output RES is unsorted 8 | % Algorithm according to http://en.wikipedia.org/wiki/Selection_algorithm 9 | % Compilation: mex -O -v maxkmex.c 10 | % Author Bruno Luong 11 | % Last update: 07/April/2009 12 | % 13 | 14 | error('Mex file not yet compiled. Action: mex -O -v maxkmex.c'); -------------------------------------------------------------------------------- /external/MinMaxSelection/maxkmex.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/MinMaxSelection/maxkmex.mexa64 -------------------------------------------------------------------------------- /external/MinMaxSelection/maxkmex.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/MinMaxSelection/maxkmex.mexmaci64 -------------------------------------------------------------------------------- /external/MinMaxSelection/maxkmex.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/MinMaxSelection/maxkmex.mexw64 -------------------------------------------------------------------------------- /external/MinMaxSelection/mink.m: -------------------------------------------------------------------------------- 1 | function varargout = mink(varargin) 2 | % function res = MINK(list, k) 3 | % 4 | % If LIST is a vector, MINK returns in RES the K smallest elements of LIST 5 | % RES is sorted in ascending order 6 | % [res loc] = MINK(...) 7 | % Location of the smallest elements: RES=LIST(LOC) 8 | % If list is a matrix, MINK operates along the first dimension 9 | % Use MINK(..., dim) to operate along the dimension dim 10 | % MINK(..., dim, 'sorting', false) to disable the post-sorting step 11 | % (true by default) 12 | % 13 | % Author Bruno Luong 14 | % Contributor: Matt Fig 15 | % Last update: 07/April/2009 16 | % 10/Jan/2010: possibility to disable post-sorting step 17 | 18 | 19 | nout=cell(1,max(1,nargout)); 20 | [nout{:}] = minmaxk(@minkmex, varargin{:}); 21 | varargout=nout; 22 | -------------------------------------------------------------------------------- /external/MinMaxSelection/minkmex.m: -------------------------------------------------------------------------------- 1 | % function [res loc] = minkmex(list, k) 2 | % 3 | % Matlab C-Mex 4 | % Purpose: Same as MINK, i.e., 5 | % Return in RES the K smallest elements of LIST 6 | % LOC is Location of the smallest values: RES=LIST(LOC) 7 | % This MEX works on double only, and output RES is unsorted 8 | % Algorithm according to http://en.wikipedia.org/wiki/Selection_algorithm 9 | % Compilation: mex -O -v minkmex.c 10 | % Author Bruno Luong 11 | % Last update: 07/April/2009 12 | % 13 | 14 | error('Mex file not yet compiled. Action: mex -O -v minkmex.c') -------------------------------------------------------------------------------- /external/MinMaxSelection/minkmex.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/MinMaxSelection/minkmex.mexa64 -------------------------------------------------------------------------------- /external/MinMaxSelection/minkmex.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/MinMaxSelection/minkmex.mexmaci64 -------------------------------------------------------------------------------- /external/MinMaxSelection/minkmex.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/MinMaxSelection/minkmex.mexw64 -------------------------------------------------------------------------------- /external/MinMaxSelection/minmax_install.m: -------------------------------------------------------------------------------- 1 | function minmax_install 2 | % function minmax_install 3 | % Installation by building the C-mex files for min/max selection package 4 | % 5 | % Author Bruno Luong 6 | % Last update: 29-Jun-2009 built inplace functions 7 | 8 | thisfile = mfilename('fullpath'); 9 | path = fileparts(thisfile); 10 | oldpath = cd(path); 11 | 12 | arch=computer('arch'); 13 | mexopts = {'-v' '-O' ['-' arch]}; 14 | % 64-bit platform 15 | if ~isempty(strfind(computer(),'64')) 16 | mexopts(end+1) = {'-largeArrayDims'}; 17 | end 18 | 19 | if ispc() && datenum(version('-date')) < datenum('January 11, 2014') 20 | compiler = getmexopts('COMPILER'); 21 | islcc = strcmpi(compiler,'lcc'); 22 | % Define the C-symbol for LCC compiler 23 | if islcc 24 | mexopts(end+1) = {'-D_LCC'}; 25 | end 26 | end 27 | 28 | % Internal representation of mxArray 29 | try 30 | buildInternal_mxArrayDef('Internal_mxArray.h'); 31 | catch 32 | if ispc() 33 | cpcmd = 'copy'; 34 | else 35 | cpcmd = ' cp'; 36 | end 37 | cmd = [cpcmd ' Internal_mxArray_2010B.h Internal_mxArray.h']; 38 | system(cmd); 39 | end 40 | 41 | % Inplace tool 42 | mex(mexopts{:},'inplacecolumnmex.c'); 43 | mex(mexopts{:},'releaseinplace.c'); 44 | 45 | % Mex MIN/MAX functions 46 | mex(mexopts{:},'minkmex.c'); 47 | mex(mexopts{:},'maxkmex.c'); 48 | 49 | cd(oldpath); 50 | 51 | end -------------------------------------------------------------------------------- /external/MinMaxSelection/releaseinplace.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/MinMaxSelection/releaseinplace.mexa64 -------------------------------------------------------------------------------- /external/MinMaxSelection/releaseinplace.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/MinMaxSelection/releaseinplace.mexmaci64 -------------------------------------------------------------------------------- /external/MinMaxSelection/releaseinplace.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/MinMaxSelection/releaseinplace.mexw64 -------------------------------------------------------------------------------- /external/MinMaxSelection/testminmax.m: -------------------------------------------------------------------------------- 1 | % Author Bruno Luong 2 | % Last update: 07/April/2009 3 | % Script to tets min/max selection 4 | 5 | clear 6 | 7 | try 8 | minkmex(1,1); 9 | minkmex(1,1); 10 | catch 11 | minmax_install(); 12 | end 13 | 14 | n=1e7; 15 | k=10; 16 | 17 | ntest=10; 18 | 19 | % Timing 20 | disp('Time the algorithms for few seconds...'); 21 | tmink=zeros(1,ntest); 22 | tmaxk=zeros(1,ntest); 23 | tsort=zeros(1,ntest); 24 | for i=1:ntest 25 | list=rand(1,n); 26 | 27 | tic 28 | mn=mink(list,k); 29 | tmink(i)=toc; 30 | 31 | tic 32 | mx=maxk(list,k); 33 | tmaxk(i)=toc; 34 | 35 | tic 36 | s=sort(list); 37 | smn=s(1:k); 38 | smx=s(end:-1:end-k+1); 39 | tsort(i)=toc; 40 | 41 | if ~isequal(mn,smn) || ~isequal(mx,smx) 42 | keyboard; 43 | end 44 | end 45 | 46 | fprintf('Timing mink: %f [s]\n',median(tmink)); 47 | fprintf('Timing maxk: %f [s]\n',median(tmaxk)); 48 | fprintf('Timing sort: %f [s]\n',median(tsort)); -------------------------------------------------------------------------------- /external/dsp-code/DSPDemo.m: -------------------------------------------------------------------------------- 1 | load ct101_example_data.mat im1 im2 anno1 anno2 2 | 3 | pca_basis = []; 4 | sift_size = 4; 5 | 6 | % extract SIFT 7 | [sift1, bbox1] = ExtractSIFT(im1, pca_basis, sift_size); 8 | [sift2, bbox2] = ExtractSIFT(im2, pca_basis, sift_size); 9 | im1 = im1(bbox1(3):bbox1(4), bbox1(1):bbox1(2), :); 10 | im2 = im2(bbox2(3):bbox2(4), bbox2(1):bbox2(2), :); 11 | anno1 = anno1(bbox1(3):bbox1(4), bbox1(1):bbox1(2), :); 12 | anno2 = anno2(bbox2(3):bbox2(4), bbox2(1):bbox2(2), :); 13 | 14 | % Match 15 | tic; 16 | [vx,vy] = DSPMatch(sift1, sift2); 17 | t_match = toc; 18 | 19 | % Evaluation 20 | [seg, acc] = TransferLabelAndEvaluateAccuracy(anno1, anno2, vx, vy); 21 | acc.time = t_match; 22 | 23 | % Warping 24 | warp21=warpImage(im2double(im2),vx,vy); % im2 --> im1 25 | 26 | disp('----------------------------') 27 | disp('label transfer accuracy') 28 | disp(acc) 29 | 30 | figure, 31 | subplot(2,2,1); 32 | imshow(im1); 33 | title('image1'); 34 | subplot(2,2,3); 35 | imshow(im2); 36 | title('image2'); 37 | subplot(2,2,2); 38 | imshow(warp21); 39 | title('warp 2-->1'); 40 | subplot(2,2,4); 41 | imshow(seg); 42 | title('label transfer 2-->1'); -------------------------------------------------------------------------------- /external/dsp-code/DSPDemo_CT101.m: -------------------------------------------------------------------------------- 1 | % input 2 | % im1, im2 : input images to match 3 | % anno1, anno2: ground truth object annotation for evaluation 4 | % pca_basis: pca basis for dimensionality reduction of sift 5 | 6 | load ct101_example_data.mat im1 im2 anno1 anno2 7 | load ct101_pca_basis.mat pca_basis 8 | % pca_basis = []; % if you want to use the sift of original dimension 9 | sift_size = 4; % sift patch size 16 x 16 pixels (i.e., patch_size = 4*sift_size) 10 | 11 | % extract SIFT 12 | [sift1, bbox1] = ExtractSIFT(im1, pca_basis, sift_size); 13 | [sift2, bbox2] = ExtractSIFT(im2, pca_basis, sift_size); 14 | im1 = im1(bbox1(3):bbox1(4), bbox1(1):bbox1(2), :); 15 | im2 = im2(bbox2(3):bbox2(4), bbox2(1):bbox2(2), :); 16 | anno1 = anno1(bbox1(3):bbox1(4), bbox1(1):bbox1(2), :); 17 | anno2 = anno2(bbox2(3):bbox2(4), bbox2(1):bbox2(2), :); 18 | 19 | % Match 20 | tic; 21 | [vx,vy] = DSPMatch(sift1, sift2); 22 | t_match = toc; 23 | 24 | % Evaluation 25 | [acc, seg] = EvaluateCT101Match(anno1, anno2, vx, vy); 26 | acc.time = t_match; 27 | 28 | % Warping 29 | warp21=warpImage(im2double(im2),vx,vy); % im2 --> im1 30 | 31 | disp('----------------------------') 32 | disp('accuracy') 33 | disp(acc) 34 | 35 | figure, 36 | subplot(2,2,1); 37 | imshow(im1); 38 | title('image1'); 39 | subplot(2,2,3); 40 | imshow(im2); 41 | title('image2'); 42 | subplot(2,2,2); 43 | imshow(warp21); 44 | title('warp 2-->1'); 45 | subplot(2,2,4); 46 | imshow(seg); 47 | title('label transfer 2-->1'); -------------------------------------------------------------------------------- /external/dsp-code/DT.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //#include "omp.h" 4 | //#include "openmpflag.h" 5 | //#include 6 | //#include "mex.h" 7 | 8 | /* dt of 1d function using squared distance */ 9 | void DT1d(float *f, int n, float c, float d); 10 | void DT2d(float* im, int width, int height, float c, float d); 11 | void DT3d(float* im, int width, int height, int depth, float c[3], float d[3]); 12 | void Integral2D(float* src, float* dst, int width, int height); 13 | void Integral2D(double* src, double* dst, int width, int height); -------------------------------------------------------------------------------- /external/dsp-code/EvaluateLMOMatch.m: -------------------------------------------------------------------------------- 1 | function [accuracy, seg] = EvaluateLMOMatch(anno1, anno2, vx, vy) 2 | 3 | [seg, in_bound] = TransferAnnotation(anno2, vx,vy); 4 | 5 | % fill out-bound label 6 | [d l] = bwdist(in_bound); 7 | seg(~in_bound) = seg(l(~in_bound)); 8 | 9 | % evaluation 10 | label1 = setdiff(unique(anno1(:)), 0); 11 | label2 = setdiff(unique(anno2(:)), 0); 12 | common_label = intersect(label1,label2); 13 | tf = false(size(anno1)); 14 | for i = 1 : numel(common_label) 15 | tf(anno1 == common_label(i)) = true; 16 | end 17 | mean_acc = mean2(seg(tf) == anno1(tf)); 18 | accuracy.mean = mean_acc; 19 | accuracy.n_pixel = sum(tf(:)); 20 | accuracy.n_hit = sum(seg(tf) == anno1(tf)); 21 | -------------------------------------------------------------------------------- /external/dsp-code/ExtractSIFT.m: -------------------------------------------------------------------------------- 1 | function [sift1, bbox1, mag1] = ExtractSIFT(im1, pca_basis, sift_size) 2 | 3 | if ( nargin <= 2) 4 | sift_size = 4; 5 | end 6 | 7 | if (ndims(im1) == 3 ) 8 | im1 = rgb2gray(im1); 9 | end 10 | im1 = single(im1); 11 | 12 | % Extract SIFT 13 | [f1, sift1] = vl_dsift(im1, 'step', 1, 'size', sift_size, 'norm', 'FloatDescriptors', 'fast'); 14 | 15 | if ( ~isempty(pca_basis) ) % dimensionality reduction 16 | sift1 = pca_basis'*sift1; 17 | end 18 | 19 | % Formatting 20 | x1 = unique(f1(1,:)); 21 | y1 = unique(f1(2,:)); 22 | width1 = numel(x1); 23 | height1 = numel(y1); 24 | sift1 = reshape(sift1', [height1, width1, size(sift1,1)]); 25 | mag1 = reshape(f1(3,:), [height1, width1]); 26 | 27 | lx = min(f1(1,:)); 28 | rx = max(f1(1,:)); 29 | ty = min(f1(2,:)); 30 | dy = max(f1(2,:)); 31 | bbox1 = [lx,rx,ty,dy]'; 32 | -------------------------------------------------------------------------------- /external/dsp-code/ExtractSIFT_WithPadding.m: -------------------------------------------------------------------------------- 1 | function [sift1, mag1] = ExtractSIFT_WithPadding(im1, pca_basis, sift_size) 2 | 3 | if ( nargin <= 2) 4 | sift_size = 4; 5 | end 6 | 7 | if (ndims(im1) == 3 ) 8 | im1 = rgb2gray(im1); 9 | end 10 | im1 = single(im1); 11 | 12 | 13 | % pad 14 | pad_size = ceil(1 + 3/2 * sift_size); 15 | [h0,w0,~] = size(im1); 16 | im1 = padarray(im1, [pad_size, pad_size], 'replicate', 'both'); 17 | pad_lx = pad_size + 1; 18 | pad_ty = pad_size + 1; 19 | 20 | % Extract SIFT 21 | [f1, sift1] = vl_dsift(im1, 'step', 1, 'size', sift_size, 'norm', 'FloatDescriptors', 'fast'); 22 | if ( ~isempty(pca_basis) ) % dimensionality reduction 23 | sift1 = pca_basis'*sift1; 24 | end 25 | 26 | % Formatting 27 | x1 = unique(f1(1,:)); 28 | y1 = unique(f1(2,:)); 29 | width1 = numel(x1); 30 | height1 = numel(y1); 31 | sift1 = reshape(sift1', [height1, width1, size(sift1,1)]); 32 | mag1 = reshape(f1(3,:), [height1, width1]); 33 | 34 | lx = min(f1(1,:)); 35 | ty = min(f1(2,:)); 36 | blx = pad_lx - lx + 1; 37 | bty = pad_ty - ty + 1; 38 | 39 | % cut -- back to original image 40 | sift1 = sift1(bty : bty + h0-1, blx : blx + w0-1, :); 41 | mag1 = mag1(bty : bty + h0-1, blx : blx + w0-1); 42 | 43 | -------------------------------------------------------------------------------- /external/dsp-code/PixelMatchMex.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/PixelMatchMex.mexa64 -------------------------------------------------------------------------------- /external/dsp-code/PixelMatchMex.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/PixelMatchMex.mexmaci64 -------------------------------------------------------------------------------- /external/dsp-code/PixelMatchMex.mexw32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/PixelMatchMex.mexw32 -------------------------------------------------------------------------------- /external/dsp-code/README.txt: -------------------------------------------------------------------------------- 1 | Deformable Spatial Pyramid Matching for Fast Dense Correspondences 2 | 3 | Install 4 | This code is tested in Ubuntu 12.04 (GCC 4.4, 64bit) and Windows (VS2008 and 2012, 32bit) under MATLAB R2011a and R2013a. 5 | To install, simply run mex_compile.m in MATLAB 6 | 7 | Run example codes 8 | - Before you run the codes, you have to set up the MATLAB path for the external library: run('vlfeat-0.9.17/toolbox/vl_setup.m') 9 | DSPDemo.m : Include SIFT extraction (128-dim) and DSP matching 10 | DSPDemo_CT101.m: Include PCA-SIFT (20-dim) and DSP matching in Caltech-101 dataset 11 | DSPDemo_LMO.m: Include PCA-SIFT (20-dim) and DSP matching in LabelMe Outdoor dataset 12 | 13 | Multi-thread running 14 | The codes run in multi-thread by default. 15 | To turn off the multi-thread option, open "openmpflag.h" and comment #define __OPEN_MP 16 | 17 | Run-time 18 | The run-time in the paper is from Intel Xeon X5690 (3.47GHz) with 16 cores. 19 | 20 | Citation 21 | Jaechul Kim, Ce Liu, Fei Sha, Kristen Grauman, 22 | Deformable Spatial Pyramid Matching for Fast Dense Correspondences, CVPR 2013 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /external/dsp-code/SPBP.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "SPGraph.h" 7 | 8 | using namespace std; 9 | 10 | struct SPBPParams { 11 | int n_sp_level; 12 | int n_state; 13 | int n_xstate; 14 | int n_ystate; 15 | }; 16 | 17 | 18 | 19 | class SPBP { 20 | public: 21 | SPBP(SPBPParams& params); 22 | virtual ~SPBP(); 23 | 24 | public: 25 | 26 | void RunBP(float* unary_potential, float deformation_coeff, float truncate_value, int max_iter); 27 | void GetOptimalState(int* optimal_state_); 28 | double ComputeEnergy(); 29 | 30 | private: 31 | 32 | void TopdownMessagePassing(); 33 | void BottomupMessagePassing(); 34 | void ForwardMessagePassing(); 35 | void BackwardMessagePassing(); 36 | void UpdateMessage(int src_idx, int dst_idx); 37 | bool ComputeOptimalState(); 38 | 39 | private: 40 | float* unary; 41 | float* belief; 42 | float* message; 43 | 44 | int* optimal_state; 45 | float m_deformation_coeff; 46 | float m_truncate_value; 47 | SPGraph sp_graph; 48 | SPBPParams bp_params; 49 | }; 50 | 51 | -------------------------------------------------------------------------------- /external/dsp-code/SPBPMex.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/SPBPMex.mexa64 -------------------------------------------------------------------------------- /external/dsp-code/SPBPMex.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/SPBPMex.mexmaci64 -------------------------------------------------------------------------------- /external/dsp-code/SPBPMex.mexw32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/SPBPMex.mexw32 -------------------------------------------------------------------------------- /external/dsp-code/SPGraph.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | class SPGraph { 9 | public: 10 | explicit SPGraph(int n_level); 11 | SPGraph(const SPGraph& that); 12 | SPGraph& operator = ( const SPGraph& that); 13 | 14 | virtual ~SPGraph(); 15 | 16 | public: 17 | void GetNodeIndsAtLevelK(int level_idx, int node_inds[2]); 18 | int GetParentNodeIdx(int node_idx); 19 | void GetChildrenNodeInds(int node_idx, int children_inds[4]); 20 | void GetNeighborNodeInds(int node_idx, int neighbor_inds[4]); 21 | int GetNumEdge()const { return n_edge;}; 22 | int GetNumNode()const { return n_node;}; 23 | int GetEdgeIdx(int node_idx1, int node_idx2); 24 | pair& GetNodeIdx(int edge_idx) { return edge2node[edge_idx]; }; 25 | 26 | private: 27 | int* node2level; 28 | int* node2edge; 29 | vector > edge2node; 30 | int n_node; 31 | int n_edge; 32 | int n_level; 33 | }; 34 | 35 | -------------------------------------------------------------------------------- /external/dsp-code/SPNodeMatchMex.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/SPNodeMatchMex.mexa64 -------------------------------------------------------------------------------- /external/dsp-code/SPNodeMatchMex.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/SPNodeMatchMex.mexmaci64 -------------------------------------------------------------------------------- /external/dsp-code/SPNodeMatchMex.mexw32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/SPNodeMatchMex.mexw32 -------------------------------------------------------------------------------- /external/dsp-code/TransferAnnotation.m: -------------------------------------------------------------------------------- 1 | function [anno1, in_bound] = TransferAnnotation(anno2, vx,vy) 2 | % x2 = x1 + vx, y2 = y1 + vy 3 | 4 | [h1,w1] = size(vx); 5 | [h2,w2] = size(anno2); 6 | 7 | [x1,y1] = meshgrid(1:w1, 1:h1); 8 | x2 = x1 + vx; 9 | y2 = y1 + vy; 10 | in_bound = x2 >= 1 & x2 <= w2 & y2 >= 1 & y2 <= h2; 11 | 12 | inds1 = sub2ind([h1,w1], y1(in_bound), x1(in_bound)); 13 | inds2 = sub2ind([h2,w2], y2(in_bound), x2(in_bound)); 14 | 15 | anno1 = zeros(h1,w1); 16 | anno1(inds1) = anno2(inds2); 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /external/dsp-code/ct101_example_data.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/ct101_example_data.mat -------------------------------------------------------------------------------- /external/dsp-code/ct101_pca_basis.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/ct101_pca_basis.mat -------------------------------------------------------------------------------- /external/dsp-code/im1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/im1.mat -------------------------------------------------------------------------------- /external/dsp-code/im2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/im2.mat -------------------------------------------------------------------------------- /external/dsp-code/imgs.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/imgs.mat -------------------------------------------------------------------------------- /external/dsp-code/lmo_example_data.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/lmo_example_data.mat -------------------------------------------------------------------------------- /external/dsp-code/lmo_pca_basis.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/lmo_pca_basis.mat -------------------------------------------------------------------------------- /external/dsp-code/mex_compile.m: -------------------------------------------------------------------------------- 1 | if ( ispc ) 2 | mex -f ./mexopts.bat SPNodeMatchMex.cpp SPNodeMatch.cpp DT.cpp 3 | mex -f ./mexopts.bat SPBPMex.cpp SPBP.cpp SPGraph.cpp DT.cpp 4 | mex -f ./mexopts.bat PixelMatchMex.cpp PixelMatch.cpp 5 | elseif ( isunix ) 6 | mex -f ./gccopts.sh SPNodeMatchMex.cpp SPNodeMatch.cpp DT.cpp 7 | mex -f ./gccopts.sh SPBPMex.cpp SPBP.cpp SPGraph.cpp DT.cpp 8 | mex -f ./gccopts.sh PixelMatchMex.cpp PixelMatch.cpp 9 | else 10 | disp('NOT SUPPORTED'); 11 | end 12 | -------------------------------------------------------------------------------- /external/dsp-code/obj_colormap.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/obj_colormap.mat -------------------------------------------------------------------------------- /external/dsp-code/openmpflag.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #define __OPEN_MP 3 | -------------------------------------------------------------------------------- /external/dsp-code/seg2color.m: -------------------------------------------------------------------------------- 1 | % function to get the color map of object segmentation 2 | function Im=seg2color(seg,objcolormap) 3 | 4 | seg = seg +1; 5 | [height,width]=size(seg); 6 | Im=zeros(height*width,3); 7 | nClasses=size(objcolormap,1); 8 | 9 | for i=1:nClasses 10 | index=find(seg==i); 11 | if ~isempty(index) 12 | Im(index,:)=repmat(objcolormap(i,:),[length(index),1]); 13 | end 14 | end 15 | 16 | Im=reshape(Im,[height width 3]); -------------------------------------------------------------------------------- /external/dsp-code/sifts.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/sifts.mat -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/.gitattributes: -------------------------------------------------------------------------------- 1 | *.manifest -crlf -diff -merge 2 | *.vcproj binary 3 | *.sln binary 4 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/.gitignore: -------------------------------------------------------------------------------- 1 | # Mac OS X Finder 2 | .DS_Store 3 | 4 | # MEX files 5 | *.mexglx 6 | *.mexmac 7 | *.mexmaci 8 | *.mexmaci64 9 | *.mexa64 10 | *.mex 11 | 12 | # Python 13 | *.pyc 14 | 15 | # Other generated files and directories 16 | VERSION 17 | docsrc/version.html 18 | bin 19 | results 20 | doc 21 | build 22 | toolbox/mexw32 23 | toolbox/mexmaci 24 | toolbox/mexmaci64 25 | toolbox/mexmac 26 | toolbox/mexglx 27 | toolbox/mexa64 28 | toolbox/mexw64 29 | toolbox/mex 30 | toolbox/noprefix 31 | 32 | # Xcode 33 | vlfeat.xcodeproj/*.mode1 34 | vlfeat.xcodeproj/*.mode1v3 35 | vlfeat.xcodeproj/*.mode2v3 36 | vlfeat.xcodeproj/*.pbxuser 37 | vlfeat.xcodeproj/*.perspective* 38 | vlfeat.xcodeproj/*.xcworkspace 39 | vlfeat.xcodeproj/xcuserdata 40 | 41 | # Visual C++ 42 | vlfeat.suo 43 | vlfeat.ncb 44 | vlfeat.vcproj.*.user 45 | vc/* 46 | 47 | # Emacs backups 48 | *~ 49 | 50 | # Vim swap files 51 | .*.swp 52 | 53 | # Opt directory 54 | opt/* -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (C) 2007-11, Andrea Vedaldi and Brian Fulkerson 2 | Copyright (C) 2012-13, The VLFeat Team 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the 13 | distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/apps/recognition/extendDescriptorsWithGeometry.m: -------------------------------------------------------------------------------- 1 | function descrs = extendDescriptorsWithGeometry(type, frames, descrs) 2 | % EXTENDDESCRIPTORSWITHGEOMETRY Extend feature descriptors with geometric components 3 | % DESCRS = EXTENDDESCRIPTORSWITHGEOMETRY(TYPE, FRAMES, DESCRS) 4 | % extends the descriptorss DESCRS with either nothing (TYPE = 5 | % 'none') or XY (TYPE = 'xy') from the FRAMES matrix. Note that, 6 | % for this to make sense, DESCRS and FRAMES should be properly normalized. 7 | 8 | % Author: Andrea Vedaldi 9 | 10 | % Copyright (C) 2013 Andrea Vedaldi 11 | % All rights reserved. 12 | % 13 | % This file is part of the VLFeat library and is made available under 14 | % the terms of the BSD license (see the COPYING file). 15 | 16 | 17 | switch lower(type) 18 | case 'none' 19 | case 'xy' 20 | z = frames(1:2,:) ; 21 | descrs = cat(1, descrs, z) ; 22 | otherwise 23 | error('Uknown geometric extension ''%s''.', type) ; 24 | end 25 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/apps/recognition/readImage.m: -------------------------------------------------------------------------------- 1 | function [im, scale] = readImage(imagePath) 2 | % READIMAGE Read and standardize image 3 | % [IM, SCALE] = READIMAGE(IMAGEPATH) reads the specified image file, 4 | % converts the result to SINGLE class, and rescales the image 5 | % to have a maximum height of 480 pixels, returing the corresponding 6 | % scaling factor SCALE. 7 | % 8 | % READIMAGE(IM) where IM is already an image applies only the 9 | % standardization to it. 10 | 11 | % Author: Andrea Vedaldi 12 | 13 | % Copyright (C) 2013 Andrea Vedaldi 14 | % All rights reserved. 15 | % 16 | % This file is part of the VLFeat library and is made available under 17 | % the terms of the BSD license (see the COPYING file). 18 | 19 | if ischar(imagePath) 20 | try 21 | im = imread(imagePath) ; 22 | catch 23 | error('Corrupted image %s', imagePath) ; 24 | end 25 | else 26 | im = imagePath ; 27 | end 28 | 29 | im = im2single(im) ; 30 | 31 | scale = 1 ; 32 | if (size(im,1) > 480) 33 | scale = 480 / size(im,1) ; 34 | im = imresize(im, scale) ; 35 | im = min(max(im,0),1) ; 36 | end 37 | 38 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/apps/recognition/setupFMD.m: -------------------------------------------------------------------------------- 1 | function imdb = setupFMD(datasetDir, varargin) 2 | % SETUPSCENE67 Setup Flickr Material Dataset 3 | % This is similar to SETUPCALTECH101(), with modifications to setup 4 | % the Flickr Material Dataset accroding to the standard 5 | % evaluation protocols. 6 | % 7 | % See: SETUPCALTECH101(). 8 | 9 | % Author: Andrea Vedaldi 10 | 11 | % Copyright (C) 2013 Andrea Vedaldi 12 | % All rights reserved. 13 | % 14 | % This file is part of the VLFeat library and is made available under 15 | % the terms of the BSD license (see the COPYING file). 16 | 17 | opts.lite = false ; 18 | opts.seed = 1 ; 19 | opts.numTrain = 50 ; 20 | opts.numTest = 50 ; 21 | opts.autoDownload = true ; 22 | opts = vl_argparse(opts, varargin) ; 23 | 24 | % Download and unpack 25 | vl_xmkdir(datasetDir) ; 26 | if exist(fullfile(datasetDir, 'image', 'wood')) 27 | % ok 28 | elseif opts.autoDownload 29 | url = 'http://people.csail.mit.edu/celiu/CVPR2010/FMD/FMD.zip' ; 30 | fprintf('Downloading FMD data to ''%s''. This will take a while.', datasetDir) ; 31 | unzip(url, datasetDir) ; 32 | else 33 | error('FMD not found in %s', datasetDir) ; 34 | end 35 | 36 | imdb = setupGeneric(fullfile(datasetDir,'image'), ... 37 | 'numTrain', opts.numTrain, 'numVal', 0, 'numTest', opts.numTest, ... 38 | 'expectedNumClasses', 10, ... 39 | 'seed', opts.seed, 'lite', opts.lite) ; 40 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/data/box.pgm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/data/box.pgm -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/data/river1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/data/river1.jpg -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/data/river2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/data/river2.jpg -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/data/roofs1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/data/roofs1.jpg -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/data/roofs2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/data/roofs2.jpg -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/data/spots.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/data/spots.jpg -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/api.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/doc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

The VLFeat reference documentation has three parts:

5 | 6 | 7 | 8 | 14 | 21 | 28 | 29 |
9 |

MATLAB functions

10 |

The reference documentation of VLFeat MATLAB commands (this 11 | is an on-line version of the documentation built in the 12 | command themsevles).

13 |
15 |

C API 16 | reference

This documentation 17 | includes descriptions of all the algorithms and hence 18 | it is useful even if you do not plan to use the C library 19 | directly.

20 |
22 |

Man pages

23 |

The documentation of the command line 24 | utilities bundled with VLFeat (this is an on-line version 25 | of the Unix man found in the src/ 26 | subdirectory.

27 |
30 | 31 |

In addition to the documentation, there are also 32 | tutorials which introduce many of the 33 | algorithms contained in the library.

34 | 35 |
36 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/dtd/xhtml1/xhtml.soc: -------------------------------------------------------------------------------- 1 | OVERRIDE YES 2 | -- Oasis entity catalog for Extensible HTML 1.0 -- 3 | 4 | PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "xhtml1-strict.dtd" 5 | PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd" 6 | PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "xhtml1-frameset.dtd" 7 | 8 | -- ISO latin 1 entity set for Extensible HTML (XML 1.0 format) -- 9 | 10 | PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN" "xhtml-lat1.ent" 11 | PUBLIC "-//W3C//ENTITIES Symbols for XHTML//EN" "xhtml-symbol.ent" 12 | PUBLIC "-//W3C//ENTITIES Special for XHTML//EN" "xhtml-special.ent" 13 | 14 | SGMLDECL "xhtml1.dcl" 15 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/figures/sift-frame.fig: -------------------------------------------------------------------------------- 1 | #FIG 3.2 Produced by xfig version 3.2.5 2 | Landscape 3 | Center 4 | Inches 5 | Letter 6 | 100.00 7 | Single 8 | -2 9 | 1200 2 10 | 5 1 0 2 0 7 50 -1 -1 0.000 0 0 1 0 2191.221 2007.241 3225 2025 3105 2491 3070 2552 11 | 2 1 4.00 60.00 60.00 12 | 6 1350 375 6225 4050 13 | 2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 14 | 1 1 5.00 121.21 121.21 15 | 1451 476 1451 4011 16 | 2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 17 | 1 1 5.00 121.21 121.21 18 | 1451 476 6199 476 19 | 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 20 | 1451 476 5700 476 5700 3600 1451 3600 1451 476 21 | 4 0 0 50 -1 0 12 0.0000 2 210 315 1653 3910 $y$\001 22 | 4 0 0 50 -1 0 12 0.0000 2 180 315 5795 880 $x$\001 23 | -6 24 | 1 3 0 2 0 7 50 -1 -1 0.000 1 0.0000 2250 2025 382 382 2250 2025 2632 2025 25 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 26 | 2250 2025 3450 2850 27 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 28 | 2325 2025 3750 2025 29 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 30 | 2250 1350 2625 1350 31 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 32 | 2625 2025 2625 1200 33 | 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 34 | 2250 2025 2250 1200 35 | 3 0 0 4 0 7 50 -1 -1 0.000 0 1 0 2 36 | 2 1 4.00 60.00 45.00 37 | 2250 2025 2550 2250 38 | 0.000 0.000 39 | 4 0 0 50 -1 0 12 0.0000 2 195 465 3300 2400 angle\001 40 | 4 1 0 50 -1 0 12 0.0000 2 150 450 2475 1200 scale\001 41 | 4 1 0 50 -1 0 12 0.0000 2 195 525 3600 375 image\001 42 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/figures/sift-orient.fig: -------------------------------------------------------------------------------- 1 | #FIG 3.2 Produced by xfig version 3.2.5-alpha5 2 | Landscape 3 | Center 4 | Inches 5 | Letter 6 | 100.00 7 | Single 8 | -2 9 | 1200 2 10 | 1 3 0 1 0 7 48 -1 -1 3.000 1 0.0000 1650 2400 375 375 1650 2400 1950 2625 11 | 1 3 0 3 1 7 48 -1 -1 0.000 1 0.0000 1650 2400 212 212 1650 2400 1862 2400 12 | 2 1 0 1 0 7 48 -1 -1 3.000 0 0 -1 0 0 2 13 | 2250 2100 2700 2100 14 | 2 1 0 3 1 7 48 -1 -1 0.000 0 0 -1 0 0 2 15 | 2250 2400 2700 2400 16 | 2 1 0 2 0 7 48 -1 -1 0.000 0 0 -1 1 0 2 17 | 1 1 2.00 120.00 240.00 18 | 5100 2700 7950 2700 19 | 2 1 0 1 0 7 48 -1 -1 0.000 0 0 -1 0 0 2 20 | 5100 2700 5100 2550 21 | 2 1 0 1 0 7 48 -1 -1 3.000 0 0 -1 0 0 3 22 | 5100 2550 5250 2550 5250 2700 23 | 2 1 2 1 0 7 48 -1 -1 3.000 0 0 -1 0 0 2 24 | 5100 1950 7650 1950 25 | 2 1 2 1 0 7 48 -1 -1 3.000 0 0 -1 0 0 2 26 | 5550 1875 7650 1875 27 | 3 0 0 1 0 7 48 -1 -1 3.000 0 0 0 12 28 | 5100 2400 5325 2025 5550 1800 5925 2025 6225 2325 6375 2325 29 | 6450 2250 6600 2325 6750 2325 6975 1950 7200 1800 7650 2400 30 | 0.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 31 | 1.000 1.000 1.000 0.000 32 | 4 0 0 48 -1 0 12 0.0000 2 210 2100 2850 2475 Keypoint scale $\\sigma$\001 33 | 4 0 0 48 -1 0 12 0.0000 2 195 1155 2850 2175 Polling region\001 34 | 4 1 0 48 -1 0 12 0.0000 2 150 105 5100 3000 0\001 35 | 4 1 0 48 -1 0 12 0.0000 2 210 525 7500 3000 $2\\pi$\001 36 | 4 0 0 48 -1 0 12 0.0000 2 210 795 5250 3000 $2\\pi/36$\001 37 | 4 0 0 48 -1 0 12 0.0000 2 105 375 7800 1800 max\001 38 | 4 0 0 48 -1 0 12 0.0000 2 150 870 7800 2055 80\\% max\001 39 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/PASCAL2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/PASCAL2.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/caltech-collage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/caltech-collage.jpg -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/down.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/fulkerson.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/fulkerson.jpg -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/help.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/lenc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/lenc.jpg -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/liop-neighbours-sampling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/liop-neighbours-sampling.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/liop-patch-layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/liop-patch-layout.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/perdoch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/perdoch.jpg -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/perrone.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/perrone.jpg -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/placeholder.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/placeholder.jpg -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/sarbortova.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/sarbortova.jpg -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/sift-mosaic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/sift-mosaic.jpg -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/sulc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/sulc.jpg -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-additional-deps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-additional-deps.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-additional-include.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-additional-include.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-additional-libdir.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-additional-libdir.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-all-configurations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-all-configurations.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-empty-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-empty-project.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-new-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-new-project.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-nodll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-nodll.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-ok.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-post-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-post-step.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-project-properties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-vs-project-properties.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-xcode-copy-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-xcode-copy-2.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-xcode-copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-xcode-copy.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-xcode-dylib.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-xcode-dylib.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-xcode-edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-xcode-edit.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-xcode-err.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-xcode-err.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-xcode-info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-xcode-info.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-xcode-new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-xcode-new.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/using-xcode-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/using-xcode-ok.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/vedaldi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/vedaldi.jpg -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/vl_blue.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/vl_blue.ico -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/vl_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/vl_blue.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/vl_blue.pxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/vl_blue.pxm -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/images/yandex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/docsrc/images/yandex.png -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/install-c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

These instructions explain how to use VLFeat in your C 5 | programs.

6 | 7 |

Download and unpack the latest 8 | VLFeat binary distribution in a directory of your choice 9 | (e.g. ~/src/vlfeat). The following tutorials provide 10 | step-by-step instructions for two typical use cases:

11 | 12 | 16 | 17 |

In general, let VLFEATROOT denote the path to the 18 | directory where you unpacked VLFeat. To compile and link your C 19 | program against VLFeat, include in your C source code the appropriate 20 | files from the VLFEATROOT/vl hierarchy and link against 21 | the library vl located in the appropriate 22 | subdirectory vlfeat/bin/ARCH, where ARCH 23 | depends on your architecture.

24 | 25 |

VLFeat is a C library. To use it from a C++ program, do not forget 26 | to enclose your #include statements in a extern 27 | "C" block.

28 | 29 |
30 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/license.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

VLFeat is distributed under the BSD license:

5 |
6 |
7 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/notfound.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

The page you attempted to view no longer exists, never existed, or 5 | is not currently available.

6 | 7 |

Try searching for what you need:

8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/using-gcc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

These instructions show how to setup a basic C++ project which uses the 5 | VLFeat library and the g++ compiler. Our project will consist 6 | of the following simple file, which we will refer to 7 | as main.cpp:

8 | 9 | 10 | extern "C" { 11 | #include <vl/generic.h> 12 | } 13 | 14 | int main (int argc, const char * argv[]) { 15 | VL_PRINT ("Hello world!") ; 16 | return 0; 17 | } 18 | 19 | 20 |

Notice that the extern "C" is required for C++ projects. 21 | Compiling the project is straightforward. From the command prompt type:

22 | 23 | 24 | $ g++ main.cpp -o vlfeat-test -IVLROOT -LVLROOT/bin/a64/ -lvl 25 | 26 | 27 |

In this example, replace VLROOT with the path to your VLFeat 28 | installation and replace a64 with your architecture 29 | (a64 for 64 bit linux, glx for 32 bit linux).

30 | 31 |
32 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/vlfeat-website-preproc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 |
29 |
30 |
31 | 32 | 33 | 34 | 35 | 36 |
37 | 38 |
39 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/vlfeat-website.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
32 | 33 |
34 |
35 |
36 | 37 | 38 | 39 |

These man pages describe VLFeat command line utilities.

40 | 41 | 42 |
43 |
44 |
45 | 46 |
47 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/docsrc/wikidoc.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import sys,os 4 | 5 | def usage(): 6 | print "Usage:", sys.argv[0], " " 7 | print "" 8 | print "Replaces wiki documentation with documentation from html files" 9 | 10 | def wikidoc(pagename, htmlfile): 11 | f = open(htmlfile) 12 | doclines = f.readlines() 13 | f.close() 14 | 15 | starttag = "" 16 | endtag = "" 17 | doclines.insert(0, starttag + '\n') 18 | doclines.append('\n' + endtag + '\n') 19 | 20 | wikilines = [] 21 | if os.path.exists(pagename): 22 | f = open(pagename) 23 | wikilines = f.readlines() 24 | f.close() 25 | 26 | startline = -1 27 | endline = -1 28 | for i in range(len(wikilines)): 29 | if wikilines[i].strip() == starttag and startline == -1: startline = i 30 | if wikilines[i].strip() == endtag and endline == -1: endline = i 31 | 32 | if startline == -1 or endline == -1 or startline >= endline: 33 | print "Wikidoc warning: Didn't find tags for", pagename 34 | startline = 0 35 | endline = 0 36 | 37 | wikilines = wikilines[:startline] + doclines + wikilines[endline+1:] 38 | f = open(pagename, 'w') 39 | f.writelines(wikilines) 40 | f.close() 41 | 42 | if __name__ == '__main__': 43 | if len(sys.argv) != 3: 44 | usage() 45 | sys.exit(2) 46 | 47 | print "wikidoc: using", sys.argv[1], "for page", sys.argv[2] 48 | wikidoc(sys.argv[1], sys.argv[2]) 49 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/src/check.h: -------------------------------------------------------------------------------- 1 | /** @file check.h 2 | ** @brief Unit test utilties 3 | ** @author Andrea Vedaldi 4 | **/ 5 | 6 | #ifndef __CHECK_H__ 7 | #define __CHECK_H__ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | static void 14 | check_impl (int condition, 15 | const char * file, 16 | int line, 17 | const char * format, ...) 18 | { 19 | va_list args; 20 | va_start(args, format) ; 21 | if (! condition) { 22 | fprintf(stderr, "%s:%d: check failed: ", file, line) ; 23 | vfprintf(stderr, format, args) ; 24 | fprintf(stderr, "\n") ; 25 | exit (1) ; 26 | } 27 | va_end(args) ; 28 | } 29 | 30 | #define check(condition, ...) \ 31 | check_impl(condition, __FILE__, __LINE__, "" __VA_ARGS__) 32 | 33 | #define check_signoff() \ 34 | fprintf(stdout, "%s passed\n", __FILE__) 35 | 36 | /* __CHECK_H__ */ 37 | #endif 38 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/src/test_gauss_elimination.c: -------------------------------------------------------------------------------- 1 | /** file: test_gauss_elimination.cpp */ 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | int 9 | main(int argc VL_UNUSED, char**argv VL_UNUSED) 10 | { 11 | double A [] = { 1, 12, 3, 4 }; 12 | double b [] = { 1, -2 } ; 13 | double x [2] ; 14 | double c [2] ; 15 | int i ; 16 | 17 | vl_solve_linear_system_2 (x, A, b) ; 18 | 19 | c[0] = A[0] * x[0] + A[2] * x[1] ; 20 | c[1] = A[1] * x[0] + A[3] * x[1] ; 21 | 22 | for (i = 0 ; i < 2 ; ++i) { 23 | VL_PRINTF("[A x]_%-4d = %4g, b_%-4d = %4g\n", i+1, c[i], i+1, b[i]) ; 24 | } 25 | 26 | return 0 ; 27 | } 28 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/src/test_host.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 3 | All rights reserved. 4 | 5 | This file is part of the VLFeat library and is made available under 6 | the terms of the BSD license (see the COPYING file). 7 | */ 8 | 9 | #include 10 | 11 | int 12 | main(int argc VL_UNUSED, char ** argv VL_UNUSED) 13 | { 14 | char * string = vl_configuration_to_string_copy() ; 15 | assert (string) ; 16 | VL_PRINTF(string) ; 17 | vl_free(string) ; 18 | return 0 ; 19 | } 20 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/src/test_liop.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | int main(){ 9 | vl_int i ; 10 | VlLiopDesc * liop ; 11 | vl_size size = 11*11 ; 12 | float mat[] = { 13 | 6,6,6,6,6,6,6,6,6,6,6, 14 | 6,6,6,5,4,4,4,5,6,6,6, 15 | 6,6,5,4,3,3,3,4,5,6,6, 16 | 6,5,4,3,2,2,2,3,4,5,6, 17 | 6,4,3,2,2,1,2,2,3,4,6, 18 | 6,4,3,2,1,1,1,2,3,4,6, 19 | 6,4,3,2,2,1,2,2,3,4,6, 20 | 6,5,4,3,2,2,2,3,4,5,6, 21 | 6,6,5,4,3,3,3,4,5,6,6, 22 | 6,6,6,5,4,4,4,5,6,6,6, 23 | 6,6,6,6,6,6,6,6,6,6,6}; 24 | float * patch = vl_malloc(sizeof(float)*size); 25 | 26 | for(i = 0; i < (signed)size; i++){ 27 | patch[i] = mat[i]; 28 | } 29 | 30 | liop = vl_liopdesc_new(4,6,2,11); 31 | 32 | vl_liopdesc_delete(liop) ; 33 | vl_free(patch) ; 34 | } 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/src/test_mathop_abs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * test_mathop_abs.c 3 | * vlfeat 4 | * 5 | * Created by Andrea Vedaldi on 16/07/2009. 6 | * Copyright 2009 UCLA. All rights reserved. 7 | * 8 | */ 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | int 16 | main(int argc VL_UNUSED, char**argv VL_UNUSED) 17 | { 18 | VlRand * rand = vl_get_rand() ; 19 | vl_size numData = 100000000 ; 20 | vl_size i ; 21 | float * X = vl_malloc(sizeof(float) * numData) ; 22 | float * Y = vl_malloc(sizeof(float) * numData) ; 23 | float * X_end = X + numData ; 24 | 25 | for (i = 0 ; i < numData ; ++ i) { 26 | X[i] = vl_rand_real1(rand) - .5 ; 27 | Y[i] = 0 ; 28 | } 29 | 30 | { 31 | float * Xi = X ; 32 | float * Yi = Y ; 33 | vl_tic() ; 34 | while (Xi < X_end) { 35 | *Yi++ = fabsf (*Xi++) ; 36 | } 37 | VL_PRINTF("fabsf: %.3f\n", vl_toc()) ; 38 | } 39 | 40 | for (i = 0 ; i < numData ; ++ i) { 41 | X[i] = vl_rand_real1(rand) - .5 ; 42 | X[i] = 0 ; 43 | } 44 | 45 | { 46 | float * Xi = X ; 47 | float * Yi = Y ; 48 | vl_tic() ; 49 | while (Xi < X_end) { 50 | *Yi++ = vl_abs_f (*Xi++) ; 51 | } 52 | VL_PRINTF("vl_abs_f: %.3f\n", vl_toc()) ; 53 | } 54 | 55 | vl_free (Y) ; 56 | vl_free (X) ; 57 | 58 | return 0 ; 59 | } 60 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/src/test_mathop_fast_sqrt_ui.tc: -------------------------------------------------------------------------------- 1 | #define FL VL_XCAT(VL_FL_INT, SFX) 2 | 3 | { 4 | T x, acc, acc_ ; 5 | double elaps ; 6 | int neval ; 7 | 8 | vl_tic() ; 9 | neval = 0 ; 10 | x = 0 ; 11 | acc = 0 ; 12 | do { 13 | T y = VL_XCAT(vl_fast_sqrt_ui, SFX) (x) ; 14 | acc += y ; 15 | x += 1 << STEP ; 16 | neval += 1 ; 17 | } while (x > (1 << STEP) - 1) ; 18 | elaps = vl_toc() ; 19 | VL_PRINTF ("%20s", "vl_fast_sqrt_ui" VL_XSTRINGIFY(SFX)) ; 20 | VL_PRINTF (" %10.2f %10.2g %010" FL "x\n", elaps, (double) neval / elaps, acc) ; 21 | 22 | vl_tic() ; 23 | neval = 0 ; 24 | x = 0 ; 25 | acc_ = 0 ; 26 | do { 27 | vl_uint32 y = floor(sqrt((double) x)); 28 | acc_ += y ; 29 | x += 1 << STEP ; 30 | neval += 1 ; 31 | } while (x > (1 << STEP) - 1) ; 32 | elaps = vl_toc() ; 33 | VL_PRINTF ("%20s", "baseline") ; 34 | VL_PRINTF (" %10.2f %10.2g %010" FL "x\n", elaps, (double) neval / elaps, acc) ; 35 | 36 | 37 | if (acc != acc_) { 38 | VL_PRINTF ("error: vl_fast_sqrt_ui" VL_XSTRINGIFY(SFX) " != floor(sqrt((double) x))\n") ; 39 | error = 1 ; 40 | } 41 | } 42 | 43 | #undef FL 44 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/src/test_nan.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 3 | All rights reserved. 4 | 5 | This file is part of the VLFeat library and is made available under 6 | the terms of the BSD license (see the COPYING file). 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | int 13 | main(int argc VL_UNUSED, char** argv VL_UNUSED) 14 | { 15 | VL_PRINTF ("Double NaN : `%g'\n", VL_NAN_D ) ; 16 | VL_PRINTF ("Double Inf : `%g'\n", VL_INFINITY_D) ; 17 | VL_PRINTF ("Double - Inf : `%g'\n", - VL_INFINITY_D) ; 18 | VL_PRINTF ("Single NaN : `%g'\n", VL_NAN_F ) ; 19 | VL_PRINTF ("Single Inf : `%g'\n", VL_INFINITY_F) ; 20 | VL_PRINTF ("Single - Inf : `%g'\n", - VL_INFINITY_F) ; 21 | 22 | VL_PRINTF ("Double: 0.0 < VL_INFINITY_D: %d\n", 0.0 < VL_INFINITY_D) ; 23 | VL_PRINTF ("Double: 0.0 > - VL_INFINITY_D: %d\n", 0.0 > - VL_INFINITY_D) ; 24 | 25 | return 0 ; 26 | } 27 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/src/test_qsort-def.c: -------------------------------------------------------------------------------- 1 | /** @file test_heap-def.c 2 | ** @brief Test heap-def.h 3 | ** @author Andrea Vedaldi 4 | **/ 5 | 6 | /* 7 | Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 8 | All rights reserved. 9 | 10 | This file is part of the VLFeat library and is made available under 11 | the terms of the BSD license (see the COPYING file). 12 | */ 13 | 14 | #define VL_QSORT_prefix my_qsort 15 | #define VL_QSORT_type float 16 | #include 17 | 18 | #include 19 | 20 | int 21 | main (int argc VL_UNUSED, char ** argv VL_UNUSED) 22 | { 23 | float values [] = {.4, 12.3, 44.0, 1.2, 3.4, 5.6} ; 24 | vl_size n = sizeof(values) / sizeof(values[0]) ; 25 | vl_uindex i ; 26 | 27 | for (i = 0 ; i < n ; ++i) printf("%5.2f ", values [i]) ; 28 | printf("\n") ; 29 | 30 | my_qsort_sort (values, n) ; 31 | 32 | for (i = 0 ; i < n ; ++i) printf("%5.2f ", values [i]) ; 33 | printf("\n") ; 34 | 35 | return 0 ; 36 | } 37 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/src/test_rand.c: -------------------------------------------------------------------------------- 1 | /** @file test_rand.c 2 | ** @author Andrea Vedaldi 3 | ** @breif Test vl/random.h 4 | **/ 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | int 12 | main (int argc VL_UNUSED, char *argv[] VL_UNUSED) 13 | { 14 | int i ; 15 | vl_uint32 init [4] = {0x123, 0x234, 0x345, 0x456} ; 16 | VlRand rand ; 17 | vl_rand_init (&rand) ; 18 | 19 | vl_rand_seed_by_array (&rand, init, sizeof(init)/sizeof(init[0])) ; 20 | 21 | printf("1000 outputs of vl_rand_uint32()\n"); 22 | for (i=0; i<1000; i++) { 23 | printf("%10" VL_FL_INT32 "u ", vl_rand_uint32(&rand)); 24 | if (i%5==4) printf("\n"); 25 | } 26 | 27 | printf("\n1000 outputs of vl_rand_real2()\n"); 28 | for (i=0; i<1000; i++) { 29 | printf("%10.8f ", vl_rand_real2(&rand)); 30 | if (i%5==4) printf("\n"); 31 | } 32 | 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/aib/vl_aibcutpush.m: -------------------------------------------------------------------------------- 1 | function y = vl_aibcutpush(map, x) 2 | % VL_AIBCUTPUSH Quantize based on VL_AIB cut 3 | % Y = VL_AIBCUTPUSH(MAP, X) maps the data X to elements of the AIB 4 | % cut specified by MAP. 5 | % 6 | % The function is equivalent to Y = MAP(X). 7 | % 8 | % See also: VL_HELP(), VL_AIB(). 9 | 10 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 11 | % All rights reserved. 12 | % 13 | % This file is part of the VLFeat library and is made available under 14 | % the terms of the BSD license (see the COPYING file). 15 | 16 | y = map(x) ; 17 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/aib/vl_aibhist.m: -------------------------------------------------------------------------------- 1 | % VL_AIBHIST Compute histogram over VL_AIB tree 2 | % H = VL_AIBHIST(PARENTS, DATA) computes the histogram of the data 3 | % points DATA on the VL_AIB tree defined by PARENTS. Each element of 4 | % DATA indexes one of the leaves of the VL_AIB tree. 5 | % 6 | % H = VL_AIBHIST(PARENTS, DATA, 'HIST') treats DATA as an histograms. 7 | % In this case each compoment of DATA is the number of occurences of 8 | % the VL_AIB leaves corresponding to that component. 9 | % 10 | % H has the same dimension of parents and counts how many data points 11 | % are descendent of the corresponding node of the VL_AIB tree. 12 | % 13 | % See also: VL_HELP(), VL_AIB(), VL_AIBCUTPUSH(). 14 | 15 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 16 | % All rights reserved. 17 | % 18 | % This file is part of the VLFeat library and is made available under 19 | % the terms of the BSD license (see the COPYING file). 20 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/demo/vl_demo_cmd.m: -------------------------------------------------------------------------------- 1 | function [err,msg] = vl_demo_cmd(name, args) 2 | % DEMO_CMD: Demo: Command line utility 3 | 4 | ext = '' ; 5 | switch mexext 6 | case 'mexmac' 7 | arch = 'mac' ; 8 | case 'mexmaci' 9 | arch = 'maci' ; 10 | case 'mexmaci64' 11 | arch = 'maci64'; 12 | case 'mexglx' 13 | arch = 'glnx86' ; 14 | case 'mexa64' 15 | arch = 'glnxa64' ; 16 | case 'dll' 17 | arch = 'win32' ; 18 | ext = '.exe' ; 19 | case 'mexw32' 20 | arch = 'win32' ; 21 | ext ='.exe' ; 22 | case 'mexw64' 23 | arch = 'win64' ; 24 | ext ='.exe' ; 25 | end 26 | 27 | cmd = fullfile(vl_root,'bin',arch,[name ext]) ; 28 | str = ['"' cmd '" ' args] ; 29 | disp(str); 30 | [err,msg] = system(str) ; 31 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/demo/vl_demo_gmm_2d_rand.m: -------------------------------------------------------------------------------- 1 | % VL_DEMO_GMM_2D_RAND Demonstrate clustering points with a GMM 2 | 3 | %% Create a random set of points 4 | numPoints = 5000 ; 5 | dimension = 2 ; 6 | numClusters = 20 ; 7 | data = rand(dimension, numPoints) ; 8 | 9 | %% Learn a GMM: fit the points at maximum likelihood 10 | vl_twister('state',0) ; 11 | [means, covariances, priors] = ... 12 | vl_gmm(data, numClusters, ... 13 | 'MaxNumIterations', 1000, ... 14 | 'Verbose') ; 15 | 16 | figure(1) ; clf ; hold on 17 | plot(data(1,:),data(2,:),'r.'); 18 | for i=1:numClusters 19 | vl_plotframe([means(:,i)' covariances(1,i) 0 covariances(2,i)], ... 20 | 'Color','blue','LineWidth',2); 21 | end 22 | 23 | title('GMM: Gaussian mixture initialized choosing random points') ; 24 | axis equal ; axis off ; 25 | vl_demo_print('gmm_2d_rand',0.6); 26 | 27 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/demo/vl_demo_imdisttf.m: -------------------------------------------------------------------------------- 1 | % VL_DEMO_IMDISTTF Demonstrates image distance transform 2 | 3 | % load image 4 | im = imread(fullfile(vl_root, 'data', 'roofs1.jpg')) ; 5 | im = im(100:200,100:200,:) ; 6 | imSize = [size(im,1) size(im,2)] ; 7 | 8 | % creates an edge map 9 | edges = zeros(imSize) + inf; 10 | edges(edge(rgb2gray(im), 'canny')) = 0 ; 11 | 12 | % compute distance transform 13 | [distanceTransform, neighbors] = vl_imdisttf(single(edges)) ; 14 | 15 | % plot 16 | [u,v] = meshgrid(1:imSize(2),1:imSize(1)) ; 17 | [v_,u_] = ind2sub(imSize, neighbors) ; 18 | 19 | % avoid cluttering the plot too much 20 | u = u(1:3:end,1:3:end) ; 21 | v = v(1:3:end,1:3:end) ; 22 | u_ = u_(1:3:end,1:3:end) ; 23 | v_ = v_(1:3:end,1:3:end) ; 24 | 25 | figure(1) ; clf ; imagesc(im) ; axis off image ; 26 | figure(2) ; clf ; imagesc(edges) ; axis off image ; 27 | figure(3) ; clf ; imagesc(edges) ; axis off image ; 28 | hold on ; h = quiver(u,v,u_-u,v_-v,0) ; colormap gray ; 29 | figure(4) ; clf ; imagesc(sqrt(distanceTransform)) ; axis off image ; 30 | 31 | figure(1) ; vl_demo_print('imdisttf_src') ; 32 | figure(2) ; vl_demo_print('imdisttf_edge') ; 33 | figure(3) ; vl_demo_print('imdisttf_neigh') ; 34 | figure(4) ; vl_demo_print('imdisttf_dist') ; 35 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/demo/vl_demo_kdtree_plot.m: -------------------------------------------------------------------------------- 1 | function h = vl_demo_kdtree_plot(kdtree, nodeIndex, xlim, ylim) 2 | % VL_DEMO_KDTREE_PLOT 3 | 4 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 5 | % All rights reserved. 6 | % 7 | % This file is part of the VLFeat library and is made available under 8 | % the terms of the BSD license (see the COPYING file). 9 | 10 | dim = kdtree.nodes.splitDimension(nodeIndex) ; 11 | thresh = kdtree.nodes.splitThreshold(nodeIndex) ; 12 | lowerChild = kdtree.nodes.lowerChild(nodeIndex) ; 13 | upperChild = kdtree.nodes.upperChild(nodeIndex) ; 14 | 15 | if dim == 1 16 | xs = [thresh, thresh] ; 17 | ys = ylim ; 18 | ylimLower = ylim ; 19 | ylimUpper = ylim ; 20 | xlimLower = [xlim(1) thresh] ; 21 | xlimUpper = [thresh xlim(2)] ; 22 | else 23 | xs = xlim ; 24 | ys = [thresh, thresh] ; 25 | xlimLower = xlim ; 26 | xlimUpper = xlim ; 27 | ylimLower = [ylim(1) thresh] ; 28 | ylimUpper = [thresh ylim(2)] ; 29 | end 30 | h = line(xs,ys) ; 31 | 32 | if lowerChild > 1 33 | h = [h vl_demo_kdtree_plot(kdtree, lowerChild, xlimLower, ylimLower)] ; 34 | end 35 | 36 | if upperChild > 1 37 | h = [h vl_demo_kdtree_plot(kdtree, upperChild, xlimUpper, ylimUpper)] ; 38 | end 39 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/demo/vl_demo_kdtree_self.m: -------------------------------------------------------------------------------- 1 | function vl_demo_kdtree_self 2 | % VL_DEMO_KDTREE_SELF 3 | % Demonstrates using a kd-tree to find the pairwise nearest 4 | % neighbors in a set of points. 5 | 6 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 7 | % All rights reserved. 8 | % 9 | % This file is part of the VLFeat library and is made available under 10 | % the terms of the BSD license (see the COPYING file). 11 | 12 | randn('state',0) ; 13 | rand('state',0) ; 14 | 15 | % a set of 2D pints 16 | X = single(rand(2, 100)) ; 17 | 18 | % build the kdtree 19 | kdtree = vl_kdtreebuild(X) ; 20 | 21 | % query the kdtree with X itself 22 | [i, d] = vl_kdtreequery(kdtree, X, X, 'numneighbors', 2, 'verbose') ; 23 | 24 | % plot 25 | figure(1) ; clf ; 26 | vl_plotframe(X, 'ro') ; 27 | hold on ; 28 | xl = [0, +1] ; 29 | yl = [0, +1] ; 30 | axis equal ; 31 | xlim(xl) ; 32 | ylim(yl) ; 33 | vl_demo_kdtree_plot(kdtree.trees(1), 1, xl, yl) ; 34 | line([X(1,:) ; X(1,i(2,:))], ... 35 | [X(2,:) ; X(2,i(2,:))], 'linewidth', 2) ; 36 | vl_demo_print('kdtree_self') ; 37 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/demo/vl_demo_kmeans_2d.m: -------------------------------------------------------------------------------- 1 | N = 10000 ; 2 | dimension = 2 ; 3 | data = rand(dimension,N) ; 4 | numClusters = 20 ; 5 | cc=hsv(numClusters); 6 | 7 | [centers, assignments] = vl_kmeans(data, numClusters); 8 | 9 | figure 10 | hold on 11 | for i=1:numClusters 12 | plot(data(1,assignments == i),data(2,assignments == i),'.','color',cc(i,:)); 13 | end 14 | plot(centers(1,:),centers(2,:),'k.','MarkerSize',20) 15 | axis off 16 | vl_demo_print('kmeans_2d_rand',0.6); -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/demo/vl_demo_kmeans_vs_builtin.m: -------------------------------------------------------------------------------- 1 | % VL_DEMO_KMEANS_VS_BUILTIN 2 | 3 | clear elaps energy ; 4 | 5 | dimension = 128 ; 6 | numData = 1000 ; 7 | numCenters = 10 ; 8 | numTrials = 10 ; 9 | 10 | for trial = 1:numTrials 11 | X = rand(dimension, numData) ; 12 | 13 | tic ; 14 | [idx, C, e] = kmeans(X', numCenters) ; 15 | e = sum(e) ; 16 | elaps.builtin(trial) = toc ; 17 | energy.builtin(trial) = e ; 18 | 19 | tic ; 20 | [idx_, C_, e] = vl_kmeans(X, numCenters, 'verbose') ; 21 | elaps.vl(trial) = toc ; 22 | energy.vl(trial) = e ; 23 | 24 | tic ; 25 | [idx_, C_, e] = vl_kmeans(X, numCenters, 'initialization', 'plusplus') ; 26 | elaps.vlpp(trial) = toc ; 27 | energy.vlpp(trial) = e ; 28 | end 29 | 30 | figure(1) ; clf ; 31 | subplot(1,2,1) ; title('Energy') ; 32 | mu = [mean(elaps.builtin) mean(elaps.vl) mean(elaps.vlpp)] ; 33 | st = [std(elaps.builtin) std(elaps.vl) std(elaps.vlpp)] ; 34 | bar(mu) ; hold on ; 35 | errorbar(mu, st, 'linestyle', 'none', 'color', 'r', 'linewidth', 4) ; 36 | 37 | subplot(1,2,2) ; 38 | mu = [mean(energy.builtin) mean(energy.vl) mean(energy.vlpp)] ; 39 | st = [std(energy.builtin) std(energy.vl) std(energy.vlpp)] ; 40 | bar(mu) ; hold on ; 41 | errorbar(mu, st, 'linestyle', 'none', 'color', 'r', 'linewidth', 4) ; 42 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/demo/vl_demo_mser_cmd.m: -------------------------------------------------------------------------------- 1 | % VL_DEMO_MSER_CMD Demo: MSER: test command line utility 2 | 3 | pfx = fullfile(vl_root,'results') ; 4 | if ~ exist(pfx, 'dir') 5 | mkdir(pfx) ; 6 | end 7 | 8 | p_img = fullfile(vl_root,'data','spots.jpg') ; 9 | p_pgm = fullfile(pfx,'spots.pgm') ; 10 | p_sed = fullfile(pfx,'spots.mser') ; 11 | p_frm = fullfile(pfx,'spots.frame') ; 12 | p_tmp = fullfile(pfx,'spots.tmp') ; 13 | 14 | I = imread(p_img) ; 15 | I = uint8(rgb2gray(I)) ; 16 | imwrite(I,p_pgm,'pgm') ; 17 | 18 | % -------------------------------------------------------------------- 19 | % Test cmd 20 | % -------------------------------------------------------------------- 21 | 22 | [err,msg] = vl_demo_cmd('mser',[p_pgm ... 23 | ' --seeds=ascii://' p_sed ... 24 | ' --frames=ascii://' p_frm ... 25 | ' --max-variation=0.2 ' ... 26 | ' --min-diversity=0.7 ' ... 27 | ' --delta=10 ' ... 28 | ' --verbose '] ) ; 29 | 30 | r_ = load(p_sed,'-ASCII')'; 31 | % note: bright-on-dark region seeds are negative 32 | r_ = r_ + sign(r_); % add one for matlab indexing 33 | f_ = load(p_frm,'-ASCII')' ; f_(1:2,:) = f_(1:2,:) + 1 ; 34 | 35 | [r,f] = vl_mser(I','MinDiversity',0.7,'MaxVariation',0.2,'Delta',10) ; 36 | 37 | if(any(r ~= r_) | any(any(abs(f - f_)>1e-5))) 38 | warning('demo_mser_cmd: failed consistency test of commmand line and MATLAB drivers.') ; 39 | end 40 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/demo/vl_demo_mser_delta.m: -------------------------------------------------------------------------------- 1 | % VL_DEMO_MSER_DELTA Demo: MSER: delta parameter 2 | 3 | randn('state',0) ; 4 | rand('state',0) ; 5 | 6 | I = zeros(100,500) + 255 ; 7 | for i=1:5 8 | I((1:50) + 25 - 1, ... 9 | (1:50) + 25 - 1 + 100 * (i-1)) = ... 10 | 255 - 32 * i ; 11 | end 12 | I = uint8(I) ; 13 | 14 | figure(1) ; clf ; 15 | axes('position',[0.05 0.05 1-.1 2*1/5-.1]) ; 16 | plot(I(end/2,:),'linewidth',3) ; 17 | hold on ; 18 | vl_demo_print('mser_delta_0') ; 19 | 20 | 21 | figure(2) ; clf ; 22 | imagesc(I) ; axis off ; axis equal ; axis tight ; 23 | colormap(gray(256)) ; 24 | set(gca,'fontsize',20) ; 25 | 26 | deltar = [1 32 159 160] ; 27 | clear h ; 28 | for delta=deltar 29 | [r,f] = vl_mser(I, 'Delta', delta, 'BrightOnDark', 0, 'verbose') ; 30 | 31 | if exist('h','var'), delete(h) ; end 32 | h = vl_plotframe(vl_ertr(f)) ; 33 | if ~isempty(h), set(h,'color','y','linewidth',1) ; end 34 | title(sprintf('delta = %g', delta)) ; 35 | drawnow ; 36 | 37 | vl_demo_print(sprintf('mser_delta_%d',find(delta==deltar))) ; 38 | end 39 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/demo/vl_demo_plots_rank.m: -------------------------------------------------------------------------------- 1 | %VL_DEMO_PLOTS_RANK Demonstates VL_ROC, VL_DET, VL_PR 2 | 3 | randn('state',0) ; 4 | numPos = 20 ; 5 | numNeg = 100 ; 6 | labels = [ones(1, numPos) -ones(1,numNeg)] ; 7 | scores = randn(size(labels)) + labels ; 8 | 9 | figure(1) ; clf ; 10 | vl_roc(labels,scores) ; 11 | vl_demo_print(1,'plots_rank_roc', 0.5) ; 12 | 13 | figure(2) ; clf ; 14 | subplot(2,2,1) ; vl_roc(labels,scores, 'plot', 'tntp') ; 15 | subplot(2,2,2) ; vl_roc(labels,scores, 'plot', 'tptn') ; 16 | subplot(2,2,3) ; vl_roc(labels,scores, 'plot', 'fptp') ; 17 | subplot(2,2,4) ; vl_roc(labels,scores, 'plot', 'fpfn') ; 18 | vl_figaspect(1) ; 19 | vl_demo_print(2,'plots_rank_roc_variants', 1) ; 20 | 21 | figure(3) ; clf ; 22 | vl_det(labels,scores) ; 23 | vl_demo_print(3,'plots_rank_det', 0.5) ; 24 | 25 | figure(4) ; clf ; 26 | vl_pr(labels,scores) ; 27 | vl_demo_print(4,'plots_rank_pr', 0.5) ; 28 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/demo/vl_demo_quickshift.m: -------------------------------------------------------------------------------- 1 | % VL_DEMO_QUICKSHIFT Demo: Quick shift: basic functionality 2 | 3 | pfx = fullfile(vl_root,'figures','demo') ; 4 | randn('state',0) ; 5 | rand('state',0) ; 6 | figure(1) ; clf ; 7 | 8 | % -------------------------------------------------------------------- 9 | % Load a figure 10 | % -------------------------------------------------------------------- 11 | I = imread(fullfile(vl_root,'data','roofs1.jpg')) ; 12 | 13 | image(I) ; 14 | axis equal off tight ; 15 | vl_demo_print('quickshift_image') ; 16 | 17 | % -------------------------------------------------------------------- 18 | % Create a quickshift segmentation 19 | % -------------------------------------------------------------------- 20 | 21 | ratio = 0.5; 22 | kernelsize = 2; 23 | maxdist = 10; 24 | 25 | Iseg = vl_quickseg(I, ratio, kernelsize, maxdist); 26 | image(Iseg); 27 | axis equal off tight; 28 | vl_demo_print('quickshift_qseg_1') ; 29 | 30 | kernelsize = 2; 31 | maxdist = 20; 32 | Iseg = vl_quickseg(I, ratio, kernelsize, maxdist); 33 | image(Iseg); 34 | axis equal off tight; 35 | vl_demo_print('quickshift_qseg_2') ; 36 | 37 | 38 | maxdist = 50; 39 | ndists = 10; 40 | Iedge = vl_quickvis(I, ratio, kernelsize, maxdist, ndists); 41 | imagesc(Iedge); 42 | axis equal off tight; 43 | colormap gray; 44 | vl_demo_print('quickshift_qvis') ; 45 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/demo/vl_demo_sift_edge.m: -------------------------------------------------------------------------------- 1 | % VL_DEMO_SIFT_EDGE Demo: SIFT: edge treshold 2 | 3 | randn('state',0) ; 4 | rand('state',0) ; 5 | 6 | I = zeros(100,500) ; 7 | for i=[10 20 30 40 50 60 70 80 90] 8 | d = round(i/3) ; 9 | I(50-d:50+d,i*5) = 1 ; 10 | end 11 | I = 2*pi*8^2 * vl_imsmooth(I,8) ; 12 | I = single(255 * I) ; 13 | 14 | figure(1) ; clf ; 15 | imagesc(I) ; colormap gray ; 16 | axis equal ; axis off ; axis tight ; 17 | hold on ; 18 | 19 | vl_demo_print('sift_edge_0') ; 20 | 21 | ter=[3.5 5 7.5 10] ; 22 | for te=ter 23 | f = vl_sift(I, ... 24 | 'PeakThresh', 0, ... 25 | 'EdgeThresh', te, ... 26 | 'FirstOctave', -1 ) ; 27 | h1 = vl_plotframe(f) ; 28 | set(h1,'color','k','linewidth',3) ; 29 | h2 = vl_plotframe(f) ; 30 | set(h2,'color','y','linewidth',2) ; 31 | 32 | vl_demo_print(sprintf('sift_edge_%d', find(te==ter))) ; 33 | delete(h1) ; 34 | delete(h2) ; 35 | end 36 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/demo/vl_demo_sift_or.m: -------------------------------------------------------------------------------- 1 | % VL_DEMO_SIFT_OR Demonstrates SIFT orientation detection 2 | 3 | I = vl_impattern('wedge') ; 4 | ur = 1:size(I,2) ; 5 | vr = 1:size(I,1) ; 6 | 7 | % distribute frames on a grid 8 | [u,v] = meshgrid(ur(5:10:end-4),vr(5:10:end-4)) ; 9 | f = [u(:)';v(:)'] ; 10 | K = size(f,2) ; 11 | f = [f ; 4 * ones(1,K) ; 0 * ones(1,K)] ; 12 | 13 | % detect orienntations 14 | f = vl_sift(single(I), 'frames', f, 'orientations') ; 15 | 16 | figure(1) ; clf ; 17 | imagesc(single(I)) ; colormap gray ; hold on ; 18 | vl_plotframe(f,'color','k','linewidth',3) ; 19 | vl_plotframe(f,'color','y','linewidth',2) ; 20 | axis equal ; axis off ; 21 | vl_demo_print('sift_or') ; 22 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/demo/vl_demo_sift_peak.m: -------------------------------------------------------------------------------- 1 | % VL_DEMO_SIFT_PEAK Demo: SIFT: peak treshold 2 | 3 | randn('state',0) ; 4 | rand('state',0) ; 5 | 6 | I = double(rand(100,500) <= .005) ; 7 | I = (ones(100,1) * linspace(0,1,500)) .* I ; 8 | I(:,1) = 0 ; I(:,end) = 0 ; 9 | I(1,:) = 0 ; I(end,:) = 0 ; 10 | I = 2*pi*4^2 * vl_imsmooth(I,4) ; 11 | I = single(255 * I) ; 12 | 13 | figure(1) ; clf ; 14 | imagesc(I) ; colormap gray ; 15 | axis equal ; axis off; axis tight ; 16 | hold on ; 17 | 18 | vl_demo_print('sift_peak_0') ; 19 | 20 | tpr = [0 10 20 30] ; 21 | for tp=tpr 22 | f = vl_sift(I, ... 23 | 'PeakThresh', tp, ... 24 | 'EdgeThresh', 10000, ... 25 | 'FirstOctave', -1) ; 26 | 27 | h1 = vl_plotframe(f) ; 28 | set(h1,'color','k','linewidth',3) ; 29 | h2 = vl_plotframe(f) ; 30 | set(h2,'color','y','linewidth',2) ; 31 | 32 | vl_demo_print(sprintf('sift_peak_%d',find(tp==tpr))) ; 33 | delete(h1) ; 34 | delete(h2) ; 35 | end 36 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/demo/vl_demo_svm.m: -------------------------------------------------------------------------------- 1 | % VL_DEMO_SVM Demo: SVM: 2D linear learning 2 | function vl_demo_svm 3 | y=[];X=[]; 4 | 5 | % Load training data X and their labels y 6 | load('vl_demo_svm_data.mat') 7 | 8 | 9 | Xp = X(:,y==1); 10 | Xn = X(:,y==-1); 11 | 12 | figure 13 | plot(Xn(1,:),Xn(2,:),'*r') 14 | hold on 15 | plot(Xp(1,:),Xp(2,:),'*b') 16 | axis equal ; 17 | vl_demo_print('svm_training') ; 18 | % Parameters 19 | lambda = 0.01 ; % Regularization parameter 20 | maxIter = 1000 ; % Maximum number of iterations 21 | 22 | energy = [] ; 23 | % Diagnostic function 24 | function diagnostics(svm) 25 | energy = [energy [svm.objective ; svm.dualObjective ; svm.dualityGap ] ] ; 26 | end 27 | 28 | % Training the SVM 29 | energy = [] ; 30 | [w b info] = vl_svmtrain(X, y, lambda,... 31 | 'MaxNumIterations',maxIter,... 32 | 'DiagnosticFunction',@diagnostics,... 33 | 'DiagnosticFrequency',1) 34 | 35 | % Visualisation 36 | eq = [num2str(w(1)) '*x+' num2str(w(2)) '*y+' num2str(b)]; 37 | 38 | line = ezplot(eq, [-0.9 0.9 -0.9 0.9]); 39 | set(line, 'Color', [0 0.8 0],'linewidth', 2); 40 | 41 | vl_demo_print('svm_training_result') ; 42 | 43 | 44 | figure 45 | hold on 46 | plot(energy(1,:),'--b') ; 47 | plot(energy(2,:),'-.g') ; 48 | plot(energy(3,:),'r') ; 49 | legend('Primal objective','Dual objective','Duality gap') 50 | xlabel('Diagnostics iteration') 51 | ylabel('Energy') 52 | vl_demo_print('svm_energy') ; 53 | 54 | end -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/demo/vl_demo_svm_data.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/dsp-code/vlfeat-0.9.17/toolbox/demo/vl_demo_svm_data.mat -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/geometry/vl_hat.m: -------------------------------------------------------------------------------- 1 | function H = vl_hat(om) 2 | % VL_HAT Hat operator 3 | % H = VL_HAT(OM) returns the skew symmetric matrix by taking the "hat" 4 | % of the 3D vector OM. 5 | % 6 | % See also: VL_IHAT(), VL_HELP(). 7 | 8 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 9 | % All rights reserved. 10 | % 11 | % This file is part of the VLFeat library and is made available under 12 | % the terms of the BSD license (see the COPYING file). 13 | 14 | H = [0 -om(3) om(2) ; 15 | om(3) 0 -om(1) ; 16 | -om(2) om(1) 0 ] ; 17 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/geometry/vl_ihat.m: -------------------------------------------------------------------------------- 1 | function om = vl_ihat( H ) 2 | % VL_IHAT Inverse vl_hat operator 3 | % OM = VL_IHAT(H) returns a vector OM such that VL_HAT(OM) = H. 4 | % H hast to be 3x3 skew-symmetric. 5 | % 6 | % See also: VL_HAT(), VL_HELP(). 7 | 8 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 9 | % All rights reserved. 10 | % 11 | % This file is part of the VLFeat library and is made available under 12 | % the terms of the BSD license (see the COPYING file). 13 | 14 | om = [H(3,2);H(1,3);H(2,1)] ; 15 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/geometry/vl_irodr.m: -------------------------------------------------------------------------------- 1 | % VL_IRODR Inverse Rodrigues' formula 2 | % OM = VL_IRODR(R) where R is a rotation matrix computes the the 3 | % inverse Rodrigues' formula of om, returning the rotation matrix R 4 | % = dehat(Logm(OM)). 5 | % 6 | % [OM,DOM] = VL_IRODR(R) computes also the derivative of the Rodrigues' 7 | % formula. In matrix notation this is the expression 8 | % 9 | % d( dehat logm(vl_hat(R)) ) 10 | % dom = ----------------------. 11 | % d(vec R)^T 12 | % 13 | % [OM,DOM] = VL_IRODR(R) when R is a 9xK matrix repeats the operation 14 | % for each column (or equivalently matrix with 9*K elements). In 15 | % this case OM and DOM are arrays with K slices, one per rotation. 16 | % 17 | % See also: VL_RODR(), VL_HELP(). 18 | 19 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 20 | % All rights reserved. 21 | % 22 | % This file is part of the VLFeat library and is made available under 23 | % the terms of the BSD license (see the COPYING file). 24 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/geometry/vl_rodr.m: -------------------------------------------------------------------------------- 1 | % VL_RODR Rodrigues' formula 2 | % R = VL_RODR(OM) where OM a 3-dimensional column vector computes the 3 | % Rodrigues' formula of OM, returning the rotation matrix R = 4 | % expm(vl_hat(OM)). 5 | % 6 | % [R,DR] = VL_RODR(OM) computes also the derivative of the Rodrigues 7 | % formula. In matrix notation this is the expression 8 | % 9 | % d(vec expm(vl_hat(OM)) ) 10 | % dR = ----------------------. 11 | % d om^T 12 | % 13 | % [R,DR]=VL_RODR(OM) when OM is a 3xK matrix repeats the operation for 14 | % each column (or equivalently matrix with 3*K elements). In this 15 | % case R and DR are arrays with K slices, one per rotation. 16 | % 17 | % See also: VL_IRODR(), VL_HELP(). 18 | 19 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 20 | % All rights reserved. 21 | % 22 | % This file is part of the VLFeat library and is made available under 23 | % the terms of the BSD license (see the COPYING file). 24 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/imop/vl_dwaffine.m: -------------------------------------------------------------------------------- 1 | function [dWx,dWy] = vl_dwaffine(x,y) 2 | % VL_DWAFFINE Derivative of an affine warp 3 | % [DWX,DWY]=VL_DWAFFINE(X,Y) returns the derivative of the 2-D affine 4 | % warp [WX; WY] = [A T] [X; Y] with respect to the parameters A,T 5 | % computed at points X,Y. 6 | % 7 | % See also: VL_WAFFINE(), VL_HELP(). 8 | 9 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 10 | % All rights reserved. 11 | % 12 | % This file is part of the VLFeat library and is made available under 13 | % the terms of the BSD license (see the COPYING file). 14 | 15 | % dW = [ kron(x',I) I ] 16 | % | 17 | % = [ x1 0 x2 0 1 0 ] 18 | % [ 0 x1 0 x2 0 1 ] 19 | 20 | z = zeros(length(x(:)),1) ; 21 | o = ones(length(x(:)),1) ; 22 | 23 | dWx = [ x(:) z y(:) z o z ] ; 24 | dWy = [ z x(:) z y(:) z o ] ; 25 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/imop/vl_imdisttf.m: -------------------------------------------------------------------------------- 1 | % VL_IMDISTTF Image distance transform 2 | % DT = VL_IMDISTTF(I) computes the distance transform of image I. 3 | % The distance transform is defined as 4 | % 5 | % DT(x,y) = min_{u,v} I(u,v) + (u - x)^2 + (v - y)^2. 6 | % 7 | % [D, INDEXES] = VL_IMDISTTF(...) returns a matrix INDEXES that 8 | % contains for each pixel (x,y) the index of the pixel (u,v) which 9 | % is the minimizer of the distance transform objective. 10 | % 11 | % VL_IMDSITTF(I, PARAM) uses differenet parameters for the 12 | % transform: 13 | % 14 | % DT(u,v) = min_{u,v} I(u,v) + PARAM(1) (u - x - PARAM(2))^2 15 | % + PARAM(3) (v - y - PARAM(4))^2 16 | % 17 | % The function uses the fast algorithm from [1]. 18 | % 19 | % REFERENCES:: 20 | % [1] P. F. Felzenszwalb and D. P. Huttenlocher. Distance transforms 21 | % of sampled functions. Technical report, Cornell University, 2004. 22 | % 23 | % See also: VL_HELP(). 24 | 25 | % Author:: Andrea Vedaldi 26 | 27 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 28 | % All rights reserved. 29 | % 30 | % This file is part of the VLFeat library and is made available under 31 | % the terms of the BSD license (see the COPYING file). 32 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/imop/vl_imdown.m: -------------------------------------------------------------------------------- 1 | function J = vl_imdown(I, varargin) 2 | % VL_IMDOWN Downsample an image by two 3 | % J = VL_IMDOWN(I) downsamples the image I by half by discarding 4 | % each other pixel. 5 | % 6 | % VL_IMDOWN() accepts the following options: 7 | % 8 | % Method:: Sample 9 | % 'Sample' downsamples the image by discarding 10 | % pixels. 'Average' instead averages groups of 2x2 pixels. 11 | % 12 | % See also: VL_IMUP(), VL_HELP(). 13 | 14 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 15 | % All rights reserved. 16 | % 17 | % This file is part of the VLFeat library and is made available under 18 | % the terms of the BSD license (see the COPYING file). 19 | 20 | opts.method = 'sample' ; 21 | opts = vl_argparse(opts, varargin) ; 22 | 23 | switch lower(opts.method) 24 | case 'sample' 25 | J = I(1:2:floor(end-.5),1:2:floor(end-.5),:) ; 26 | 27 | case 'average' 28 | Iclass = class(I); 29 | I = double(I); 30 | J = ... 31 | I(1:2:end-1,1:2:end-1,:) + ... 32 | I(2:2:end,1:2:end-1,:) + ... 33 | I(1:2:end-1,2:2:end,:) + ... 34 | I(2:2:end,2:2:end,:) ; 35 | J = J / 4 ; 36 | eval(sprintf('J=%s(J);', Iclass)); 37 | 38 | otherwise 39 | error('Unknown downsampling method ''%s''.', method) ; 40 | end 41 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/imop/vl_imintegral.m: -------------------------------------------------------------------------------- 1 | % VL_IMINTEGRAL Compute integral image 2 | % J = VL_IMINTEGRAL(I) calculates the integral image J of the image 3 | % I. I must a matrix with DOUBLE, SINGLE, UINT32, or INT32 storage 4 | % class. J is given by 5 | % 6 | % J(i,j) = sum(I(1:i,1:j)). 7 | % 8 | % J has the same size as I and the same storage class. 9 | % 10 | % Example:: 11 | % The following identity holds: 12 | % VL_IMINTEGRAL(ONES(3)) = [ 1 2 3 ; 13 | % 2 4 6 ; 14 | % 3 6 9 ] 15 | % 16 | % See also: VL_HELP(). 17 | 18 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 19 | % All rights reserved. 20 | % 21 | % This file is part of the VLFeat library and is made available under 22 | % the terms of the BSD license (see the COPYING file). 23 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/imop/vl_imreadbw.m: -------------------------------------------------------------------------------- 1 | function I = vl_imreadgray(file,varargin) 2 | % VL_IMREADGRAY Reads an image as gray-scale 3 | % I=VL_IMREADGRAY(FILE) reads the image from file FILE and converts the 4 | % result to a gray scale image (DOUBLE storage class ranging in 5 | % [0,1]). 6 | % 7 | % VL_IMREADGRAY(FILE,FMT) specifies the file format FMT (see IMREAD()). 8 | % 9 | % See also: RGB2DOUBLE(), VL_HELP(). 10 | 11 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 12 | % All rights reserved. 13 | % 14 | % This file is part of the VLFeat library and is made available under 15 | % the terms of the BSD license (see the COPYING file). 16 | 17 | I = imread(file) ; 18 | I = im2double(I) ; 19 | 20 | if(size(I,3) > 1) 21 | I = rgb2gray(I) ; 22 | end 23 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/imop/vl_imreadgray.m: -------------------------------------------------------------------------------- 1 | function I = vl_imreadgray(file,varargin) 2 | % VL_IMREADGRAY Reads an image as gray-scale 3 | % I=VL_IMREADGRAY(FILE) reads the image from file FILE and converts the 4 | % result to a gray scale image (DOUBLE storage class ranging in 5 | % [0,1]). 6 | % 7 | % VL_IMREADGRAY(FILE,FMT) specifies the file format FMT (see IMREAD()). 8 | % 9 | % See also: RGB2DOUBLE(), VL_HELP(). 10 | 11 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 12 | % All rights reserved. 13 | % 14 | % This file is part of the VLFeat library and is made available under 15 | % the terms of the BSD license (see the COPYING file). 16 | 17 | I = imread(file) ; 18 | I = im2double(I) ; 19 | 20 | if(size(I,3) > 1) 21 | I = rgb2gray(I) ; 22 | end 23 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/imop/vl_imsc.m: -------------------------------------------------------------------------------- 1 | function J=vl_imsc(I) 2 | % VL_IMSC Scale image 3 | % J=VL_IMSC(I) scales the range of the gray-scale or color image I to 4 | % fit in the interval [0,1]. 5 | % 6 | % See also: VL_HELP(). 7 | 8 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 9 | % All rights reserved. 10 | % 11 | % This file is part of the VLFeat library and is made available under 12 | % the terms of the BSD license (see the COPYING file). 13 | 14 | if ~isfloat(I) 15 | I = im2double(I) ; 16 | end 17 | 18 | J = I - min(I(:)) ; 19 | J = J / max(J(:)) ; 20 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/imop/vl_imsmooth.m: -------------------------------------------------------------------------------- 1 | % VL_IMSMOOTH Smooth image 2 | % J = VL_IMSMOOTH(I,SIGMA) convolves the image I by an isotropic 3 | % Gaussian kernel of standard deviation SIGMA. I must be an array 4 | % of doubles. IF the array is three dimensional, the third dimension 5 | % is assumed to span different channels (e.g. R,G,B). In this case, 6 | % each channel is convolved independently. 7 | % 8 | % VL_IMSMOOTH() accepts the following options: 9 | % 10 | % Kernel:: 11 | % Selects between GAUSSIAN and TRIANGULAR kernels. The triangular 12 | % kernel support has 2*SIGMA-1 sampels. Kernels have unit mass. 13 | % 14 | % Padding:: 15 | % Selects between ZERO or CONTINUITY padding method to handle the 16 | % image boundaries. ZERO extends the input image with zeroes 17 | % around the border, and CONTINUITY extends the image with 18 | % constant pixels. 19 | % 20 | % Step:: 21 | % Sets the subsampling step. A subsampling step of STEP pixels 22 | % causes J(1:STEPS:end, 1:STEPS:end, :) to be computed. This is 23 | % useful to downsample the image. 24 | % 25 | % See also: VL_HELP(). 26 | 27 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 28 | % All rights reserved. 29 | % 30 | % This file is part of the VLFeat library and is made available under 31 | % the terms of the BSD license (see the COPYING file). 32 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/imop/vl_imup.m: -------------------------------------------------------------------------------- 1 | function J = vl_imup(I) 2 | % VL_IMUP Upsample an image by two 3 | % J=VL_IMUP(I) doubles the resolution of the image I by using 4 | % bilinear interpolation. 5 | % 6 | % See also: VL_IMDOWN(), VL_HELP(). 7 | 8 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 9 | % All rights reserved. 10 | % 11 | % This file is part of the VLFeat library and is made available under 12 | % the terms of the BSD license (see the COPYING file). 13 | 14 | [M,N,K] = size(I) ; 15 | 16 | J = zeros(2*M,2*N,K) ; 17 | 18 | J(1:2:end,1:2:end,:) = I ; 19 | 20 | J(2:2:end,1:2:end,:) = 0.5*(I+[I(2:end,:,:);I(end,:,:)]) ; 21 | J(1:2:end,2:2:end,:) = 0.5*(I+[I(:,2:end,:),I(:,end,:)]) ; 22 | J(2:2:end,2:2:end,:) = ... 23 | 0.25*(... 24 | J(2:2:end,1:2:end-1,:)+... 25 | J(1:2:end-1,2:2:end,:)+... 26 | [J(2:2:end,3:2:end,:),J(2:2:end,end-1,:)]+... 27 | [J(3:2:end,2:2:end,:);J(end-1,2:2:end,:)]) ; 28 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/imop/vl_imwhiten.m: -------------------------------------------------------------------------------- 1 | function J=vl_imwhiten(I,alpha,cutoff) 2 | % VL_IMWHITEN Whiten image 3 | % J = VL_IMWHITEN(I,ALPHA) approximatively whitens the power spectrum 4 | % of the natural image I. The algorithm assumes that the modulus of 5 | % the spectrum decays as 1/f^ALPHA (f is the frequency). 6 | % 7 | % VL_IMWHITEN(I) uses ALPHA=1 (a typical value for natural images). 8 | % 9 | % VL_IMWHITEN(I,ALPHA,CUTOFF) also applies a low-pass filter with 10 | % cutoff frequency equal to CUTOFF x FN, where FN is the Nyquist 11 | % frequency (half of the sampling frequency). 12 | % 13 | % See also: VL_HELP(). 14 | 15 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 16 | % All rights reserved. 17 | % 18 | % This file is part of the VLFeat library and is made available under 19 | % the terms of the BSD license (see the COPYING file). 20 | 21 | if ~exist('alpha'), alpha = 1 ; end 22 | if ~exist('cutoff'), cutoff = [] ; end 23 | 24 | [M,N]=size(I) ; 25 | 26 | % Frequency domain 27 | fn = 0.5 ; % Nyquist freq (=1/2T, T=1) 28 | fx_range=linspace(-fn, fn, N) ; 29 | fy_range=linspace(-fn, fn, M) ; 30 | [fx fy]=meshgrid(fx_range, fy_range) ; 31 | 32 | % Whitening filter 33 | rho=sqrt(fx.*fx+fy.*fy); 34 | filt=rho.^alpha ; 35 | 36 | % Low-pass filter 37 | if ~isempty(cutoff) 38 | fcut = cutoff * fn ; 39 | filt = filt .* exp(-(rho/fcut).^4); 40 | %filt = filt .* exp( - 0.5 * (rho / fcut) .^ 2); 41 | end 42 | 43 | % Apply filter 44 | J = real(ifft2(fft2(I).*fftshift(filt))) ; 45 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/imop/vl_wtps.m: -------------------------------------------------------------------------------- 1 | function [xp1,xp2]=vl_wtps(phi,Yp) 2 | % VL_WTPS Thin-plate spline warping 3 | % [XP1,XP2]=VL_WTPS(PHI,YP) computes the thin-plate spline (TPS) 4 | % specified by the basis PHI and the warped control point Yp. 5 | % 6 | % Yp is a 2xK matrix with one column per control point and the basis 7 | % PHI is calculated by means of the VL_TPS function. 8 | % 9 | % The thin-palte spline is defined on a domain X1,X2 and specified 10 | % by a set of points Y and their warp YP. The spline passes 11 | % interpolates exaclty the control points. 12 | % 13 | % The parameters X1,X2 and Y are used to compute the basis PHI. This 14 | % operation is fairily slow, but computing the spline for a given Yp 15 | % is then very quick, as the operation is just a linear combination 16 | % of the basis. 17 | % 18 | % Example:: 19 | % To calculate the warped grid [X1,X2] by moving the control points Y to 20 | % the control points YP use: 21 | % [xp1,xp2]=VL_WTPS(VL_TPS(x1,x2,Y),Yp). 22 | % 23 | % See also: VL_TPS(), VL_HELP(). 24 | 25 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 26 | % All rights reserved. 27 | % 28 | % This file is part of the VLFeat library and is made available under 29 | % the terms of the BSD license (see the COPYING file). 30 | 31 | [K,M,N] = size(phi) ; 32 | 33 | Xp=[Yp, zeros(2,3)]*reshape(phi,K,M*N) ; 34 | 35 | xp1 = reshape(Xp(1,:),M,N) ; 36 | xp2 = reshape(Xp(2,:),M,N) ; 37 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/imop/vl_xyz2rgb.m: -------------------------------------------------------------------------------- 1 | function J=vl_xyz2rgb(I,ws) 2 | % VL_XYZ2RGB Convert XYZ to RGB 3 | % J = VL_XYZ2RGB(I) the XYZ image I in RGB format. 4 | % 5 | % VL_XYZ2RGB(I,WS) uses the RGB workspace WS. WS is a string in 6 | % 7 | % - CIE: E illuminant and 2.2 gamma 8 | % - Adobe: D65 illuminant and 2.2 gamma 9 | % 10 | % The default workspace is CIE. 11 | % 12 | % See also: VL_RGB2XYZ(), VL_HELP(). 13 | 14 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 15 | % All rights reserved. 16 | % 17 | % This file is part of the VLFeat library and is made available under 18 | % the terms of the BSD license (see the COPYING file). 19 | 20 | if(nargin < 2) 21 | workspace = 'CIE' ; 22 | else 23 | workspace = ws ; 24 | end 25 | 26 | switch workspace 27 | case 'CIE' 28 | % CIE: E illuminant and 2.2 gamma 29 | A = [ 30 | 0.488718 0.176204 0.000000 31 | 0.310680 0.812985 0.0102048 32 | 0.200602 0.0108109 0.989795 ]' ; 33 | gamma = 2.2 ; 34 | 35 | case 'Adobe' 36 | % Adobe 1998: D65 illuminant and 2.2 gamma 37 | A = [ 38 | 0.576700 0.297361 0.0270328 39 | 0.185556 0.627355 0.0706879 40 | 0.188212 0.0752847 0.99124 ]' ; 41 | gamma = 2.2 ; 42 | end 43 | 44 | [M,N,K] = size(I) ; 45 | 46 | I = reshape(I, M*N, K) ; 47 | J = inv(A)*I' ; 48 | J = reshape(J'.^(1/gamma), M, N, K) ; 49 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/info.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 2012a 6 | VLFeat 7 | toolbox 8 | ../doc/images/vl_blue.png 9 | ../doc/mdoc/ 10 | ../doc/images/vl_blue.png 11 | 12 | 13 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/kmeans/vl_hikmeanspush.m: -------------------------------------------------------------------------------- 1 | % VL_HIKMEANSPUSH Push data down an integer K-means tree 2 | % PATH = VL_HIKMEANSPUSH(TREE,X) quanizes the data X with the 3 | % hierachical integer K-means tree TREE. This is obtained by 4 | % calculating the path of each datum from the root of TREE down to a 5 | % leaf. Here X has a datum for each column and each column of PATH 6 | % represents the corresponding root-to-leaf path. 7 | % 8 | % Example:: 9 | % PATH(:,1) = [2 1 4] means that the first datum follows 10 | % the branches number 2, 1 and 4 starting from the root of the 11 | % HIKM tree ending to a leaf. 12 | % 13 | % See also: VL_HIKMEANS(), VL_HELP(). 14 | 15 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 16 | % All rights reserved. 17 | % 18 | % This file is part of the VLFeat library and is made available under 19 | % the terms of the BSD license (see the COPYING file). 20 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/kmeans/vl_ikmeans.m: -------------------------------------------------------------------------------- 1 | % VL_IKMEANS Integer K-means 2 | % C = VL_IKMEANS(X,K) returns the centers of a K-means paritioning of 3 | % the data space X. X must be of class UINT8. C is of class UINT32. 4 | % 5 | % [C, I] = VL_IKMEANS(...) returns the cluster associations I of the 6 | % data as well. 7 | % 8 | % VL_IKMEANS() accepts the following options: 9 | % 10 | % MaxPasses:: 200 11 | % Maximum number of iterations before giving up (the algorithm 12 | % stops as soon as there is no change in the data to cluster 13 | % associations). 14 | % 15 | % Method:: Lloyd 16 | % Algorithm to use ('Lloyd', 'Elkan'). 17 | % 18 | % Verbose:: 19 | % Increase the verbosity level. 20 | % 21 | % See also: VL_IKMEANSPUSH(), VL_IKMEANSHIST(), VL_HIKMEANS(), VL_HELP(). 22 | 23 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 24 | % All rights reserved. 25 | % 26 | % This file is part of the VLFeat library and is made available under 27 | % the terms of the BSD license (see the COPYING file). 28 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/kmeans/vl_ikmeanshist.m: -------------------------------------------------------------------------------- 1 | function h = vl_ikmeanshist(K,asgn) 2 | % VL_IKMEANSHIST Compute histogram of quantized data 3 | % H = VL_IKMEANSHIST(K,ASGN) computes the histogram of the IKM clusters 4 | % activated by cluster assignments ASGN. 5 | % 6 | % See also: VL_IKMEANS(), VL_IKMEANSPUSH(), VL_HELP(). 7 | 8 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 9 | % All rights reserved. 10 | % 11 | % This file is part of the VLFeat library and is made available under 12 | % the terms of the BSD license (see the COPYING file). 13 | 14 | h = zeros(K,1) ; 15 | h = vl_binsum(h, 1, double(asgn)) ; 16 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/kmeans/vl_ikmeanspush.m: -------------------------------------------------------------------------------- 1 | % VL_IKMEANSPUSH Project data on integer K-means paritions 2 | % I = VL_IKMEANSPUSH(X,C) projects the data X to the integer K-meanns 3 | % clusters of centers C returning the cluster indeces I. 4 | % 5 | % See also: VL_IKMEANS(), VL_HELP(). 6 | 7 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 8 | % All rights reserved. 9 | % 10 | % This file is part of the VLFeat library and is made available under 11 | % the terms of the BSD license (see the COPYING file). 12 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/inthist.tc: -------------------------------------------------------------------------------- 1 | /** @file inthist.tc 2 | ** @brief vl_intist.c helper 3 | ** @author Andrea Vedaldi 4 | **/ 5 | 6 | /* 7 | Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 8 | All rights reserved. 9 | 10 | This file is part of the VLFeat library and is made available under 11 | the terms of the BSD license (see the COPYING file). 12 | */ 13 | 14 | #define JOIN_(a,b) a ## b 15 | #define JOIN(a,b) JOIN_(a,b) 16 | 17 | #undef INTEGRAL 18 | #define INTEGRAL JOIN(integral_, SFX) 19 | 20 | /* 21 | This function is 'transpose safe': The integral histogram SRC can 22 | be either column major or row major, as long as WIDTH is the 23 | fastest varying dimension. 24 | */ 25 | void INTEGRAL (T* dst, 26 | int dstStride, 27 | T const* src, 28 | int srcWidth, int srcHeight, int srcStride) 29 | { 30 | int x, y ; 31 | *dst = *src ; 32 | dst += 1 ; 33 | src += 1 ; 34 | 35 | for (x = 1 ; x < srcWidth ; ++ x) { 36 | *dst = *(dst - 1) + *src ; 37 | dst += 1 ; 38 | src += 1 ; 39 | } 40 | 41 | for (y = 1 ; y < srcHeight ; ++ y) { 42 | dst += dstStride - srcWidth ; 43 | src += srcStride - srcWidth ; 44 | 45 | *dst = *(dst - dstStride) + *src ; 46 | dst += 1 ; 47 | src += 1 ; 48 | 49 | for (x = 1 ; x < srcWidth ; ++ x) { 50 | *dst = *(dst - dstStride) - *(dst - dstStride - 1) + *(dst - 1) + *src ; 51 | dst += 1 ; 52 | src += 1 ; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_alphanum.m: -------------------------------------------------------------------------------- 1 | function [strings, perm] = vl_alphanum(strings) 2 | % VL_ALPHANUM Sort strings using the Alphanum algorithm 3 | % STRINGS = VL_ALPHANUM(STRINGS) sorts the cell array of strings 4 | % STRINGS by using the Alphanum algorithm [1]. [STRINGS,PERM] = 5 | % VL_ALPHANUM(...) returns the corresponding permutation PERM as 6 | % well. 7 | % 8 | % Example:: 9 | % Alphanum sorts strings in a way that 'makes sense'. For instance 10 | % 11 | % strings = {'B1', 'B2', 'B12', 'A12', 'A1', 'A2'} ; 12 | % sorted = vl_alphanum(strings) ; 13 | % 14 | % produces the sorted array {'A1', 'A2', 'A12', 'B1', B2', 15 | % 'B12'}. By contrast, SORT() produces the array {'A1', 'A12', 16 | % 'A2', 'B1', B12', 'B2'} (note the position of the elements 17 | % 'A12', 'B12'). 18 | % 19 | % References: 20 | % [1] Dave Koelle, 'The Alphanum Algorithm', 21 | % http://www.davekoelle.com/alphanum.html 22 | 23 | chunks = regexp(strings, '(\d+|\D+)', 'tokens') ; 24 | for i = 1:length(strings) 25 | chunks{i} = [chunks{i}{:}] ; 26 | for j = 1:length(chunks{i}) 27 | if isstrprop(chunks{i}{j},'digit') 28 | chunks{i}{j} = sprintf('%020.0f',sscanf(chunks{i}{j},'%d')) ; 29 | end 30 | end 31 | chunks{i} = [chunks{i}{:}] ; 32 | end 33 | 34 | [dorp,perm] = sort(chunks) ; 35 | strings = strings(perm) ; 36 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_binsearch.m: -------------------------------------------------------------------------------- 1 | % VL_BINSEARCH Maps data to bins 2 | % IDX = VL_BINSEARCH(B, X) maps the elements of X to the bins 3 | % defined by B. B is a non-decreasing vector of M real numbers 4 | % defining bins [-inf, B(1)), [B(1), B(2)), ... [B(M) +inf] (note 5 | % that the last bin contains +inf). The bins are numbered from 0 to 6 | % M. X is a real (plain) array and IDX is an array with the same 7 | % dimensions of X, specifying the bin correpsonding to each element 8 | % of X. 9 | % 10 | % If B(1) = -inf the bin number 0 is removed and the bin number 1 is 11 | % [-inf B(2)). If B(M) = +inf, the last bin M is the singleton +inf. 12 | % 13 | % See also: VL_BINSUM(), VL_HELP(). 14 | 15 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 16 | % All rights reserved. 17 | % 18 | % This file is part of the VLFeat library and is made available under 19 | % the terms of the BSD license (see the COPYING file). 20 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_cummax.m: -------------------------------------------------------------------------------- 1 | % VL_CUMMAX Cumulative maximum 2 | % If X is a vector, VL_CUMMAX(X) is the vector with the cumulative 3 | % maximum of X. If X is a matrix, VL_CUMMAX(X) is the matrix of the 4 | % cumulative maximum of the columns of X. If X is a multi-dimensional 5 | % array, VL_CUMMAX(X) operates along the first non-singleton 6 | % dimension. 7 | % 8 | % The function is analogous to CUMSUM() and CUMPROD(), but it 9 | % computes the cumulative maximum rather than the cumulative sum or 10 | % product. 11 | % 12 | % The array X can be of any numeric class. 13 | % 14 | % Example:: 15 | % The cumulative maximum VL_CUMMAX([1 2 3 2 1]) is the vector 16 | % [1 2 3 3 3]. 17 | % 18 | % See also: CUMSUM(), CUMPROD(), VL_HELP(). 19 | 20 | % Author: Andrea Vedaldi 21 | 22 | % Copyright 23 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_getpid.c: -------------------------------------------------------------------------------- 1 | /** @internal 2 | ** @file vl_getpid.c 3 | ** @author Andrea Vedaldi 4 | ** @brief MEX implementation of VL_GETPID() 5 | **/ 6 | 7 | /* 8 | Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 9 | All rights reserved. 10 | 11 | This file is part of the VLFeat library and is made available under 12 | the terms of the BSD license (see the COPYING file). 13 | */ 14 | 15 | #include 16 | 17 | #ifdef VL_OS_WIN 18 | #include 19 | #else 20 | #include 21 | #endif 22 | 23 | #include 24 | 25 | void 26 | mexFunction(int nout, mxArray *out[], 27 | int nin, const mxArray *in[] VL_UNUSED) 28 | { 29 | double pid ; 30 | 31 | if (nin > 0) { 32 | vlmxError(vlmxErrTooManyInputArguments, NULL) ; 33 | } 34 | if (nout > 1) { 35 | vlmxError(vlmxErrTooManyOutputArguments, NULL) ; 36 | } 37 | 38 | #ifdef VL_OS_WIN 39 | pid = (double) GetCurrentProcessId() ; 40 | #else 41 | pid = (double) getpid() ; 42 | #endif 43 | out[0] = vlmxCreatePlainScalar (pid) ; 44 | } 45 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_getpid.m: -------------------------------------------------------------------------------- 1 | % VL_GETPID Get MATLAB process ID 2 | % VL_GETPID() returns MATLAB process ID. 3 | % 4 | % Algorithm:: 5 | % VL_GETPID() returns the result of the getpid() system call on 6 | % UNIX-like operating systems and of GetCurrentProcessID() on 7 | % Windows. 8 | % 9 | % See also: VL_HELP(). 10 | 11 | % Authors: Andrea Vedaldi 12 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_histmarg.m: -------------------------------------------------------------------------------- 1 | function H = vl_histmarg(H, dims) 2 | % VL_HISTMARG Marginal of histogram 3 | % H = VL_HISTMARG(H, DIMS) marginalizes the historgram H w.r.t the 4 | % dimensions DIMS. This is done by summing out all dimensions not 5 | % listed in DIMS and deleting them. 6 | % 7 | % Remark:: 8 | % If DIMS lists only one dimension, the returned histogram H is a 9 | % column vector. Notice that this way of deleting dimensions is 10 | % not always consistent with the SQUEEZE function. 11 | % 12 | % See also: VL_HELP(). 13 | 14 | % Authors: Andrea Vedaldi 15 | 16 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 17 | % All rights reserved. 18 | % 19 | % This file is part of the VLFeat library and is made available under 20 | % the terms of the BSD license (see the COPYING file). 21 | 22 | sz = size(H) ; 23 | 24 | for d=setdiff(1:length(sz), dims(:)) 25 | H = sum(H, d) ; 26 | end 27 | 28 | % Squeeze out marginalized dimensions 29 | sz = sz(dims(:)) ; 30 | sz = [sz ones(1,2-length(dims(:)))] ; 31 | H = reshape(H, sz) ; 32 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_ihashfind.m: -------------------------------------------------------------------------------- 1 | % VL_IHASHFIND Find labels in an integer hash table 2 | % SEL = VL_IHASHFIND(ID, NEXT, K, X) returns a vector SEL of the 3 | % entires in the hash table ID,NEXT,K corresponding to the labels 4 | % stored as columns of X. 5 | % 6 | % The format is the same as for the functino VL_IHASHSUM(). 7 | % 8 | % See also: VL_IHASHSUM(). 9 | 10 | % Author: Andrea Vedaldi 11 | 12 | % Copyright (C) 2008-12 Andrea Vedaldi. 13 | % All rights reserved. 14 | % 15 | % This file is part of the VLFeat library and is made available under 16 | % the terms of the BSD license (see the COPYING file). 17 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_inthist.m: -------------------------------------------------------------------------------- 1 | % VL_INTHIST Calculate Integral Histogram 2 | % INTHIST = VL_INTHIST(LABELS) computes the integral histogram for 3 | % the label map(s) LABELS. 4 | % 5 | % LABELS is a [M,N,L] UINT32 array containing L label maps (one for 6 | % each MxN layer). Each label map associates to each of the MxN 7 | % pixels one of K labels (a value of 0 denotes no association) with 8 | % unitary mass. 9 | % 10 | % INTHIST is the [M,N,K] integral histogram obtained by integrating 11 | % the label maps (an integral histogram is just an array of K 12 | % integral images, one for each of the K labels). All layers of 13 | % labels are accumulated to the same integral histogram. 14 | % 15 | % The total number of labels K is obtained as the maximum value of 16 | % LABELS. VL_INTHIST(..., 'NUMLABELS', K) specifies the number of 17 | % labels explicitly. 18 | % 19 | % VL_INTHIST(..., 'MASS', MASSES) specifies a mass MASSES for each 20 | % entry of LABELS. MASSES can be either of class UINT32 or DOUBLE, 21 | % and the class of INTHIST varies accordingly. 22 | % 23 | % See also: VL_IMINTEGRAL(), VL_SAMPLEINTHIST(), VL_HELP(). 24 | 25 | % Authors: Andrea Vedaldi 26 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_isoctave.m: -------------------------------------------------------------------------------- 1 | function x = vl_isoctave() 2 | % VL_ISOCTAVE Determines whether Octave is running 3 | % X = VL_ISOCTAVE() returns TRUE if the script is running in the 4 | % Octave environment (instead of MATLAB). 5 | 6 | persistent y ; 7 | 8 | if isempty(y) 9 | y = exist('OCTAVE_VERSION','builtin') ~= 0 ; 10 | end 11 | 12 | x = y ; 13 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_lbp.m: -------------------------------------------------------------------------------- 1 | % VL_LBP Local Binary Patterns 2 | % F = VL_LBP(IM, CELLSIZE) computes the Local Binary Pattern (LBP) 3 | % features for image I. 4 | % 5 | % IM is divided in cells of size CELLSIZE. F is a three-dimensional 6 | % array containing one histograms of quantized LBP features per 7 | % cell. The witdh of F is FLOOR(WIDTH/CELLSIZE), where WIDTH is the 8 | % width of the image. The same for the height. The third dimension 9 | % is 58. 10 | % 11 | % See also: VL_HELP(). 12 | 13 | % Copyright (C) 2010-11 Andrea Vedaldi. 14 | % All rights reserved. 15 | % 16 | % This file is part of the VLFeat library and is made available under 17 | % the terms of the BSD license (see the COPYING file). 18 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_lbpfliplr.m: -------------------------------------------------------------------------------- 1 | function f = vl_lbpfliplr(f) 2 | % VL_LBPFLIPLR Flip LBP features left-right 3 | % F = VL_LBPFLIPLR(F) flips the LBP features F from left to 4 | % right. 5 | % 6 | % Example:: 7 | % The following instructions return results almost identical 8 | % assuming that the width of I is exactly divisible by the cell 9 | % size: 10 | % F = VL_LBP(FLIPLR(I), 8) 11 | % F_ = VL_LBPFLIPLR(VL_LBP(I), 8) 12 | % 13 | % See also: VL_LBP(), VL_HELP(). 14 | 15 | % construct permutation 16 | perm = zeros(1,58) ; 17 | perm(58) = 58 ; 18 | perm(57) = 57 ; 19 | 20 | % i is the start of the sequence of 1 and j its length 21 | % recall that i=0 -> E, i=1 -> SE, etc 22 | % the length j remains the same. 23 | % flipping the start gives the flipped end, and subtracting the length 24 | % gives the flipped start 25 | 26 | for i = 0:7 27 | for j = 1:7 28 | i_ = mod(4 - i - j + 1, 8) ; 29 | j_ = j ; 30 | perm(i * 7 + j) = i_ * 7 + j_ ; 31 | end 32 | end 33 | 34 | f = f(:, end:-1:1, perm) ; 35 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_numder.m: -------------------------------------------------------------------------------- 1 | function d = vl_numder(func, x, varargin) 2 | % VL_NUMDER Numerical derivative 3 | % D = VL_NUMDER(FUNC, X) computes the numerical derivative of the 4 | % function FUNC at point X. X is a real array and is passed as first 5 | % argument of FUNC. 6 | % 7 | % D = VL_NUMDER(FUNC, X, ARG1, ARG2, ...) passes ARG1, ARG2, ... as 8 | % additional arguments to the function FUNC. 9 | % 10 | % See also: VL_NUMDER2(), VL_HELP(). 11 | 12 | % TODO: uniform sacaling of axis is not a good idea 13 | 14 | dx = 1e-7 ; 15 | N = numel(x) ; 16 | fx = feval(func, x, varargin{:}) ; 17 | d = zeros(length(fx(:)),N) ; 18 | 19 | for n=1:N 20 | e = zeros(size(x)) ; e(n) = 1 ; 21 | fxn = feval(func, x+dx*e, varargin{:}) ; 22 | di = (fxn - fx) / dx ; 23 | d(:,n) = di(:) ; 24 | end 25 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_numder2.m: -------------------------------------------------------------------------------- 1 | function d = vl_numder2(func, x, varargin) 2 | % VL_NUMDER2 Numerical second derivative 3 | % D = VL_NUMDER2(FUNC, X) computes the numerical second derivative of 4 | % the function FUNC at point X. 5 | % 6 | % D = VL_NUMDER2(FUNC, X, ARG1, ARG2, ...) allow to pass extra 7 | % parameters to the function FUNC. 8 | % 9 | % See also: VL_NUMDER(), VL_HELP(). 10 | 11 | N=length(x(:)) ; 12 | f00 = feval(func, x, varargin{:}) ; 13 | d=zeros(length(f00),N,N) ; 14 | D=1e-5 ; 15 | D2=D*D ; 16 | 17 | for n=1:N 18 | en=zeros(size(x)) ; en(n)=1 ; 19 | for m=1:N 20 | em=zeros(size(x)) ; em(m)=1 ; 21 | 22 | if( n ~= m ) 23 | f10 = feval(func, x+en*D, varargin{:}) ; 24 | f01 = feval(func, x+em*D, varargin{:}) ; 25 | f11 = feval(func, x+en*D+em*D, varargin{:}) ; 26 | d(:,n,m) = (f11-f01+f00-f10)/D2 ; 27 | else 28 | fp = feval(func, x+en*D, varargin{:}) ; 29 | fm = feval(func, x-en*D, varargin{:}) ; 30 | d(:,n,m) = (fm+fp-2*f00)/D2 ; 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_sampleinthist.m: -------------------------------------------------------------------------------- 1 | % VL_SAMPLINTHIST Sample integral histogram 2 | % HISTS = VL_SAMPLINTHIST(INTHIST, BOXES) samples the integral 3 | % histogram INTHIST to obtain the histograms of the specified 4 | % BOXES. 5 | % 6 | % INTHIST is a MxNxK array, where M x N are ``spatial'' dimensions, 7 | % and K is the number of histogram bins. INTHIST may be of class 8 | % UINT32 or DOUBLE. 9 | % 10 | % Each box is a four dimensional vector [IMIN JMIN IMAX JMAX]' of 11 | % class UINT32 and correspond to the index set [IMIN, IMAX] x [JMIN, 12 | % JMAX]. To specify an empty box, let IMIN > IMAX. 13 | % 14 | % HISTS stores one histogram per column (one for each box) and has K 15 | % rows, one for each histogram bin. HIST is of the same class of 16 | % INTHIST. 17 | % 18 | % See also: VL_INTHIST(), VL_IMINTEGRAL(), VL_HELP(). 19 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_simdctrl.c: -------------------------------------------------------------------------------- 1 | /** @file vl_simdctlr.c 2 | ** @brief vl_simdctrl MEX definition 3 | ** @author Andrea Vedaldi 4 | **/ 5 | 6 | /* 7 | Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 8 | All rights reserved. 9 | 10 | This file is part of the VLFeat library and is made available under 11 | the terms of the BSD license (see the COPYING file). 12 | */ 13 | 14 | #include "mexutils.h" 15 | 16 | void 17 | mexFunction(int nout, mxArray *out[], 18 | int nin, const mxArray *in[]) 19 | { 20 | enum {IN_ENABLED = 0} ; 21 | enum {OUT_ENABLED = 0} ; 22 | 23 | vl_bool wasEnabled = vl_get_simd_enabled() ; 24 | 25 | if (nout > 1) { 26 | vlmxError(vlmxErrInvalidArgument, 27 | "at most one output argument") ; 28 | } 29 | 30 | OUT(ENABLED) = vlmxCreatePlainScalar (wasEnabled) ; 31 | 32 | if (nin == 0) { 33 | return ; 34 | } 35 | if (nin > 1) { 36 | vlmxError(vlmxErrInvalidArgument, 37 | "At most one argument") ; 38 | } 39 | if (!vlmxIsScalar(IN(ENABLED))) { 40 | vlmxError(vlmxErrInvalidArgument, 41 | "ENABLED must be a scalar") ; 42 | } 43 | 44 | vl_set_simd_enabled ((vl_bool) mxGetScalar(IN(ENABLED))) ; 45 | } 46 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_simdctrl.m: -------------------------------------------------------------------------------- 1 | % VL_SIMDCTRL Toggle VLFeat SIMD optimizations 2 | % VL_SIMDCTRL() returns TRUE if VLFeat SIMD optimizations are enabled 3 | % and FALSE otherwise. 4 | % 5 | % VL_SIMDCTRL(TRUE) enables VLFeat SIMD optimizations. VL_SIMDCTRL(FALSE) 6 | % disables them. 7 | % 8 | % See also: VL_HELP(). 9 | 10 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 11 | % All rights reserved. 12 | % 13 | % This file is part of the VLFeat library and is made available under 14 | % the terms of the BSD license (see the COPYING file). 15 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_svmpegasos.m: -------------------------------------------------------------------------------- 1 | % VL_SVMPEGASOS [deprecated] 2 | % VL_SVMPEGASOS is deprecated. Please use VL_SVMTRAIN() instead. 3 | 4 | 5 | 6 | function [w b info] = vl_svmpegasos(DATA,LAMBDA, varargin) 7 | 8 | % Verbose not supported 9 | if (sum(strcmpi('Verbose',varargin))) 10 | varargin(find(strcmpi('Verbose',varargin),1))=[]; 11 | fprintf('Option VERBOSE is no longer supported.\n'); 12 | end 13 | 14 | % DiagnosticCallRef not supported 15 | if (sum(strcmpi('DiagnosticCallRef',varargin))) 16 | varargin(find(strcmpi('DiagnosticCallRef',varargin),1)+1)=[]; 17 | varargin(find(strcmpi('DiagnosticCallRef',varargin),1))=[]; 18 | fprintf('Option DIAGNOSTICCALLREF is no longer supported.\n Please follow the VLFeat tutorial on SVMs for more information on diagnostics\n'); 19 | end 20 | 21 | % different default value for MaxIterations 22 | if (sum(strcmpi('MaxIterations',varargin)) == 0) 23 | varargin{end+1} = 'MaxIterations'; 24 | varargin{end+1} = ceil(10/LAMBDA); 25 | end 26 | 27 | % different default value for BiasMultiplier 28 | if (sum(strcmpi('BiasMultiplier',varargin)) == 0) 29 | varargin{end+1} = 'BiasMultiplier'; 30 | varargin{end+1} = 0; 31 | end 32 | 33 | [w b info] = vl_svmtrain(DATA,LAMBDA,varargin{:}); 34 | 35 | fprintf('\n vl_svmpegasos is DEPRECATED. Please use vl_svmtrain instead. \n\n'); 36 | 37 | end 38 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_threads.c: -------------------------------------------------------------------------------- 1 | /** @file vl_threads.c 2 | ** @brief vl_threads MEX definition 3 | ** @author Andrea Vedaldi 4 | **/ 5 | 6 | /* 7 | Copyright (C) 2013 Andrea Vedaldi 8 | All rights reserved. 9 | 10 | This file is part of the VLFeat library and is made available under 11 | the terms of the BSD license (see the COPYING file). 12 | */ 13 | 14 | #include "mexutils.h" 15 | 16 | void 17 | mexFunction(int nout VL_UNUSED, mxArray *out[], 18 | int nin, const mxArray *in[]) 19 | { 20 | enum {IN_NUM = 0} ; 21 | enum {OUT_NUM = 0} ; 22 | vl_size numThreads ; 23 | 24 | numThreads = vl_get_max_threads() ; 25 | 26 | if (nout > 1) { 27 | vlmxError(vlmxErrInvalidArgument, "More than one ouptut argumnets requested.") ; 28 | } 29 | if (nin > 1) { 30 | vlmxError(vlmxErrInvalidArgument, "More than one input argument specified.") ; 31 | } 32 | 33 | 34 | OUT(NUM) = vlmxCreatePlainScalar (numThreads) ; 35 | 36 | if (nin == 0) { 37 | return ; 38 | } 39 | 40 | if (!vlmxIsScalar(IN(NUM))) { 41 | vlmxError(vlmxErrInvalidArgument, "NUM is not a scalar.") ; 42 | } 43 | 44 | numThreads = (vl_size) mxGetScalar(IN(NUM)) ; 45 | vl_set_num_threads (numThreads) ; 46 | } 47 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_threads.m: -------------------------------------------------------------------------------- 1 | %VL_THREADS Control VLFeat computational threads 2 | % [NUM,MAXNUM] = VL_THREADS() returns the current number of 3 | % computational threads NUM and the maximum possible number MAXNUM. 4 | % 5 | % VL_THREADS(NUM) sets the current number of threads to the 6 | % specified value. NUM = VL_THREADS(NUM) does the same, but returns 7 | % the *previous* number of computational threads as well. 8 | % 9 | % See also: VL_HELP(). 10 | 11 | % Copyright (C) 2013 Andrea Vedaldi. 12 | % All rights reserved. 13 | % 14 | % This file is part of the VLFeat library and is made available under 15 | % the terms of the BSD license (see the COPYING file). 16 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_twister.m: -------------------------------------------------------------------------------- 1 | % VL_TWISTER Random number generator 2 | % VL_TWISTER() is essentially equivalent to MATLAB native RAND() 3 | % when using the Twister random number generator. VL_TWISTER(), 4 | % VL_TWISTER(M,N,P,...) and VL_TWISTER([M N P ...]) are equivalent 5 | % to RAND(), RAND(M,N,P,...) and RAND([M N P ...]) respectively. 6 | % 7 | % The state of the random generator can be seeded by 8 | % VL_TWISTER('STATE', X), where X is a DOUBLE scalar (this is 9 | % equivalent to RAND('TWISTER', X)). The state can be read by 10 | % VL_TWISTER('STATE') (equivalent to RAND('TWISTER')) and set by 11 | % VL_TWISTER('STATE', STATE) (equivalent to RAND('TWISTER', 12 | % STATE)). Here STATE is a vector of 625 elements of class 13 | % UINT32. Finally VL_TWISTER('STATE',KEY) seeds the generator by a 14 | % vector of DOUBLE of length not greater than 624. 15 | % 16 | % VL_TWISTER() is slightly faster than RAND(). Moreover it can be 17 | % used to control the state of the random number generator used by 18 | % all VLFEAT functions. 19 | % 20 | % See also: VL_HELP(). 21 | 22 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 23 | % All rights reserved. 24 | % 25 | % This file is part of the VLFeat library and is made available under 26 | % the terms of the BSD license (see the COPYING file). 27 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_version.m: -------------------------------------------------------------------------------- 1 | % VL_VERSION Obtain VLFeat version information 2 | % VL_VERSION() prints VLFeat version number. VL_VERSION('VERBOSE') 3 | % prints additional information. 4 | % 5 | % STR = VL_VERSION(...) returns the ouptut in a string rather than 6 | % printing it. 7 | % 8 | % See also: VL_HELP(). 9 | 10 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 11 | % All rights reserved. 12 | % 13 | % This file is part of the VLFeat library and is made available under 14 | % the terms of the BSD license (see the COPYING file). 15 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/misc/vl_whistc.m: -------------------------------------------------------------------------------- 1 | function h = vl_whistc(x, w, edges, dim) 2 | % VL_WHISTC Weighted histogram 3 | % H = VL_WHISTC(X,W,EDGES) behaves exactly like HISTC(X,EDGES), but 4 | % weights the samples X by W. Samples that have NaN weight are 5 | % skipped. 6 | % 7 | % See also: HITSC(), VL_HELP(). 8 | 9 | % Authors: Andrea Vedladi 10 | 11 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 12 | % All rights reserved. 13 | % 14 | % This file is part of the VLFeat library and is made available under 15 | % the terms of the BSD license (see the COPYING file). 16 | 17 | numEdges = numel(edges) ; 18 | 19 | % map x to the bins defined by edges 20 | binIndexes = vl_binsearch(edges, x) ; 21 | 22 | % binsearch last bin is [edges(end) +inf] but for histc it is the 23 | % signleton [edges(end)] 24 | if numEdges > 0 25 | binIndexes(binIndexes == numEdges & x > edges(end)) = 0 ; 26 | end 27 | 28 | % NaNs must be also removed 29 | binIndexes(isnan(x)) = 0 ; 30 | 31 | % find operating dimension 32 | dimensions = size(x) ; 33 | if nargin < 4 34 | nonSingletonDims = find(dimensions > 1) ; 35 | if ~ isempty(nonSingletonDims) 36 | dim = nonSingletonDims(1) ; 37 | else 38 | dim = 2 ; % assume row vector 39 | end 40 | end 41 | 42 | % accumulate 43 | dimensions(dim) = numEdges ; 44 | h = zeros(dimensions) ; 45 | h = vl_binsum(h, w, binIndexes, dim) ; 46 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/mser/vl_erfill.m: -------------------------------------------------------------------------------- 1 | % VL_ERFILL Fill extremal region 2 | % MEMBERS=VL_ERFILL(I,ER) returns the list MEMBERS of the pixels which 3 | % belongs to the extremal region represented by the pixel ER. 4 | % 5 | % The selected region is the one that contains pixel ER and of 6 | % intensity I(ER). 7 | % 8 | % I must be of class UINT8 and ER must be a (scalar) index of the 9 | % region representative point. 10 | % 11 | % See also: VL_MSER(), VL_HELP(). 12 | 13 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 14 | % All rights reserved. 15 | % 16 | % This file is part of the VLFeat library and is made available under 17 | % the terms of the BSD license (see the COPYING file). 18 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/mser/vl_ertr.m: -------------------------------------------------------------------------------- 1 | function f = vl_ertr(f) ; 2 | % VL_ERTR Transpose exremal regions frames 3 | % F = VL_ERTR(F) transposes the frames F as returned by VL_MSER(). This 4 | % conversion is required as the VL_MSER algorithm considers the column 5 | % index I as the frist image index, while according standard image 6 | % convention the first coordinate is the abscissa X. 7 | % 8 | % See also: VL_MSER(), VL_HELP(). 9 | 10 | if size(f,1) ~= 5 11 | error('F is not in the right format') ; 12 | end 13 | 14 | % adjust convention 15 | f = f([2 1 5 4 3],:) ; 16 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/plotop/vl_cf.m: -------------------------------------------------------------------------------- 1 | function h = vl_cf(h0) 2 | % VL_CF Creates a copy of a figure 3 | % VL_CF() creates a copy of the current figure and returns VL_CF(H0) 4 | % creates a copy of the figure(s) whose handle is H0. H = 5 | % VL_CF(...) returns the handles of the copies. 6 | % 7 | % See also: VL_HELP(). 8 | 9 | % Authors: Andrea Vedaldi 10 | 11 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 12 | % All rights reserved. 13 | % 14 | % This file is part of the VLFeat library and is made available under 15 | % the terms of the BSD license (see the COPYING file). 16 | 17 | if nargin < 1 18 | h0 = gcf ; 19 | end 20 | 21 | h=zeros(size(h0)) ; 22 | for i=1:numel(h0) 23 | h(i) = copyobj(h0(i),get(h0(i),'Parent')) ; 24 | end 25 | 26 | if nargout < 1 27 | clear h ; 28 | end 29 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/plotop/vl_clicksegment.m: -------------------------------------------------------------------------------- 1 | function [P1,P2] = vl_clicksegment 2 | % VL_CLICKSEGMENT Select a segment by clicking 3 | % [P1,P2] = VL_CLICKSEGMENT() lets the user select a segment in the 4 | % current figure and returns the starting and ending point P1 and P2. 5 | % 6 | % The user can abort the operation by pressing any key. In this case 7 | % the function returns the empty matrix. 8 | % 9 | % See also: VL_CLICK(), VL_CLICKPOINT(), VL_HELP(). 10 | 11 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 12 | % All rights reserved. 13 | % 14 | % This file is part of the VLFeat library and is made available under 15 | % the terms of the BSD license (see the COPYING file). 16 | 17 | % Click first segment 18 | P1=vl_click ; 19 | if isempty(P1) 20 | P2=P1 ; 21 | return ; 22 | end 23 | 24 | was_hold = ishold(gca) ; 25 | hold on ; 26 | h=plot(P1(1),P1(2),'rx') ; 27 | 28 | % Click second segment 29 | P2=vl_click ; 30 | if isempty(P2) 31 | P1=P2 ; 32 | end 33 | delete(h) ; 34 | if ~was_hold, hold off ; end 35 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/plotop/vl_figaspect.m: -------------------------------------------------------------------------------- 1 | function vl_figaspect(a) 2 | % VL_FIGASPECT Set figure aspect ratio 3 | % VL_FIGASPECT(A) sets the current figure aspect ratio to A. It 4 | % leaves the length of the shortest side unaltered. Both the 5 | % screen and paper positions are affected. 6 | % 7 | % See also: VL_PRINTSIZE(), VL_HELP(). 8 | 9 | % Authors: Andrea Vedaldi 10 | 11 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 12 | % All rights reserved. 13 | % 14 | % This file is part of the VLFeat library and is made available under 15 | % the terms of the BSD license (see the COPYING file). 16 | 17 | pos = get(gcf, 'Position') ; 18 | 19 | if a >= 1 20 | pos(3) = a * pos(4) ; 21 | else 22 | pos(4) = pos(3) / a ; 23 | end 24 | 25 | set(gcf,'Position',pos) ; 26 | 27 | pos = get(gcf, 'PaperPosition') ; 28 | 29 | if a >= 1 30 | pos(3) = a * pos(4) ; 31 | else 32 | pos(4) = pos(3) / a ; 33 | end 34 | 35 | set(gcf,'PaperPosition', pos) ; 36 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/plotop/vl_linespec2prop.m: -------------------------------------------------------------------------------- 1 | function prop=vl_linespec2prop(spec) 2 | % VL_LINESPEC2PROP Convert PLOT style line specs to line properties 3 | % PROPR = VL_LINESPEC2PROP(SPEC) converts the string SPEC to a cell 4 | % array of properties PROPR. SPEC is in the format of PLOT(). 5 | % 6 | % If SPEC is not a line spec, the string SPEC is returned unaltered 7 | % as the only element of the cell array PROPR. 8 | % 9 | % See also: VL_PLOTFRAME(), PLOT(), VL_HELP(). 10 | 11 | % Authors: Andrea Vedaldi 12 | 13 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 14 | % Copyright (C) 2013 Andrea Vedaldi 15 | % All rights reserved. 16 | % 17 | % This file is part of the VLFeat library and is made available under 18 | % the terms of the BSD license (see the COPYING file). 19 | 20 | prop = {} ; 21 | 22 | if ~ ischar(spec) 23 | error('SPEC must be a string') ; 24 | end 25 | 26 | spec_ = spec ; 27 | 28 | switch spec(1:min(numel(spec),1)) 29 | case {'b' 'g' 'r' 'c' 'm' 'y' 'k' 'w'} 30 | prop = {prop{:}, 'Color', spec(1)} ; 31 | spec(1) = [] ; 32 | end 33 | 34 | switch spec(1:min(numel(spec),1)) 35 | case {'.' 'o' 'x' '+' '*' 's' 'd' 'v' '^' '<' '>' 'p' 'h'} 36 | prop = {prop{:}, 'Marker', spec(1)} ; 37 | spec(1) = [] ; 38 | end 39 | 40 | if isempty(spec) 41 | return ; 42 | end 43 | 44 | switch spec 45 | case {'-' ':' '-.' '--'} 46 | prop = {prop{:}, 'LineStyle', spec} ; 47 | otherwise 48 | prop = {spec_} ; 49 | end 50 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/plotop/vl_plotgrid.m: -------------------------------------------------------------------------------- 1 | function h=vl_plotgrid(x,y,varargin) 2 | % VL_PLOTGRID Plot a 2-D grid 3 | % VL_PLOTGRID(X,Y) plots a grid with vertices (X,Y). X and Y are MxN 4 | % matrices, with one entry per vertex. 5 | % 6 | % H=VL_PLOTGRID(...) returns the handle to the grid object. 7 | % 8 | % See also: VL_HELP(). 9 | 10 | washold = ishold ; 11 | 12 | [M,N] = size(x) ; 13 | 14 | hold on ; 15 | 16 | xh = [x' ; nan*ones(1,M) ] ; 17 | yh = [y' ; nan*ones(1,M) ] ; 18 | 19 | xh = xh(:) ; 20 | yh = yh(:) ; 21 | 22 | xv = [x ; nan*ones(1,N) ] ; 23 | yv = [y ; nan*ones(1,N) ] ; 24 | 25 | xv = xv(:) ; 26 | yv = yv(:) ; 27 | 28 | lineprop = {} ; 29 | if length(varargin) > 0 30 | lineprop = vl_linespec2prop(varargin{1}) ; 31 | lineprop = {lineprop{:}, varargin{2:end}} ; 32 | end 33 | 34 | h = line([xh' xv'], [yh' yv'],lineprop{:}) ; 35 | 36 | if ~washold 37 | hold off ; 38 | end 39 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/plotop/vl_plotpoint.m: -------------------------------------------------------------------------------- 1 | function h=vl_plotpoint(V,varargin) 2 | % VL_PLOTPOINT Plot 2 or 3 dimensional points 3 | % VL_PLOTPOINT(V) plots the 2 or 3 dimensional points V. V is a 2xK or 4 | % 3xK array, with one point per column. 5 | % 6 | % H=VL_PLOTPOINT(...) returns the handle H of the plot. 7 | % 8 | % VL_PLOTPOINT() is a simple wrapper around the PLOT() and PLOT3() 9 | % functions. By default, VL_PLOTPOINT(V) plots the points with line 10 | % style '.'. VL_PLOTPOINT(V,...) does not use the default line style; 11 | % rather it passess any extra argument to the underlying plot 12 | % function. 13 | % 14 | % See also: PLOT(), PLOT3(), VL_HELP(). 15 | 16 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 17 | % All rights reserved. 18 | % 19 | % This file is part of the VLFeat library and is made available under 20 | % the terms of the BSD license (see the COPYING file). 21 | 22 | if length(varargin) == 0 23 | varargin = {'.'}; 24 | end 25 | 26 | switch size(V,1) 27 | case 2 28 | h=plot(V(1,:),V(2,:),varargin{:}) ; 29 | case 3 30 | h=plot3(V(1,:),V(2,:),V(3,:),varargin{:}) ; 31 | otherwise 32 | error(['V must be either 2xK or 3xK.']) ; 33 | end 34 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/quickshift/vl_flatmap.m: -------------------------------------------------------------------------------- 1 | function [map, C] = vl_flatmap(map) 2 | % VL_FLATMAP Flatten a tree, assigning the label of the root to each node 3 | % [LABELS CLUSTERS] = VL_FLATMAP(MAP) labels each tree of the forest contained 4 | % in MAP. LABELS contains the linear index of the root node in MAP, CLUSTERS 5 | % instead contains a label between 1 and the number of clusters. 6 | % 7 | % See also: VL_HELP(). 8 | 9 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 10 | % All rights reserved. 11 | % 12 | % This file is part of the VLFeat library and is made available under 13 | % the terms of the BSD license (see the COPYING file). 14 | 15 | % follow the parents list to the root nodes (where nothing changes) 16 | while 1 17 | map_ = map(map) ; 18 | if isequal(map_,map) ; break ; end 19 | map = map_ ; 20 | end 21 | 22 | [drop,drop,C] = unique(map) ; 23 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/quickshift/vl_imseg.m: -------------------------------------------------------------------------------- 1 | function Q = vl_imseg(I,labels) 2 | % VL_IMSEG Color an image based on the segmentation 3 | % ISEG = VL_IMSEG(I,LABELS) labels ISEG with the average color from I of 4 | % each cluster indicated by LABELS. 5 | % 6 | % See also: VL_HELP(). 7 | 8 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 9 | % All rights reserved. 10 | % 11 | % This file is part of the VLFeat library and is made available under 12 | % the terms of the BSD license (see the COPYING file). 13 | 14 | [M,N,K] = size(I) ; 15 | Q = 0*I ; 16 | for k=1:size(I,3) 17 | acc = zeros(M,N) ; 18 | nrm = zeros(M,N) ; 19 | acc = vl_binsum(acc, I(:,:,k), labels) ; 20 | nrm = vl_binsum(nrm, ones(M,N), labels) ; 21 | acc = acc ./ (nrm+eps) ; 22 | Q(:,:,k) = acc(labels) ; 23 | end 24 | 25 | Q = min(1,Q); 26 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/sift/vl_liop.m: -------------------------------------------------------------------------------- 1 | % VL_LIOP Local Intensity Order Pattern descriptor 2 | % D = VL_LIOP(I) computes the LIOP descriptor of an image I, as 3 | % described by [1]. I is a gray-scale square image with odd side 4 | % length of class SINGLE. D is a column vector containing the LIOP 5 | % descriptor of I. Note that LIOP is also integrated in the VL_COVDET() 6 | % function for feature extraction. 7 | % 8 | % VL_LIOP() accepts the following options: 9 | % 10 | % NumNeighbours:: 4 11 | % Set the number of neighbours sampled to consruct the orer 12 | % pattern of each image pixel. 13 | % 14 | % Radius:: 5 15 | % Set the radius of the circular neighbourhood used to sampled 16 | % the local order pattern of each pixel. 17 | % 18 | % NumSpatialBins:: 6 19 | % Set the number of spatial pooling regions. The LIOP descriptor 20 | % has dimension factorial(NumNeighbours) * NumSpatialBins. 21 | % 22 | % IntensityThreshold:: -0.02 23 | % Set the intensity threshold used to weight oder patterns as they 24 | % are pooled into a histogram. A negative value is interpreted 25 | % as a fraction of the difference between the maximum and minimum 26 | % intesity in each local patch. 27 | % 28 | % Verbose:: 29 | % If specified, be verbose 30 | % 31 | % REFERENCES:: 32 | % [1] Z. Wang, B. Fan, F. Wu. Local Intensity Order Pattern for feature 33 | % description. In ICCV, 2011 34 | % 35 | % See: LIOP, VL_COVDET(), 36 | % VL_HELP(). 37 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/sift/vl_ubcmatch.m: -------------------------------------------------------------------------------- 1 | % VL_UBCMATCH Match SIFT features 2 | % MATCHES = VL_UBCMATCH(DESCR1, DESCR2) matches the two sets of SIFT 3 | % descriptors DESCR1 and DESCR2. 4 | % 5 | % [MATCHES,SCORES] = VL_UBCMATCH(DESCR1, DESCR2) retuns the matches and 6 | % also the squared Euclidean distance between the matches. 7 | % 8 | % The function uses the algorithm suggested by D. Lowe [1] to reject 9 | % matches that are too ambiguous. 10 | % 11 | % VL_UBCMATCH(DESCR1, DESCR2, THRESH) uses the specified threshold 12 | % THRESH. A descriptor D1 is matched to a descriptor D2 only if the 13 | % distance d(D1,D2) multiplied by THRESH is not greater than the 14 | % distance of D1 to all other descriptors. The default value of 15 | % THRESH is 1.5. 16 | % 17 | % The storage class of the descriptors can be either DOUBLE, FLOAT, 18 | % INT8 or UINT8. Usually integer classes are faster. 19 | % 20 | % REFERENCES:: 21 | % [1] D. G. Lowe, Distinctive image features from scale-invariant 22 | % keypoints. IJCV, vol. 2, no. 60, pp. 91-110, 2004. 23 | % 24 | % See also: VL_HELP(), VL_SIFT(). 25 | 26 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 27 | % All rights reserved. 28 | % 29 | % This file is part of the VLFeat library and is made available under 30 | % the terms of the BSD license (see the COPYING file). 31 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/slic/vl_slic.m: -------------------------------------------------------------------------------- 1 | % VL_SLIC SLIC superpixels 2 | % SEGMENTS = VL_SLIC(IM, REGIONSIZE, REGULARIZER) extracts the SLIC 3 | % superpixes [1] from image IM. REGIONSIZE is the starting size of 4 | % the superpixels and REGULARIZER is the trades-off appearance for 5 | % spatial regularity when clustering (a larger value results in more 6 | % spatial regularization). SEGMENTS is a UINT32 array containing the 7 | % superpixel identifier for each image pixel. 8 | % 9 | % The image IM is a SINGLE array with two or three dimensions. The 10 | % third dimension is arbitrary, but it is usually three for RGB or 11 | % LAB images. 12 | % 13 | % VL_SLIC() accepts the following options: 14 | % 15 | % Verbose:: 16 | % Be verbose. 17 | % 18 | % MinRegionSize:: (1/6 of REGIONSIZE)^2 19 | % The minimum size (in pixel area) of the extracted 20 | % superpixels. 21 | % 22 | % Example:: 23 | % If IM contains an RGB images, the SLIC superpixels can be 24 | % extracted as: 25 | % 26 | % REFERENCES:: 27 | % [1] R. Achanta, A. Shaji, K. Smith, A. Lucchi, P. Fua, and 28 | % S. Susstrunk. SLIC superpixels. Technical report, EPFL, 2010. 29 | % 30 | % See also:: http://www.vlfeat.org/doc/api/slic.html, VL_HELP(). 31 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/special/vl_ddgaussian.m: -------------------------------------------------------------------------------- 1 | function y = vl_ddgaussian(x) 2 | % VL_DDGAUSSIAN Second derivative of the Gaussian density function 3 | % Y=VL_DDGAUSSIAN(X) computes the second derivative of the standard 4 | % Gaussian density. 5 | % 6 | % To obtain the second derivative of the Gaussian density of 7 | % standard deviation S, do 8 | % 9 | % Y = 1/S^3 * VL_DDGAUSSIAN(X/S) . 10 | % 11 | % See also: VL_GAUSSIAN(), VL_DGAUSSIAN(), VL_HELP(). 12 | 13 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 14 | % All rights reserved. 15 | % 16 | % This file is part of the VLFeat library and is made available under 17 | % the terms of the BSD license (see the COPYING file). 18 | 19 | y = (x.^2 - 1)/sqrt(2*pi) .* exp(-0.5*x.^2) ; 20 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/special/vl_dgaussian.m: -------------------------------------------------------------------------------- 1 | function y = vl_dgaussian(x) 2 | % VL_DGAUSSIAN Derivative of the Gaussian density function 3 | % Y=VL_DGAUSSIAN(X) evaluates the derivative of the standard Gaussian 4 | % density. 5 | % 6 | % To obtain the Gaussian density of standard deviation S, do 7 | % 8 | % Y = 1/S^2 * VL_DGAUSSIAN(X/S) . 9 | % 10 | % See also: VL_GAUSSIAN(), VL_DDGAUSSIAN(), VL_HELP(). 11 | 12 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 13 | % All rights reserved. 14 | % 15 | % This file is part of the VLFeat library and is made available under 16 | % the terms of the BSD license (see the COPYING file). 17 | 18 | y = -x/sqrt(2*pi) .* exp(-0.5*x.^2) ; 19 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/special/vl_dsigmoid.m: -------------------------------------------------------------------------------- 1 | function y = vl_dsigmoid(x) 2 | % VL_DSIGMOID Derivative of the sigmoid function 3 | % Y = VL_DSIGMOID(X) returns the derivative of VL_SIGMOID(X). This is 4 | % calculated as - VL_SIGMOID(X) * (1 - VL_SIGMOID(X)). 5 | % 6 | % See also: VL_SIGMOID(X), VL_HELP(). 7 | 8 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 9 | % All rights reserved. 10 | % 11 | % This file is part of the VLFeat library and is made available under 12 | % the terms of the BSD license (see the COPYING file). 13 | 14 | t = vl_sigmoid(x) ; 15 | y = t .* (1 - t) ; 16 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/special/vl_gaussian.m: -------------------------------------------------------------------------------- 1 | function y = vl_gaussian(x) 2 | % VL_GAUSSIAN Standard Gaussian density function 3 | % Y=VL_GAUSSIAN(X) computes the standard (zero mean, unit variance) 4 | % Gaussian density. 5 | % 6 | % To obtain the Gaussian density of standard deviation S do 7 | % 8 | % Y = 1/S * VL_GAUSSIAN(X/S). 9 | % 10 | % See also: VL_DGAUSSIAN(), VL_DDGAUSSIAN(), VL_HELP(). 11 | 12 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 13 | % All rights reserved. 14 | % 15 | % This file is part of the VLFeat library and is made available under 16 | % the terms of the BSD license (see the COPYING file). 17 | 18 | y = 1/sqrt(2*pi)*exp(-0.5*x.^2) ; 19 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/special/vl_rcos.m: -------------------------------------------------------------------------------- 1 | function y = vl_rcos(r,x) 2 | % VL_RCOS RCOS function 3 | % Y = VL_RCOS(R,X) computes the RCOS function with roll-off R. 4 | % 5 | % See also: VL_HELP(). 6 | 7 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 8 | % All rights reserved. 9 | % 10 | % This file is part of the VLFeat library and is made available under 11 | % the terms of the BSD license (see the COPYING file). 12 | 13 | x = abs(x) ; 14 | if(r > 0) 15 | y = (x < (1 - r)) + ... 16 | 0.5 * (1 + cos((1 - r - x)/r*pi)) .* ... 17 | (x <= 1) .* (x >= 1 - r) ; 18 | else 19 | y = (abs(x) <= 1) ; 20 | end 21 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/special/vl_sigmoid.m: -------------------------------------------------------------------------------- 1 | function y = vl_sigmoid(x) 2 | % VL_SIGMOID Sigmoid function 3 | % Y = VL_SIGMOID(X) returns 4 | % 5 | % Y = 1 ./ (1 + EXP(X)) ; 6 | % 7 | % Remark:: 8 | % Useful properties of the sigmoid function are: 9 | % 10 | % - 1 - VL_SIGMOID(X) = VL_SIGMOID(-X) 11 | % - Centered sigmoid: 2 * VL_SIGMOID(X) - 1 ; 12 | % - VL_SIGMOID(X) = (EXP(X/2) - EXP(X/2)) / (EXP(X/2) + EXP(X/2)) 13 | % 14 | % See also: VL_DSIGMOID(), VL_HELP(). 15 | 16 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 17 | % All rights reserved. 18 | % 19 | % This file is part of the VLFeat library and is made available under 20 | % the terms of the BSD license (see the COPYING file). 21 | 22 | y = 1 ./ (1 + exp(-x)) ; 23 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/vl_demo.m: -------------------------------------------------------------------------------- 1 | function vl_demo 2 | % VL_DEMO Run VLFeat demos 3 | % VL_DEMO runs all VLFeat demos in a row, exporting figures for 4 | % the documentation. Edit this file to see a list of the vailable 5 | % demos, or look into the toolbox/demo directory. 6 | 7 | % Author: Andrea Vedaldi 8 | 9 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 10 | % All rights reserved. 11 | % 12 | % This file is part of the VLFeat library and is made available under 13 | % the terms of the BSD license (see the COPYING file). 14 | 15 | if vl_isoctave() 16 | more off ; 17 | end 18 | 19 | root = vl_root ; 20 | demo_path = fullfile(root,'toolbox','demo') ; 21 | addpath(demo_path) ; 22 | 23 | vl_demo_covdet ; 24 | 25 | vl_demo_sift_basic ; 26 | vl_demo_sift_peak ; 27 | vl_demo_sift_edge ; 28 | %vl_demo_sift_cmd ; 29 | vl_demo_sift_or ; 30 | vl_demo_sift_match ; 31 | vl_demo_sift_vs_ubc ; 32 | 33 | vl_demo_mser_basic ; 34 | vl_demo_mser_delta ; 35 | %vl_demo_mser_cmd ; 36 | 37 | vl_demo_aib ; 38 | vl_demo_quickshift ; 39 | vl_demo_slic ; 40 | vl_demo_dsift ; 41 | vl_demo_hog ; 42 | 43 | vl_demo_svm ; 44 | 45 | vl_demo_kdtree ; 46 | vl_demo_kdtree_sift ; 47 | vl_demo_kdtree_self ; 48 | vl_demo_kdtree_forest ; 49 | vl_demo_kdtree_ann ; 50 | 51 | vl_demo_kmeans_2d ; 52 | 53 | vl_demo_imdisttf ; 54 | 55 | vl_demo_plots_rank ; 56 | 57 | vl_demo_gmm_2d_rand; 58 | vl_demo_gmm_2d_twist; 59 | vl_demo_gmm_3d; 60 | 61 | vl_demo_kmeans_ann_speed; 62 | 63 | rmpath(demo_path); 64 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/vl_root.m: -------------------------------------------------------------------------------- 1 | function path = vl_root 2 | % VL_ROOT Obtain VLFeat root path 3 | % PATH = VL_ROOT() returns the path to the VLFeat installation. 4 | % 5 | % See also: VL_SETUP(), VL_HELP(). 6 | 7 | % Authors: Andrea Vedaldi and Brian Fulkerson 8 | 9 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 10 | % All rights reserved. 11 | % 12 | % This file is part of the VLFeat library and is made available under 13 | % the terms of the BSD license (see the COPYING file). 14 | 15 | [a,b,c] = fileparts(mfilename('fullpath')) ; 16 | [a,b,c] = fileparts(a) ; 17 | path = a ; 18 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_assert_almost_equal.m: -------------------------------------------------------------------------------- 1 | function vl_assert_almost_equal(x, y, varargin) 2 | epsilon = 1e-6 ; 3 | if length(varargin) > 0 4 | if isnumeric(varargin{1}) 5 | epsilon = varargin{1} ; 6 | varargin(1) = [] ; 7 | end 8 | end 9 | assert(isequal(class(x), class(y)), varargin{:}) ; 10 | assert(isequal(size(x), size(y)), varargin{:}) ; 11 | if isstruct(x) 12 | fx = fieldnames(x) ; 13 | fy = fieldnames(y) ; 14 | assert(isequal(fx,fy), varargin{:}) ; 15 | for i=1:numel(fx) 16 | vl_assert_almost_equal(x.(fx{i}), y.(fy{i}), epsilon, varargin{:}) ; 17 | end 18 | else 19 | i = isnan(x) ; 20 | j = isnan(y) ; 21 | assert(isequal(i,j), varargin{:}) ; 22 | assert(max(abs(x(~i) - y(~i))) < epsilon, varargin{:}) ; 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_assert_equal.m: -------------------------------------------------------------------------------- 1 | function vl_assert_equal(x, y, varargin) 2 | assert(isequalwithequalnans(x,y),varargin{:}) ; 3 | end 4 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_assert_exception.m: -------------------------------------------------------------------------------- 1 | function vl_assert_exception(func, errorId, errorMessage) 2 | % VL_ASSERT_EXCEPTION 3 | 4 | try 5 | func() ; 6 | catch 7 | e = lasterror ; 8 | if nargin >= 2 9 | assert(isequal(e.identifier, errorId), ... 10 | 'Exception ID ''%s'' is not ''%s''.', ... 11 | e.identifier, errorId) ; 12 | end 13 | if nargin >= 3 14 | assert(isequal(e.message, errorMessage), ... 15 | 'Exception message ''%s'' is not ''%s''.', ... 16 | e.message, errorMessage) ; 17 | end 18 | return ; 19 | end 20 | assert(0, 'The function did not generate an exception.') ; 21 | end 22 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_argparse.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_argparse(varargin) 2 | % VL_TEST_ARGPARSE 3 | vl_test_init ; 4 | 5 | function test_basic() 6 | opts.field1 = 1 ; 7 | opts.field2 = 2 ; 8 | opts.field3 = 3 ; 9 | 10 | opts_ = opts ; 11 | opts_.field1 = 3 ; 12 | opts_.field2 = 10 ; 13 | 14 | opts = vl_argparse(opts, {'field2', 10, 'field1', 3}) ; 15 | assert(isequal(opts, opts_)) ; 16 | 17 | opts_.field1 = 9 ; 18 | opts = vl_argparse(opts, {'field1', 4, 'field1', 9}) ; 19 | assert(isequal(opts, opts_)) ; 20 | 21 | function test_error() 22 | opts.field1 = 1 ; 23 | try 24 | opts = vl_argparse(opts, {'field2', 5}) ; 25 | catch e 26 | return ; 27 | end 28 | assert(false) ; 29 | 30 | function test_leftovers() 31 | opts1.field1 = 1 ; 32 | opts2.field2 = 1 ; 33 | opts1_.field1 = 2 ; 34 | opts2_.field2 = 2 ; 35 | 36 | [opts1,args] = vl_argparse(opts1, {'field1', 2, 'field2', 2}) ; 37 | opts2 = vl_argparse(opts2, args) ; 38 | 39 | assert(isequal(opts1,opts1_), isequal(opts2,opts2_)) ; 40 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_binsearch.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_binsearch(varargin) 2 | % VL_TEST_BINSEARCH 3 | vl_test_init ; 4 | 5 | function test_inf_bins() 6 | x = [-inf -1 0 1 +inf] ; 7 | vl_assert_equal(vl_binsearch([], x), [0 0 0 0 0]) ; 8 | vl_assert_equal(vl_binsearch([-inf 0], x), [1 1 2 2 2]) ; 9 | vl_assert_equal(vl_binsearch([-inf], x), [1 1 1 1 1]) ; 10 | vl_assert_equal(vl_binsearch([-inf +inf], x), [1 1 1 1 2]) ; 11 | 12 | function test_empty() 13 | vl_assert_equal(vl_binsearch([], []), []) ; 14 | 15 | function test_bnd() 16 | vl_assert_equal(vl_binsearch([], [1]), [0]) ; 17 | vl_assert_equal(vl_binsearch([], [-inf]), [0]) ; 18 | vl_assert_equal(vl_binsearch([], [+inf]), [0]) ; 19 | 20 | vl_assert_equal(vl_binsearch([1], [.9]), [0]) ; 21 | vl_assert_equal(vl_binsearch([1], [1]), [1]) ; 22 | vl_assert_equal(vl_binsearch([1], [-inf]), [0]) ; 23 | vl_assert_equal(vl_binsearch([1], [+inf]), [1]) ; 24 | 25 | function test_basic() 26 | vl_assert_equal(vl_binsearch(-10:10, -10:10), 1:21) ; 27 | vl_assert_equal(vl_binsearch(-10:10, -11:10), 0:21) ; 28 | vl_assert_equal(vl_binsearch(-10:10, [-inf, -11:10, +inf]), [0 0:21 21]) ; 29 | 30 | function test_frac() 31 | vl_assert_equal(vl_binsearch(1:10, 1:.5:10), floor(1:.5:10)) 32 | vl_assert_equal(vl_binsearch(1:10, fliplr(1:.5:10)), ... 33 | fliplr(floor(1:.5:10))) ; 34 | 35 | function test_array() 36 | a = reshape(1:100,10,10) ; 37 | b = reshape(1:.5:100.5, 2, []) ; 38 | c = floor(b) ; 39 | vl_assert_equal(vl_binsearch(a,b), c) ; 40 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_binsum.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_binsum(varargin) 2 | % VL_TEST_BINSUM 3 | vl_test_init ; 4 | 5 | function test_three_args() 6 | vl_assert_almost_equal(... 7 | vl_binsum([0 0], 1, 2), [0 1]) ; 8 | vl_assert_almost_equal(... 9 | vl_binsum([1 7], -1, 1), [0 7]) ; 10 | vl_assert_almost_equal(... 11 | vl_binsum([1 7], -1, [1 2 2 2 2 2 2 2]), [0 0]) ; 12 | 13 | function test_four_args() 14 | vl_assert_almost_equal(... 15 | vl_binsum(eye(3), [1 1 1], [1 2 3], 1), 2*eye(3)) ; 16 | vl_assert_almost_equal(... 17 | vl_binsum(eye(3), [1 1 1]', [1 2 3]', 2), 2*eye(3)) ; 18 | vl_assert_almost_equal(... 19 | vl_binsum(eye(3), 1, [1 2 3], 1), 2*eye(3)) ; 20 | vl_assert_almost_equal(... 21 | vl_binsum(eye(3), 1, [1 2 3]', 2), 2*eye(3)) ; 22 | 23 | function test_3d_one() 24 | Z = zeros(3,3,3) ; 25 | B = 3*ones(3,1,3) ; 26 | R = Z ; R(:,3,:) = 17 ; 27 | vl_assert_almost_equal(... 28 | vl_binsum(Z, 17, B, 2), R) ; 29 | 30 | function test_3d_two() 31 | Z = zeros(3,3,3) ; 32 | B = 3*ones(3,3,1) ; 33 | X = zeros(3,3,1) ; X(:,:,1) = 17 ; 34 | R = Z ; R(:,:,3) = 17 ; 35 | vl_assert_almost_equal(... 36 | vl_binsum(Z, X, B, 3), R) ; 37 | 38 | function test_storage_classes() 39 | types = {@double, @single, @int64, @uint64, ... 40 | @int32, @uint32, @int16, @uint16, ... 41 | @int8, @uint8} ; 42 | for a = types 43 | a = a{1} ; 44 | for b = types 45 | b = b{1} ; 46 | vl_assert_almost_equal(... 47 | vl_binsum(a(eye(3)), a([1 1 1]), b([1 2 3]), 1), a(2*eye(3))) ; 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_colsubset.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_colsubset(varargin) 2 | % VL_TEST_COLSUBSET 3 | vl_test_init ; 4 | 5 | function s = setup() 6 | s.x = [5 2 3 6 4 7 1 9 8 0] ; 7 | 8 | function test_beginning(s) 9 | vl_assert_equal(1:5, vl_colsubset(1:10, 5, 'beginning')) ; 10 | vl_assert_equal(1:5, vl_colsubset(1:10, .5, 'beginning')) ; 11 | 12 | function test_ending(s) 13 | vl_assert_equal(6:10, vl_colsubset(1:10, 5, 'ending')) ; 14 | vl_assert_equal(6:10, vl_colsubset(1:10, .5, 'ending')) ; 15 | 16 | function test_largest(s) 17 | vl_assert_equal([5 6 7 9 8], vl_colsubset(s.x, 5, 'largest')) ; 18 | vl_assert_equal([5 6 7 9 8], vl_colsubset(s.x, .5, 'largest')) ; 19 | 20 | function test_smallest(s) 21 | vl_assert_equal([2 3 4 1 0], vl_colsubset(s.x, 5, 'smallest')) ; 22 | vl_assert_equal([2 3 4 1 0], vl_colsubset(s.x, .5, 'smallest')) ; 23 | 24 | function test_random(s) 25 | assert(numel(intersect(s.x, vl_colsubset(s.x, 5, 'random'))) == 5) ; 26 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_cummax.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_cummax(varargin) 2 | % VL_TEST_CUMMAX 3 | vl_test_init ; 4 | 5 | function test_basic() 6 | vl_assert_almost_equal(... 7 | vl_cummax(1), 1) ; 8 | vl_assert_almost_equal(... 9 | vl_cummax([1 2 3 4], 2), [1 2 3 4]) ; 10 | 11 | function test_multidim() 12 | a = [1 2 3 4 3 2 1] ; 13 | b = [1 2 3 4 4 4 4] ; 14 | for k=1:6 15 | dims = ones(1,6) ; 16 | dims(k) = numel(a) ; 17 | a = reshape(a, dims) ; 18 | b = reshape(b, dims) ; 19 | vl_assert_almost_equal(... 20 | vl_cummax(a, k), b) ; 21 | end 22 | 23 | function test_storage_classes() 24 | types = {@double, @single, @int64, @uint64, ... 25 | @int32, @uint32, @int16, @uint16, ... 26 | @int8, @uint8} ; 27 | for a = types 28 | a = a{1} ; 29 | for b = types 30 | b = b{1} ; 31 | vl_assert_almost_equal(... 32 | vl_cummax(a(eye(3))), a(toeplitz([1 1 1], [1 0 0 ]))) ; 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_gmm.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_gmm(varargin) 2 | % VL_TEST_GMM 3 | 4 | % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 5 | % All rights reserved. 6 | % 7 | % This file is part of the VLFeat library and is made available under 8 | % the terms of the BSD license (see the COPYING file). 9 | 10 | vl_test_init ; 11 | 12 | end 13 | 14 | function s = setup() 15 | randn('state',0) ; 16 | s.X = randn(128, 1000) ; 17 | end 18 | 19 | function test_multithreading(s) 20 | dataTypes = {'single','double'} ; 21 | 22 | for dataType = dataTypes 23 | conversion = str2func(char(dataType)) ; 24 | X = conversion(s.X) ; 25 | vl_twister('state',0) ; 26 | vl_threads(0) ; 27 | [means, covariances, priors, ll, posteriors] = ... 28 | vl_gmm(X, 10, ... 29 | 'NumRepetitions', 1, ... 30 | 'MaxNumIterations', 10, ... 31 | 'Initialization', 'rand') ; 32 | vl_twister('state',0) ; 33 | vl_threads(1) ; 34 | [means_, covariances_, priors_, ll_, posteriors_] = ... 35 | vl_gmm(X, 10, ... 36 | 'NumRepetitions', 1, ... 37 | 'MaxNumIterations', 10, ... 38 | 'Initialization', 'rand') ; 39 | 40 | vl_assert_almost_equal(means, means_, 1e-2) ; 41 | vl_assert_almost_equal(covariances, covariances_, 1e-2) ; 42 | vl_assert_almost_equal(priors, priors_, 1e-2) ; 43 | vl_assert_almost_equal(ll, ll_, 1e-2 * abs(ll)) ; 44 | vl_assert_almost_equal(posteriors, posteriors_, 1e-2) ; 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_grad.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_grad(varargin) 2 | % VL_TEST_GRAD 3 | vl_test_init ; 4 | 5 | function s = setup() 6 | s.I = rand(150,253) ; 7 | s.I_small = rand(2,2) ; 8 | 9 | function test_equiv(s) 10 | vl_assert_equal(gradient(s.I), vl_grad(s.I)) ; 11 | 12 | function test_equiv_small(s) 13 | vl_assert_equal(gradient(s.I_small), vl_grad(s.I_small)) ; 14 | 15 | function test_equiv_forward(s) 16 | Ix = diff(s.I,2,1) ; 17 | Iy = diff(s.I,2,1) ; 18 | 19 | vl_assert_equal(gradient(s.I_small), vl_grad(s.I_small)) ; 20 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_hikmeans.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_hikmeans(varargin) 2 | % VL_TEST_IKMEANS 3 | vl_test_init ; 4 | 5 | function s = setup() 6 | rand('state',0) ; 7 | s.data = uint8(rand(2,1000) * 255) ; 8 | 9 | function test_basic(s) 10 | [tree, assign] = vl_hikmeans(s.data,3,100) ; 11 | assign_ = vl_hikmeanspush(tree, s.data) ; 12 | vl_assert_equal(assign,assign_) ; 13 | 14 | function test_elkan(s) 15 | [tree, assign] = vl_hikmeans(s.data,3,100,'method','elkan') ; 16 | assign_ = vl_hikmeanspush(tree, s.data) ; 17 | vl_assert_equal(assign,assign_) ; 18 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_ihashsum.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_ihashsum(varargin) 2 | % VL_TEST_IHASHSUM 3 | vl_test_init ; 4 | 5 | function s = setup() 6 | rand('state',0) ; 7 | s.data = uint8(round(16*rand(2,100))) ; 8 | sel = find(all(s.data==0)) ; 9 | s.data(1,sel)=1 ; 10 | 11 | function test_hash(s) 12 | D = size(s.data,1) ; 13 | K = 5 ; 14 | h = zeros(1,K,'uint32') ; 15 | id = zeros(D,K,'uint8'); 16 | next = zeros(1,K,'uint32') ; 17 | [h,id,next] = vl_ihashsum(h,id,next,K,s.data) ; 18 | 19 | sel = vl_ihashfind(id,next,K,s.data) ; 20 | count = double(h(sel)) ; 21 | 22 | [drop,i,j] = unique(s.data','rows') ; 23 | for k=1:size(s.data,2) 24 | count_(k) = sum(j == j(k)) ; 25 | end 26 | vl_assert_equal(count,count_) ; 27 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_ikmeans.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_ikmeans(varargin) 2 | % VL_TEST_IKMEANS 3 | vl_test_init ; 4 | 5 | function s = setup() 6 | rand('state',0) ; 7 | s.data = uint8(rand(2,1000) * 255) ; 8 | 9 | function test_basic(s) 10 | [centers, assign] = vl_ikmeans(s.data,100) ; 11 | assign_ = vl_ikmeanspush(s.data, centers) ; 12 | vl_assert_equal(assign,assign_) ; 13 | 14 | function test_elkan(s) 15 | [centers, assign] = vl_ikmeans(s.data,100,'method','elkan') ; 16 | assign_ = vl_ikmeanspush(s.data, centers) ; 17 | vl_assert_equal(assign,assign_) ; 18 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_imarray.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_imarray(varargin) 2 | % VL_TEST_IMARRAY 3 | vl_test_init ; 4 | 5 | function test_movie_rgb(s) 6 | A = rand(23,15,3,4) ; 7 | B = vl_imarray(A,'movie',true) ; 8 | 9 | function test_movie_indexed(s) 10 | cmap = get(0,'DefaultFigureColormap') ; 11 | A = uint8(size(cmap,1)*rand(23,15,4)) ; 12 | A = min(A,size(cmap,1)-1) ; 13 | B = vl_imarray(A,'movie',true) ; 14 | 15 | function test_movie_gray_indexed(s) 16 | A = uint8(255*rand(23,15,4)) ; 17 | B = vl_imarray(A,'movie',true,'cmap',gray(256)) ; 18 | 19 | for k=1:size(A,3) 20 | vl_assert_equal(squeeze(A(:,:,k)), ... 21 | frame2im(B(k))) ; 22 | end 23 | 24 | function test_basic(s) 25 | M = 3 ; 26 | N = 4 ; 27 | width = 32 ; 28 | height = 15 ; 29 | for i=1:M 30 | for j=1:N 31 | A{i,j} = rand(width,height) ; 32 | end 33 | end 34 | A1 = A'; 35 | A1 = cat(3,A1{:}) ; 36 | A2 = cell2mat(A) ; 37 | B = vl_imarray(A1, 'layout', [M N]) ; 38 | vl_assert_equal(A2,B) ; 39 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_imwbackward.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_imwbackward(varargin) 2 | % VL_TEST_IMWBACKWARD 3 | vl_test_init ; 4 | 5 | function s = setup() 6 | s.I = im2double(imread(fullfile(vl_root,'data','spots.jpg'))) ; 7 | 8 | function test_identity(s) 9 | xr = 1:size(s.I,2) ; 10 | yr = 1:size(s.I,1) ; 11 | [x,y] = meshgrid(xr,yr) ; 12 | vl_assert_almost_equal(s.I, vl_imwbackward(xr,yr,s.I,x,y)) ; 13 | 14 | function test_invalid_args(s) 15 | xr = 1:size(s.I,2) ; 16 | yr = 1:size(s.I,1) ; 17 | [x,y] = meshgrid(xr,yr) ; 18 | vl_assert_exception(@() vl_imwbackward(xr,yr,single(s.I),x,y), 'vl:invalidArgument') ; 19 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_inthist.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_inthist(varargin) 2 | % VL_TEST_INTHIST 3 | vl_test_init ; 4 | 5 | function s = setup() 6 | rand('state',0) ; 7 | s.labels = uint32(8*rand(123, 76, 3)) ; 8 | 9 | function test_basic(s) 10 | l = 10 ; 11 | hist = vl_inthist(s.labels, 'numlabels', l) ; 12 | hist_ = inthist_slow(s.labels, l) ; 13 | vl_assert_equal(double(hist),hist_) ; 14 | 15 | function test_sample(s) 16 | rand('state',0) ; 17 | boxes = 10 * rand(4,20) + .5 ; 18 | boxes(3:4,:) = boxes(3:4,:) + boxes(1:2,:) ; 19 | boxes = min(boxes, 10) ; 20 | boxes = uint32(boxes) ; 21 | inthist = vl_inthist(s.labels) ; 22 | hist = vl_sampleinthist(inthist, boxes) ; 23 | 24 | function hist = inthist_slow(labels, numLabels) 25 | m = size(labels,1) ; 26 | n = size(labels,2) ; 27 | l = numLabels ; 28 | b = zeros(m*n,l) ; 29 | b = vl_binsum(b, 1, reshape(labels,m*n,[]), 2) ; 30 | b = reshape(b,m,n,l) ; 31 | for k=1:l 32 | hist(:,:,k) = cumsum(cumsum(b(:,:,k)')') ; 33 | end 34 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_lbp.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_lbp(varargin) 2 | % VL_TEST_TWISTER 3 | vl_test_init ; 4 | 5 | function test_one_on() 6 | I = {} ; 7 | I{1} = [0 0 0 ; 0 0 1 ; 0 0 0] ; 8 | I{2} = [0 0 0 ; 0 0 0 ; 0 0 1] ; 9 | I{3} = [0 0 0 ; 0 0 0 ; 0 1 0] ; 10 | I{4} = [0 0 0 ; 0 0 0 ; 1 0 0] ; 11 | I{5} = [0 0 0 ; 1 0 0 ; 0 0 0] ; 12 | I{6} = [1 0 0 ; 0 0 0 ; 0 0 0] ; 13 | I{7} = [0 1 0 ; 0 0 0 ; 0 0 0] ; 14 | I{8} = [0 0 1 ; 0 0 0 ; 0 0 0] ; 15 | 16 | for j=0:7 17 | h = vl_lbp(single(I{j+1}), 3) ; 18 | h = find(squeeze(h)) ; 19 | vl_assert_equal(h, j * 7 + 1) ; 20 | end 21 | 22 | function test_two_on() 23 | I = {} ; 24 | I{1} = [0 0 0 ; 0 0 1 ; 0 0 1] ; 25 | I{2} = [0 0 0 ; 0 0 0 ; 0 1 1] ; 26 | I{3} = [0 0 0 ; 0 0 0 ; 1 1 0] ; 27 | I{4} = [0 0 0 ; 1 0 0 ; 1 0 0] ; 28 | I{5} = [1 0 0 ; 1 0 0 ; 0 0 0] ; 29 | I{6} = [1 1 0 ; 0 0 0 ; 0 0 0] ; 30 | I{7} = [0 1 1 ; 0 0 0 ; 0 0 0] ; 31 | I{8} = [0 0 1 ; 0 0 1 ; 0 0 0] ; 32 | 33 | for j=0:7 34 | h = vl_lbp(single(I{j+1}), 3) ; 35 | h = find(squeeze(h)) ; 36 | vl_assert_equal(h, j * 7 + 2) ; 37 | end 38 | 39 | function test_fliplr() 40 | randn('state',0) ; 41 | I = randn(256,256,1,'single') ; 42 | f = vl_lbp(fliplr(I), 8) ; 43 | f_ = vl_lbpfliplr(vl_lbp(I, 8)) ; 44 | vl_assert_almost_equal(f,f_,1e-3) ; 45 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_liop.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_liop(varargin) 2 | % VL_TEST_SIFT 3 | vl_test_init ; 4 | 5 | function s = setup() 6 | randn('state',0) ; 7 | s.patch = randn(65,'single') ; 8 | xr = -32:32 ; 9 | [x,y] = meshgrid(xr) ; 10 | s.blob = - single(x.^2+y.^2) ; 11 | 12 | function test_basic(s) 13 | d = vl_liop(s.patch) ; 14 | 15 | function test_blob(s) 16 | % with a blob, all local intensity order pattern are equal. In 17 | % particular, if the blob intensity decreases away from the center, 18 | % then all local intensities sampled in a neighbourhood of 2 elements 19 | % are already sorted (see LIOP details). 20 | d = vl_liop(s.blob, ... 21 | 'IntensityThreshold', 0, ... 22 | 'NumNeighbours', 2, ... 23 | 'NumSpatialBins', 1) ; 24 | assert(isequal(d, single([1;0]))) ; 25 | 26 | function test_neighbours(s) 27 | for n=2:5 28 | for p=1:3 29 | d = vl_liop(s.patch, 'NumNeighbours', n, 'NumSpatialBins', p) ; 30 | assert(numel(d) == p * factorial(n)) ; 31 | end 32 | end 33 | 34 | function test_multiple(s) 35 | x = randn(31,31,3, 'single') ; 36 | d = vl_liop(x) ; 37 | for i=1:3 38 | d_(:,i) = vl_liop(squeeze(x(:,:,i))) ; 39 | end 40 | assert(isequal(d,d_)) ; 41 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_mser.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_mser(varargin) 2 | % VL_TEST_MSER 3 | vl_test_init ; 4 | 5 | function s = setup() 6 | s.im = im2uint8(rgb2gray(vl_impattern('roofs1'))) ; 7 | 8 | function test_mser(s) 9 | [regions,frames] = vl_mser(s.im) ; 10 | mask = vl_erfill(s.im, regions(1)) ; 11 | 12 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_phow.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_phow(varargin) 2 | % VL_TEST_PHOPW 3 | vl_test_init ; 4 | 5 | function s = setup() 6 | s.I = im2double(imread(fullfile(vl_root,'data','spots.jpg'))) ; 7 | s.I = single(s.I) ; 8 | 9 | function test_gray(s) 10 | [f,d] = vl_phow(s.I, 'color', 'gray') ; 11 | assert(size(d,1) == 128) ; 12 | 13 | function test_rgb(s) 14 | [f,d] = vl_phow(s.I, 'color', 'rgb') ; 15 | assert(size(d,1) == 128*3) ; 16 | 17 | function test_hsv(s) 18 | [f,d] = vl_phow(s.I, 'color', 'hsv') ; 19 | assert(size(d,1) == 128*3) ; 20 | 21 | function test_opponent(s) 22 | [f,d] = vl_phow(s.I, 'color', 'opponent') ; 23 | assert(size(d,1) == 128*3) ; 24 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_plotbox.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_plotbox(varargin) 2 | % VL_TEST_PLOTBOX 3 | vl_test_init ; 4 | 5 | function test_basic(s) 6 | figure(1) ; clf ; 7 | vl_plotbox([-1 -1 1 1]') ; 8 | xlim([-2 2]) ; 9 | ylim([-2 2]) ; 10 | close(1) ; 11 | 12 | function test_multiple(s) 13 | figure(1) ; clf ; 14 | randn('state', 0) ; 15 | vl_plotbox(randn(4,10)) ; 16 | close(1) ; 17 | 18 | function test_style(s) 19 | figure(1) ; clf ; 20 | randn('state', 0) ; 21 | vl_plotbox(randn(4,10), 'r-.', 'LineWidth', 3) ; 22 | close(1) ; 23 | 24 | 25 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_roc.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_roc(varargin) 2 | % VL_TEST_ROC 3 | vl_test_init ; 4 | 5 | function s = setup() 6 | s.scores0 = [5 4 3 2 1] ; 7 | s.scores1 = [5 3 4 2 1] ; 8 | s.labels = [1 1 -1 -1 -1] ; 9 | 10 | function test_perfect_tptn(s) 11 | [tpr,tnr] = vl_roc(s.labels,s.scores0) ; 12 | vl_assert_almost_equal(tpr, [0 1 2 2 2 2] / 2) ; 13 | vl_assert_almost_equal(tnr, [3 3 3 2 1 0] / 3) ; 14 | 15 | function test_perfect_metrics(s) 16 | [tpr,tnr,info] = vl_roc(s.labels,s.scores0) ; 17 | vl_assert_almost_equal(info.eer, 0) ; 18 | vl_assert_almost_equal(info.auc, 1) ; 19 | 20 | function test_swap1_tptn(s) 21 | [tpr,tnr] = vl_roc(s.labels,s.scores1) ; 22 | vl_assert_almost_equal(tpr, [0 1 1 2 2 2] / 2) ; 23 | vl_assert_almost_equal(tnr, [3 3 2 2 1 0] / 3) ; 24 | 25 | function test_swap1_tptn_stable(s) 26 | [tpr,tnr] = vl_roc(s.labels,s.scores1,'stable',true) ; 27 | vl_assert_almost_equal(tpr, [1 2 1 2 2] / 2) ; 28 | vl_assert_almost_equal(tnr, [3 2 2 1 0] / 3) ; 29 | 30 | function test_swap1_metrics(s) 31 | [tpr,tnr,info] = vl_roc(s.labels,s.scores1) ; 32 | vl_assert_almost_equal(info.eer, 1/3) ; 33 | vl_assert_almost_equal(info.auc, 1 - 1/(2*3)) ; 34 | 35 | 36 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_sift.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_sift(varargin) 2 | % VL_TEST_SIFT 3 | vl_test_init ; 4 | 5 | function s = setup() 6 | s.I = im2single(imread(fullfile(vl_root,'data','box.pgm'))) ; 7 | [s.ubc.f, s.ubc.d] = ... 8 | vl_ubcread(fullfile(vl_root,'data','box.sift')) ; 9 | 10 | function test_ubc_descriptor(s) 11 | err = [] ; 12 | [f, d] = vl_sift(s.I,... 13 | 'firstoctave', -1, ... 14 | 'frames', s.ubc.f) ; 15 | D2 = vl_alldist(f, s.ubc.f) ; 16 | [drop, perm] = min(D2) ; 17 | f = f(:,perm) ; 18 | d = d(:,perm) ; 19 | error = mean(sqrt(sum((single(s.ubc.d) - single(d)).^2))) ... 20 | / mean(sqrt(sum(single(s.ubc.d).^2))) ; 21 | assert(error < 0.1, ... 22 | 'sift descriptor did not produce desctiptors similar to UBC ones') ; 23 | 24 | function test_ubc_detector(s) 25 | [f, d] = vl_sift(s.I,... 26 | 'firstoctave', -1, ... 27 | 'peakthresh', .01, ... 28 | 'edgethresh', 10) ; 29 | 30 | s.ubc.f(4,:) = mod(s.ubc.f(4,:), 2*pi) ; 31 | f(4,:) = mod(f(4,:), 2*pi) ; 32 | 33 | % scale the components so that 1 pixel erro in x,y,z is equal to a 34 | % 10-th of angle. 35 | S = diag([1 1 1 20/pi]); 36 | D2 = vl_alldist(S * s.ubc.f, S * f) ; 37 | [d2,perm] = sort(min(D2)) ; 38 | error = sqrt(d2) ; 39 | quant80 = round(.8 * size(f,2)) ; 40 | 41 | % check for less than one pixel error at 80% quantile 42 | assert(error(quant80) < 1, ... 43 | 'sift detector did not produce enough keypoints similar to UBC ones') ; 44 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_slic.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_slic(varargin) 2 | % VL_TEST_SLIC 3 | vl_test_init ; 4 | 5 | function s = setup() 6 | s.im = im2single(vl_impattern('roofs1')) ; 7 | 8 | function test_slic(s) 9 | segmentation = vl_slic(s.im, 10, 0.1) ; 10 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/toolbox/xtest/vl_test_twister.m: -------------------------------------------------------------------------------- 1 | function results = vl_test_twister(varargin) 2 | % VL_TEST_TWISTER 3 | vl_test_init ; 4 | 5 | function test_illegal_args() 6 | vl_assert_exception(@() vl_twister(-1), 'vl:invalidArgument') ; 7 | vl_assert_exception(@() vl_twister(1, -1), 'vl:invalidArgument') ; 8 | vl_assert_exception(@() vl_twister([1, -1]), 'vl:invalidArgument') ; 9 | 10 | function test_seed_by_scalar() 11 | rand('twister',1) ; a = rand ; 12 | vl_twister('state',1) ; b = vl_twister ; 13 | vl_assert_equal(a,b,'seed by scalar + VL_TWISTER()') ; 14 | 15 | function test_get_set_state() 16 | rand('twister',1) ; a = rand('twister') ; 17 | vl_twister('state',1) ; b = vl_twister('state') ; 18 | vl_assert_equal(a,b,'read state') ; 19 | 20 | a(1) = a(1) + 1 ; 21 | vl_twister('state',a) ; b = vl_twister('state') ; 22 | vl_assert_equal(a,b,'set state') ; 23 | 24 | function test_multi_dimensions() 25 | b = rand('twister') ; 26 | rand('twister',b) ; 27 | vl_twister('state',b) ; 28 | a=rand([1 2 3 4 5]) ; 29 | b=vl_twister([1 2 3 4 5]) ; 30 | vl_assert_equal(a,b,'VL_TWISTER([M N P ...])') ; 31 | 32 | function test_multi_multi_args() 33 | rand('twister',1) ; a=rand(1, 2, 3, 4, 5) ; 34 | vl_twister('state',1) ; b=vl_twister(1, 2, 3, 4, 5) ; 35 | vl_assert_equal(a,b,'VL_TWISTER(M, N, P, ...)') ; 36 | 37 | function test_square() 38 | rand('twister',1) ; a=rand(10) ; 39 | vl_twister('state',1) ; b=vl_twister(10) ; 40 | vl_assert_equal(a,b,'VL_TWISTER(N)') ; 41 | 42 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/vl/lbp.h: -------------------------------------------------------------------------------- 1 | /** @file lbp.h 2 | ** @brief Local Binary Patterns 3 | ** @author Andrea Vedaldi 4 | **/ 5 | 6 | /* 7 | Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 8 | All rights reserved. 9 | 10 | This file is part of the VLFeat library and is made available under 11 | the terms of the BSD license (see the COPYING file). 12 | */ 13 | 14 | #ifndef VL_LBP_H 15 | #define VL_LBP_H 16 | 17 | #include "generic.h" 18 | 19 | /** @brief Type of quantization for LBP features */ 20 | typedef enum _VlLbpMappingType 21 | { 22 | VlLbpUniform /**< Uniform patterns */ 23 | } VlLbpMappingType ; 24 | 25 | /** @brief Local Binary Pattern extractor */ 26 | typedef struct VlLbp_ 27 | { 28 | vl_size dimension ; 29 | vl_uint8 mapping [256] ; 30 | vl_bool transposed ; 31 | } VlLbp ; 32 | 33 | VL_EXPORT VlLbp * vl_lbp_new(VlLbpMappingType type, vl_bool transposed) ; 34 | VL_EXPORT void vl_lbp_delete(VlLbp * self) ; 35 | VL_EXPORT void vl_lbp_process (VlLbp * self, 36 | float * features, 37 | float * image, vl_size width, vl_size height, 38 | vl_size cellSize) ; 39 | 40 | 41 | /** @brief Get the dimension of the LBP histograms 42 | ** @return dimension of the LBP histograms. 43 | ** The dimension depends on the type of quantization used. 44 | ** @see ::vl_lbp_new(). 45 | **/ 46 | 47 | VL_INLINE vl_size vl_lbp_get_dimension(VlLbp * self) 48 | { 49 | return self->dimension ; 50 | } 51 | 52 | /* VL_LBP_H */ 53 | #endif 54 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/vl/rodrigues.h: -------------------------------------------------------------------------------- 1 | /** @file rodrigues.h 2 | ** @brief Rodrigues formulas 3 | ** @author Andrea Vedaldi 4 | **/ 5 | 6 | /* 7 | Copyright (C) 2007-13 Andrea Vedaldi and Brian Fulkerson. 8 | All rights reserved. 9 | 10 | This file is part of the VLFeat library and is made available under 11 | the terms of the BSD license (see the COPYING file). 12 | */ 13 | 14 | /** @file rodrigues.h 15 | 16 | @section rodrigues Rodrigues formulas 17 | 18 | - Use ::vl_rodrigues to compute the Rodrigues formula and its derivative. 19 | - Use ::vl_irodrigues to compute the inverse Rodrigues formula and 20 | its derivative. 21 | 22 | **/ 23 | 24 | #ifndef VL_RODRIGUES 25 | #define VL_RODRIGUES 26 | 27 | #include "generic.h" 28 | 29 | VL_EXPORT void vl_rodrigues (double* R_pt, double* dR_pt, const double* om_pt) ; 30 | VL_EXPORT void vl_irodrigues (double* om_pt, double* dom_pt, const double* R_pt) ; 31 | 32 | /* VL_RODRIGUES */ 33 | #endif 34 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/vl/slic.h: -------------------------------------------------------------------------------- 1 | /** @file slic.h 2 | ** @brief SLIC superpixels (@ref slic) 3 | ** @author Andrea Vedaldi 4 | **/ 5 | 6 | /* 7 | Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 8 | All rights reserved. 9 | 10 | This file is part of the VLFeat library and is made available under 11 | the terms of the BSD license (see the COPYING file). 12 | */ 13 | 14 | #ifndef VL_SLIC_H 15 | #define VL_SLIC_H 16 | 17 | #include "generic.h" 18 | 19 | VL_EXPORT void 20 | vl_slic_segment (vl_uint32 * segmentation, 21 | float const * image, 22 | vl_size width, 23 | vl_size height, 24 | vl_size numChannels, 25 | vl_size regionSize, 26 | float regularization, 27 | vl_size minRegionSize) ; 28 | 29 | /* VL_SLIC_H */ 30 | #endif 31 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/vl/vlad.h: -------------------------------------------------------------------------------- 1 | /** @file vlad.h 2 | ** @brief VLAD encoding (@ref vlad) 3 | ** @author David Novotny 4 | ** @author Andrea Vedaldi 5 | ** @see @ref vlad 6 | **/ 7 | 8 | /* 9 | Copyright (C) 2013 David Novotny and Andera Vedaldi. 10 | All rights reserved. 11 | 12 | This file is part of the VLFeat library and is made available under 13 | the terms of the BSD license (see the COPYING file). 14 | */ 15 | 16 | #ifndef VL_VLAD_H 17 | #define VL_VLAD_H 18 | 19 | #include "generic.h" 20 | 21 | /** @name VLAD options 22 | ** @{ */ 23 | #define VL_VLAD_FLAG_NORMALIZE_COMPONENTS (0x1 << 0) 24 | #define VL_VLAD_FLAG_SQUARE_ROOT (0x1 << 1) 25 | #define VL_VLAD_FLAG_UNNORMALIZED (0x1 << 2) 26 | #define VL_VLAD_FLAG_NORMALIZE_MASS (0x1 << 3) 27 | 28 | /** @def VL_VLAD_FLAG_NORMALIZE_COMPONENTS 29 | ** @brief Normalize each VLAD component individually. 30 | **/ 31 | 32 | /** @def VL_VLAD_FLAG_SQUARE_ROOT 33 | ** @brief Use signed squared-root. 34 | **/ 35 | 36 | /** @def VL_VLAD_FLAG_UNNORMALIZED 37 | ** @brief Do not globally normalize the VLAD descriptor. 38 | **/ 39 | 40 | /** @def VL_VLAD_FLAG_NORMALIZE_MASS 41 | ** @brief Normalize each component by the number of features assigned to it. 42 | **/ 43 | /** @} */ 44 | 45 | VL_EXPORT void vl_vlad_encode 46 | (void * enc, vl_type dataType, 47 | void const * means, vl_size dimension, vl_size numClusters, 48 | void const * data, vl_size numData, 49 | void const * assignments, 50 | int flags) ; 51 | 52 | /* VL_VLAD_H */ 53 | #endif 54 | -------------------------------------------------------------------------------- /external/dsp-code/vlfeat-0.9.17/vlfeat.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vlfeat", "vlfeat.vcproj", "{07367665-DCDA-4044-94CE-ABC01CC4119D}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {07367665-DCDA-4044-94CE-ABC01CC4119D}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {07367665-DCDA-4044-94CE-ABC01CC4119D}.Debug|Win32.Build.0 = Debug|Win32 14 | {07367665-DCDA-4044-94CE-ABC01CC4119D}.Release|Win32.ActiveCfg = Release|Win32 15 | {07367665-DCDA-4044-94CE-ABC01CC4119D}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /external/dsp-code/warpImage.m: -------------------------------------------------------------------------------- 1 | % function to warp images with different dimensions 2 | function [warpI2,mask]=warpImage(im,vx,vy) 3 | 4 | [height2,width2,nchannels]=size(im); 5 | [height1,width1]=size(vx); 6 | 7 | [xx,yy]=meshgrid(1:width2,1:height2); 8 | [XX,YY]=meshgrid(1:width1,1:height1); 9 | XX=XX+vx; 10 | YY=YY+vy; 11 | mask=XX<1 | XX>width2 | YY<1 | YY>height2; 12 | XX=min(max(XX,1),width2); 13 | YY=min(max(YY,1),height2); 14 | 15 | for i=1:nchannels 16 | foo=interp2(xx,yy,im(:,:,i),XX,YY,'bicubic'); 17 | foo(mask)=0.6; 18 | warpI2(:,:,i)=foo; 19 | end 20 | 21 | mask=1-mask; -------------------------------------------------------------------------------- /external/pwmetric/dist2.m: -------------------------------------------------------------------------------- 1 | function n2 = dist2(x, c) 2 | %DIST2 Calculates squared distance between two sets of points. 3 | % 4 | % Description 5 | % D = DIST2(X, C) takes two matrices of vectors and calculates the 6 | % squared Euclidean distance between them. Both matrices must be of 7 | % the same column dimension. If X has M rows and N columns, and C has 8 | % L rows and N columns, then the result has M rows and L columns. The 9 | % I, Jth entry is the squared distance from the Ith row of X to the 10 | % Jth row of C. 11 | % 12 | % See also 13 | % GMMACTIV, KMEANS, RBFFWD 14 | % 15 | 16 | % Copyright (c) Ian T Nabney (1996-2001) 17 | 18 | [ndata, dimx] = size(x); 19 | [ncentres, dimc] = size(c); 20 | if dimx ~= dimc 21 | error('Data dimension does not match dimension of centres') 22 | end 23 | 24 | n2 = (ones(ncentres, 1) * sum((x.^2)', 1))' + ... 25 | ones(ndata, 1) * sum((c.^2)',1) - ... 26 | 2.*(x*(c')); 27 | % n2 = n2.^.5; 28 | 29 | % Rounding errors occasionally cause negative entries in n2 30 | if any(any(n2<0)) 31 | n2(n2<0) = 0; 32 | end -------------------------------------------------------------------------------- /external/pwmetric/normalizedKernel.m: -------------------------------------------------------------------------------- 1 | function K = normalizedKernel(K,options) 2 | 3 | if options == 1 4 | for i=1:size(K,1) 5 | for j=1:size(K,2) 6 | if i ~= j 7 | K(i,j) = K(i,j)/min(K(i,i),K(j,j)); 8 | end 9 | end 10 | end 11 | for i=1:size(K,1) 12 | K(i,i) = 1; 13 | end 14 | 15 | elseif options == 2 16 | DD = diag(K); 17 | for i=1:size(K,1) 18 | K(i,:) = K(i,:)/sqrt(DD(i)); 19 | K(:,i) = K(:,i)/sqrt(DD(i)); 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /external/pwmetric/pwhamming_cimp.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/pwmetric/pwhamming_cimp.mexa64 -------------------------------------------------------------------------------- /external/pwmetric/pwhamming_cimp.mexglx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/pwmetric/pwhamming_cimp.mexglx -------------------------------------------------------------------------------- /external/pwmetric/pwhamming_cimp.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/pwmetric/pwhamming_cimp.mexmaci64 -------------------------------------------------------------------------------- /external/pwmetric/pwhamming_cimp.mexw32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/pwmetric/pwhamming_cimp.mexw32 -------------------------------------------------------------------------------- /external/pwmetric/pwhamming_cimp.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/pwmetric/pwhamming_cimp.mexw64 -------------------------------------------------------------------------------- /external/pwmetric/pwmetrics_cimp.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/pwmetric/pwmetrics_cimp.mexa64 -------------------------------------------------------------------------------- /external/pwmetric/pwmetrics_cimp.mexglx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/pwmetric/pwmetrics_cimp.mexglx -------------------------------------------------------------------------------- /external/pwmetric/pwmetrics_cimp.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/pwmetric/pwmetrics_cimp.mexmaci64 -------------------------------------------------------------------------------- /external/pwmetric/pwmetrics_cimp.mexw32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/pwmetric/pwmetrics_cimp.mexw32 -------------------------------------------------------------------------------- /external/pwmetric/pwmetrics_cimp.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/external/pwmetric/pwmetrics_cimp.mexw64 -------------------------------------------------------------------------------- /external/pwmetric/slmetric_pw_compile.m: -------------------------------------------------------------------------------- 1 | function slmetric_pw_compile() 2 | %SLMETRIC_PW_COMPILE Compiles the CPP mex files for slmetric_pw 3 | % 4 | % [ History ] 5 | % - Created by Dahua Lin, on Aug 16, 2007 6 | % 7 | 8 | mdir = fileparts(mfilename('fullpath')); 9 | if ~strcmp(pwd(), mdir) 10 | cd(mdir); 11 | end 12 | 13 | disp('compile pwhamming_cimp.cpp'); 14 | mex -O pwhamming_cimp.cpp 15 | 16 | disp('compile pwmetrics_cimp.cpp'); 17 | mex -O pwmetrics_cimp.cpp 18 | 19 | disp('compilation completed.'); -------------------------------------------------------------------------------- /initflows.m: -------------------------------------------------------------------------------- 1 | function [pairvx, pairvy] = initflows(ims, initDir) 2 | 3 | fprintf('Initializing pairwise flows...\n'); 4 | N = length(ims); 5 | 6 | if exist([initDir, 'pairflows.mat'], 'file') 7 | load([initDir, 'pairflows.mat']); 8 | else 9 | % By default use DSP to initialize pairwise flows 10 | addpath('external/dsp-code/'); 11 | vlfeat_root = 'external/dsp-code/vlfeat-0.9.17/'; 12 | try 13 | vl_root(); 14 | catch 15 | run([vlfeat_root, 'toolbox/vl_setup']); 16 | end 17 | if ~exist(initDir, 'dir') 18 | mkdir(initDir); 19 | end 20 | pairvx = cell(N,N); 21 | pairvy = cell(N,N); 22 | feats = cell(1, N); 23 | for i = 1 : N 24 | feats{i} = ExtractSIFT_WithPadding(ims{i}, [], 4); 25 | end 26 | for i = 1 : N 27 | if i > 1 28 | fprintf('%.3d/%.3d', i, N); 29 | end 30 | parfor j = 1 : N 31 | if i == j 32 | continue; 33 | end 34 | [pairvx{i,j}, pairvy{i,j}] = DSPMatch(feats{i}, feats{j}); 35 | pairvx{i,j} = single(pairvx{i,j}); 36 | pairvy{i,j} = single(pairvy{i,j}); 37 | end 38 | if i > 1 39 | % FIXME: get number of backspace needed automatically 40 | fprintf(repmat('\b',1,7)); 41 | end 42 | end 43 | save([initDir, 'pairflows.mat'], 'pairvx', 'pairvy'); 44 | end -------------------------------------------------------------------------------- /objective.m: -------------------------------------------------------------------------------- 1 | function obj = objective(cycleSet, thisvx, thisvy, initvx, initvy, height, width, lambda) 2 | 3 | N = sqrt(size(thisvx, 2)); 4 | M = size(thisvx,1); 5 | AFCC = sum(sum(single(sum(cycleSet, 3))/(N-2)))/(N*(N-1)*M); 6 | R = sum(fdist(thisvx(:), thisvy(:), initvx(:), initvy(:), height, width))/(N*(N-1)*M); 7 | obj = AFCC - lambda * R; -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/001.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/001.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/001.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/002.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/002.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/002.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/003.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/003.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/003.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/003.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/004.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/004.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/004.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/004.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/005.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/005.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/005.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/005.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/006.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/006.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/006.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/006.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/007.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/007.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/007.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/007.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/008.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/008.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/008.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/008.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/009.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/009.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/009.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/009.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/010.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/010.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/010.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/010.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/011.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/011.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/011.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/011.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/012.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/012.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/012.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/012.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/013.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/013.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/013.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/013.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/014.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/014.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/014.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/014.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/015.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/015.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/015.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/015.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/016.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/016.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/016.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/016.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/017.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/017.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/017.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/017.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/018.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/018.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/018.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/018.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/019.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/019.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/019.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/019.mat -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/020.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/020.jpg -------------------------------------------------------------------------------- /pascal_toy/data/car_set_1/020.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinghuiz/flowweb/8cb93230a759686964aa7a40a4fb40e507191c02/pascal_toy/data/car_set_1/020.mat -------------------------------------------------------------------------------- /prune2cycle.m: -------------------------------------------------------------------------------- 1 | function pmask = prune2cycle(pairvx, pairvy, gx, gy, epsilon) 2 | % 2-cycle check for the input FlowWeb 3 | 4 | N = sqrt(size(pairvx, 2)); 5 | pmask = false(size(pairvx)); 6 | for src = 1 : N 7 | for tgt = 1 : N 8 | if src == tgt 9 | continue; 10 | end 11 | s2t = src + (tgt - 1) * N; 12 | t2s = tgt + (src - 1) * N; 13 | pmask(:, s2t) = pruneOnePair(pairvx(:,s2t), pairvy(:,s2t), ... 14 | pairvx(:,t2s), pairvy(:,t2s), gx, gy, epsilon); 15 | end 16 | end 17 | 18 | function pmask = pruneOnePair(vx1, vy1, vx2, vy2, gx, gy, epsilon) 19 | 20 | [H, W] = size(gx); 21 | pmask = false(H*W, 1); 22 | px12 = round(gx(:) + vx1(:)); 23 | py12 = round(gy(:) + vy1(:)); 24 | invalid = px12 > W | px12 < 1 | py12 > H | py12 < 1; 25 | px12(invalid) = 1; 26 | py12(invalid) = 1; 27 | idx = py12(:) + (px12(:) - 1) * H; 28 | px121 = px12(:) + vx2(idx); 29 | py121 = py12(:) + vy2(idx); 30 | % FIXME: actual euc distance? 31 | xdiff = abs(px121 - gx(:)); 32 | ydiff = abs(py121 - gy(:)); 33 | pmask(invalid | xdiff > epsilon | ydiff > epsilon) = true; 34 | -------------------------------------------------------------------------------- /util/fdist.m: -------------------------------------------------------------------------------- 1 | function D = fdist(vx1, vy1, vx2, vy2, height, width) 2 | % Per-flow distance between two flow fields 3 | vx1 = double(vx1)/width; 4 | vy1 = double(vy1)/height; 5 | vx2 = double(vx2)/width; 6 | vy2 = double(vy2)/height; 7 | f1 = [vx1(:), vy1(:)]; 8 | f2 = [vx2(:), vy2(:)]; 9 | D = sum((f1 - f2).^2, 2); 10 | D = reshape(D, size(vx1)); 11 | -------------------------------------------------------------------------------- /util/flowCellToMat.m: -------------------------------------------------------------------------------- 1 | function [mvx, mvy] = flowCellToMat(cvx, cvy) 2 | % Convert the FlowWeb from cells to a matrix such that cvx{i,j}(:) is 3 | % stored in mvx(:, i+(j-1)*N) 4 | 5 | N = size(cvx,1); 6 | M = numel(cvx{1,2}); 7 | mvx = single(zeros(M, N^2)); 8 | mvy = single(zeros(M, N^2)); 9 | for src = 1 : N 10 | for tgt = 1 : N 11 | if src == tgt 12 | continue; 13 | end 14 | s2t = src + (tgt - 1) * N; 15 | mvx(:, s2t) = single(cvx{src, tgt}(:)); 16 | mvy(:, s2t) = single(cvy{src, tgt}(:)); 17 | end 18 | end -------------------------------------------------------------------------------- /util/flowMatToCell.m: -------------------------------------------------------------------------------- 1 | function [cvx, cvy] = flowMatToCell(mvx, mvy, imgHeight) 2 | % Convert the FlowWeb from a matrix to cells such that mvx(:, i+(j-1)*N) 3 | % is stored in cvx{i,j}(:) 4 | 5 | N = sqrt(size(mvx, 2)); 6 | cvx = cell(N, N); 7 | cvy = cell(N, N); 8 | for src = 1 : N 9 | for tgt = 1 : N 10 | if src == tgt 11 | continue; 12 | end 13 | s2t = src + (tgt - 1) * N; 14 | cvx{src,tgt} = reshape(mvx(:, s2t), imgHeight, []); 15 | cvy{src,tgt} = reshape(mvy(:, s2t), imgHeight, []); 16 | end 17 | end -------------------------------------------------------------------------------- /util/imgWarp.m: -------------------------------------------------------------------------------- 1 | function [warpI2,mask]=imgWarp(im,vx,vy) 2 | % Based on the warpImage function provided in the DSP code. The only 3 | % difference is in default masked values (0.6 vs. NaN). 4 | 5 | [height2,width2,nchannels]=size(im); 6 | [height1,width1]=size(vx); 7 | 8 | [xx,yy]=meshgrid(1:width2,1:height2); 9 | [XX,YY]=meshgrid(1:width1,1:height1); 10 | XX=XX+vx; 11 | YY=YY+vy; 12 | mask=XX<1 | XX>width2 | YY<1 | YY>height2; 13 | XX=min(max(XX,1),width2); 14 | YY=min(max(YY,1),height2); 15 | 16 | for i=1:nchannels 17 | foo=interp2(xx,yy,im(:,:,i),XX,YY,'bicubic'); 18 | foo(mask)=NaN; 19 | warpI2(:,:,i)=foo; 20 | end 21 | 22 | mask=1-mask; -------------------------------------------------------------------------------- /util/loadImageSet.m: -------------------------------------------------------------------------------- 1 | function ims = loadImageSet(imdir) 2 | 3 | imfiles = dir([imdir, '*.jpg']); 4 | N = length(imfiles); 5 | 6 | ims = cell(1, N); 7 | for i = 1 : N 8 | ims{i} = im2double(imread([imdir, imfiles(i).name])); 9 | if size(ims{i},3) == 1 10 | ims{i} = repmat(ims{i}, [1 1 3]); 11 | end 12 | end 13 | 14 | --------------------------------------------------------------------------------