├── .gitignore ├── LICENSE.TXT ├── Readme.md ├── basics ├── Readme.md ├── argparse.h ├── basics.h ├── common.h ├── gfx │ ├── camera.h │ ├── gpu_assets.h │ ├── image.h │ └── shader.h ├── linalg │ ├── debug.h │ ├── geometry.h │ ├── matrix.h │ ├── quaternion.h │ └── vector.h ├── roboto_regular.h ├── third_party │ ├── imgui │ │ ├── LICENSE │ │ ├── imconfig.h │ │ ├── imgui.cpp │ │ ├── imgui.h │ │ ├── imgui_demo.cpp │ │ ├── imgui_draw.cpp │ │ ├── imgui_internal.h │ │ ├── makefile │ │ ├── stb_rect_pack.h │ │ ├── stb_textedit.h │ │ └── stb_truetype.h │ ├── lodepng.h │ ├── lodepng.inl │ ├── stb_image.h │ ├── stb_image_resize.h │ ├── stb_image_write.h │ ├── tiny_dir.h │ ├── tiny_jpeg.h │ └── tinytime.h ├── ubuntu_mono.h └── window │ ├── ui.h │ ├── win.h │ └── window.h ├── build.sh ├── fetbenchmark ├── Readme.md ├── fetbenchmark.cpp ├── io.h └── makefile ├── fetregister ├── Readme.md ├── common.h ├── fetregister.cpp ├── gui.h ├── io.h ├── makefile ├── optimization.h ├── rendering.h ├── stats.h └── structure.h ├── gaps ├── .gitignore ├── LICENSE.txt ├── Makefile ├── README.txt ├── apps │ ├── Makefile │ └── conf2fet │ │ ├── Makefile │ │ ├── Readme.md │ │ ├── conf2fet.cpp │ │ ├── foo.cpp │ │ ├── normal.cpp │ │ └── segmentation.cpp ├── docs │ ├── Makefile │ ├── headers │ │ ├── R2Shapes.header │ │ ├── R3Graphics.header │ │ ├── R3Shapes.header │ │ └── RNBasics.header │ ├── index.html │ ├── makeall │ ├── makepkg │ └── makepkg.awk ├── makefiles │ ├── Makefile.apps │ ├── Makefile.pkgs │ └── Makefile.std ├── pkgs │ ├── CSparse │ │ ├── CSparse.h │ │ ├── CSparse │ │ │ ├── Makefile │ │ │ ├── README.txt │ │ │ ├── cs.h │ │ │ ├── cs_add.c │ │ │ ├── cs_amd.c │ │ │ ├── cs_chol.c │ │ │ ├── cs_cholsol.c │ │ │ ├── cs_compress.c │ │ │ ├── cs_counts.c │ │ │ ├── cs_cumsum.c │ │ │ ├── cs_dfs.c │ │ │ ├── cs_dmperm.c │ │ │ ├── cs_droptol.c │ │ │ ├── cs_dropzeros.c │ │ │ ├── cs_dupl.c │ │ │ ├── cs_entry.c │ │ │ ├── cs_ereach.c │ │ │ ├── cs_etree.c │ │ │ ├── cs_fkeep.c │ │ │ ├── cs_gaxpy.c │ │ │ ├── cs_happly.c │ │ │ ├── cs_house.c │ │ │ ├── cs_ipvec.c │ │ │ ├── cs_leaf.c │ │ │ ├── cs_load.c │ │ │ ├── cs_lsolve.c │ │ │ ├── cs_ltsolve.c │ │ │ ├── cs_lu.c │ │ │ ├── cs_lusol.c │ │ │ ├── cs_malloc.c │ │ │ ├── cs_maxtrans.c │ │ │ ├── cs_multiply.c │ │ │ ├── cs_norm.c │ │ │ ├── cs_permute.c │ │ │ ├── cs_pinv.c │ │ │ ├── cs_post.c │ │ │ ├── cs_print.c │ │ │ ├── cs_pvec.c │ │ │ ├── cs_qr.c │ │ │ ├── cs_qrsol.c │ │ │ ├── cs_randperm.c │ │ │ ├── cs_reach.c │ │ │ ├── cs_scatter.c │ │ │ ├── cs_scc.c │ │ │ ├── cs_schol.c │ │ │ ├── cs_spsolve.c │ │ │ ├── cs_sqr.c │ │ │ ├── cs_symperm.c │ │ │ ├── cs_tdfs.c │ │ │ ├── cs_transpose.c │ │ │ ├── cs_updown.c │ │ │ ├── cs_usolve.c │ │ │ ├── cs_util.c │ │ │ ├── cs_utsolve.c │ │ │ └── foo │ │ ├── Makefile │ │ ├── README.txt │ │ ├── cs.h │ │ ├── cs_add.c │ │ ├── cs_amd.c │ │ ├── cs_chol.c │ │ ├── cs_cholsol.c │ │ ├── cs_compress.c │ │ ├── cs_counts.c │ │ ├── cs_cumsum.c │ │ ├── cs_dfs.c │ │ ├── cs_dmperm.c │ │ ├── cs_droptol.c │ │ ├── cs_dropzeros.c │ │ ├── cs_dupl.c │ │ ├── cs_entry.c │ │ ├── cs_ereach.c │ │ ├── cs_etree.c │ │ ├── cs_fkeep.c │ │ ├── cs_gaxpy.c │ │ ├── cs_happly.c │ │ ├── cs_house.c │ │ ├── cs_ipvec.c │ │ ├── cs_leaf.c │ │ ├── cs_load.c │ │ ├── cs_lsolve.c │ │ ├── cs_ltsolve.c │ │ ├── cs_lu.c │ │ ├── cs_lusol.c │ │ ├── cs_malloc.c │ │ ├── cs_maxtrans.c │ │ ├── cs_multiply.c │ │ ├── cs_norm.c │ │ ├── cs_permute.c │ │ ├── cs_pinv.c │ │ ├── cs_post.c │ │ ├── cs_print.c │ │ ├── cs_pvec.c │ │ ├── cs_qr.c │ │ ├── cs_qrsol.c │ │ ├── cs_randperm.c │ │ ├── cs_reach.c │ │ ├── cs_scatter.c │ │ ├── cs_scc.c │ │ ├── cs_schol.c │ │ ├── cs_spsolve.c │ │ ├── cs_sqr.c │ │ ├── cs_symperm.c │ │ ├── cs_tdfs.c │ │ ├── cs_transpose.c │ │ ├── cs_updown.c │ │ ├── cs_usolve.c │ │ ├── cs_util.c │ │ ├── cs_utsolve.c │ │ └── foo │ ├── FET │ │ ├── FET.cpp │ │ ├── FET.h │ │ ├── FETCorrespondence.cpp │ │ ├── FETCorrespondence.h │ │ ├── FETDescriptor.cpp │ │ ├── FETDescriptor.h │ │ ├── FETFeature.cpp │ │ ├── FETFeature.h │ │ ├── FETMatch.cpp │ │ ├── FETMatch.h │ │ ├── FETReconstruction.cpp │ │ ├── FETReconstruction.h │ │ ├── FETShape.cpp │ │ ├── FETShape.h │ │ └── Makefile │ ├── Makefile │ ├── PDB │ │ ├── Makefile │ │ ├── PDB.cpp │ │ ├── PDB.h │ │ ├── PDBAminoAcid.cpp │ │ ├── PDBAminoAcid.h │ │ ├── PDBAtom.cpp │ │ ├── PDBAtom.h │ │ ├── PDBAtomTypes.cpp │ │ ├── PDBAtomTypes.h │ │ ├── PDBBond.cpp │ │ ├── PDBBond.h │ │ ├── PDBChain.cpp │ │ ├── PDBChain.h │ │ ├── PDBDistance.cpp │ │ ├── PDBDistance.h │ │ ├── PDBElement.cpp │ │ ├── PDBElement.h │ │ ├── PDBFile.cpp │ │ ├── PDBFile.h │ │ ├── PDBModel.cpp │ │ ├── PDBModel.h │ │ ├── PDBPick.cpp │ │ ├── PDBResidue.cpp │ │ ├── PDBResidue.h │ │ ├── PDBUtil.cpp │ │ ├── PDBUtil.h │ │ ├── amino_acid_atoms.txt │ │ └── charm22.txt │ ├── R2Shapes │ │ ├── Makefile │ │ ├── R2Affine.cpp │ │ ├── R2Affine.h │ │ ├── R2Align.cpp │ │ ├── R2Align.h │ │ ├── R2Arc.cpp │ │ ├── R2Arc.h │ │ ├── R2Box.cpp │ │ ├── R2Box.h │ │ ├── R2Circle.cpp │ │ ├── R2Circle.h │ │ ├── R2Cont.cpp │ │ ├── R2Cont.h │ │ ├── R2Crdsys.cpp │ │ ├── R2Crdsys.h │ │ ├── R2Curve.cpp │ │ ├── R2Curve.h │ │ ├── R2Diad.cpp │ │ ├── R2Diad.h │ │ ├── R2Dist.cpp │ │ ├── R2Dist.h │ │ ├── R2Draw.cpp │ │ ├── R2Draw.h │ │ ├── R2Grid.cpp │ │ ├── R2Grid.h │ │ ├── R2Halfspace.cpp │ │ ├── R2Halfspace.h │ │ ├── R2Image.cpp │ │ ├── R2Image.h │ │ ├── R2Io.cpp │ │ ├── R2Io.h │ │ ├── R2Isect.cpp │ │ ├── R2Isect.h │ │ ├── R2Kdtree.cpp │ │ ├── R2Kdtree.h │ │ ├── R2Line.cpp │ │ ├── R2Line.h │ │ ├── R2Parall.cpp │ │ ├── R2Parall.h │ │ ├── R2Perp.cpp │ │ ├── R2Perp.h │ │ ├── R2Point.cpp │ │ ├── R2Point.h │ │ ├── R2Polygon.cpp │ │ ├── R2Polygon.h │ │ ├── R2Polyline.cpp │ │ ├── R2Polyline.h │ │ ├── R2Ray.cpp │ │ ├── R2Ray.h │ │ ├── R2Relate.cpp │ │ ├── R2Relate.h │ │ ├── R2Shape.cpp │ │ ├── R2Shape.h │ │ ├── R2Shapes.cpp │ │ ├── R2Shapes.h │ │ ├── R2Shapes.vcxproj │ │ ├── R2Shapes.vcxproj.filters │ │ ├── R2Solid.cpp │ │ ├── R2Solid.h │ │ ├── R2Span.cpp │ │ ├── R2Span.h │ │ ├── R2Vector.cpp │ │ ├── R2Vector.h │ │ ├── R2Xform.cpp │ │ ├── R2Xform.h │ │ ├── R3Matrix.cpp │ │ └── R3Matrix.h │ ├── R3Graphics │ │ ├── Makefile │ │ ├── R2Texture.cpp │ │ ├── R2Texture.h │ │ ├── R2Viewport.cpp │ │ ├── R2Viewport.h │ │ ├── R3AreaLight.cpp │ │ ├── R3AreaLight.h │ │ ├── R3Brdf.cpp │ │ ├── R3Brdf.h │ │ ├── R3Camera.cpp │ │ ├── R3Camera.h │ │ ├── R3DirectionalLight.cpp │ │ ├── R3DirectionalLight.h │ │ ├── R3Frustum.cpp │ │ ├── R3Frustum.h │ │ ├── R3Graphics.cpp │ │ ├── R3Graphics.h │ │ ├── R3Graphics.vcxproj │ │ ├── R3Graphics.vcxproj.filters │ │ ├── R3Light.cpp │ │ ├── R3Light.h │ │ ├── R3Material.cpp │ │ ├── R3Material.h │ │ ├── R3PointLight.cpp │ │ ├── R3PointLight.h │ │ ├── R3Scene.cpp │ │ ├── R3Scene.h │ │ ├── R3SceneElement.cpp │ │ ├── R3SceneElement.h │ │ ├── R3SceneNode.cpp │ │ ├── R3SceneNode.h │ │ ├── R3SceneReference.cpp │ │ ├── R3SceneReference.h │ │ ├── R3SpotLight.cpp │ │ ├── R3SpotLight.h │ │ ├── R3Viewer.cpp │ │ └── R3Viewer.h │ ├── R3Shapes │ │ ├── Makefile │ │ ├── R3Affine.cpp │ │ ├── R3Affine.h │ │ ├── R3Align.cpp │ │ ├── R3Align.h │ │ ├── R3Base.cpp │ │ ├── R3Base.h │ │ ├── R3Box.cpp │ │ ├── R3Box.h │ │ ├── R3CatmullRomSpline.cpp │ │ ├── R3CatmullRomSpline.h │ │ ├── R3Circle.cpp │ │ ├── R3Circle.h │ │ ├── R3Cone.cpp │ │ ├── R3Cone.h │ │ ├── R3Cont.cpp │ │ ├── R3Cont.h │ │ ├── R3Crdsys.cpp │ │ ├── R3Crdsys.h │ │ ├── R3Curve.cpp │ │ ├── R3Curve.h │ │ ├── R3Cylinder.cpp │ │ ├── R3Cylinder.h │ │ ├── R3Dist.cpp │ │ ├── R3Dist.h │ │ ├── R3Draw.cpp │ │ ├── R3Draw.h │ │ ├── R3Ellipse.cpp │ │ ├── R3Ellipse.h │ │ ├── R3Ellipsoid.cpp │ │ ├── R3Ellipsoid.h │ │ ├── R3Grid.cpp │ │ ├── R3Grid.h │ │ ├── R3Halfspace.cpp │ │ ├── R3Halfspace.h │ │ ├── R3Isect.cpp │ │ ├── R3Isect.h │ │ ├── R3Kdtree.cpp │ │ ├── R3Kdtree.h │ │ ├── R3Line.cpp │ │ ├── R3Line.h │ │ ├── R3Mesh.cpp │ │ ├── R3Mesh.h │ │ ├── R3MeshProperty.cpp │ │ ├── R3MeshProperty.h │ │ ├── R3MeshPropertySet.cpp │ │ ├── R3MeshPropertySet.h │ │ ├── R3MeshSearchTree.cpp │ │ ├── R3MeshSearchTree.h │ │ ├── R3OrientedBox.cpp │ │ ├── R3OrientedBox.h │ │ ├── R3Parall.cpp │ │ ├── R3Parall.h │ │ ├── R3Perp.cpp │ │ ├── R3Perp.h │ │ ├── R3PlanarGrid.cpp │ │ ├── R3PlanarGrid.h │ │ ├── R3Plane.cpp │ │ ├── R3Plane.h │ │ ├── R3Point.cpp │ │ ├── R3Point.h │ │ ├── R3Polyline.cpp │ │ ├── R3Polyline.h │ │ ├── R3Quaternion.cpp │ │ ├── R3Quaternion.h │ │ ├── R3Ray.cpp │ │ ├── R3Ray.h │ │ ├── R3Rectangle.cpp │ │ ├── R3Rectangle.h │ │ ├── R3Relate.cpp │ │ ├── R3Relate.h │ │ ├── R3Shape.cpp │ │ ├── R3Shape.h │ │ ├── R3Shapes.cpp │ │ ├── R3Shapes.h │ │ ├── R3Shapes.vcxproj │ │ ├── R3Shapes.vcxproj.filters │ │ ├── R3Solid.cpp │ │ ├── R3Solid.h │ │ ├── R3Span.cpp │ │ ├── R3Span.h │ │ ├── R3Sphere.cpp │ │ ├── R3Sphere.h │ │ ├── R3Surface.cpp │ │ ├── R3Surface.h │ │ ├── R3Triad.cpp │ │ ├── R3Triad.h │ │ ├── R3Triangle.cpp │ │ ├── R3Triangle.h │ │ ├── R3TriangleArray.cpp │ │ ├── R3TriangleArray.h │ │ ├── R3Vector.cpp │ │ ├── R3Vector.h │ │ ├── R3Xform.cpp │ │ ├── R3Xform.h │ │ ├── R4Matrix.cpp │ │ ├── R4Matrix.h │ │ ├── ply.cpp │ │ └── ply.h │ ├── R3Surfels │ │ ├── Makefile │ │ ├── R3Surfel.cpp │ │ ├── R3Surfel.h │ │ ├── R3SurfelBlock.cpp │ │ ├── R3SurfelBlock.h │ │ ├── R3SurfelConstraint.cpp │ │ ├── R3SurfelConstraint.h │ │ ├── R3SurfelDatabase.cpp │ │ ├── R3SurfelDatabase.h │ │ ├── R3SurfelFeature.cpp │ │ ├── R3SurfelFeature.h │ │ ├── R3SurfelFeatureEvaluation.cpp │ │ ├── R3SurfelFeatureEvaluation.h │ │ ├── R3SurfelFeatureSet.cpp │ │ ├── R3SurfelFeatureSet.h │ │ ├── R3SurfelFeatureVector.cpp │ │ ├── R3SurfelFeatureVector.h │ │ ├── R3SurfelLabel.cpp │ │ ├── R3SurfelLabel.h │ │ ├── R3SurfelLabelAssignment.cpp │ │ ├── R3SurfelLabelAssignment.h │ │ ├── R3SurfelLabelProperty.cpp │ │ ├── R3SurfelLabelProperty.h │ │ ├── R3SurfelLabelRelationship.cpp │ │ ├── R3SurfelLabelRelationship.h │ │ ├── R3SurfelLabelSet.cpp │ │ ├── R3SurfelLabelSet.h │ │ ├── R3SurfelNode.cpp │ │ ├── R3SurfelNode.h │ │ ├── R3SurfelNodeSet.cpp │ │ ├── R3SurfelNodeSet.h │ │ ├── R3SurfelObject.cpp │ │ ├── R3SurfelObject.h │ │ ├── R3SurfelObjectProperty.cpp │ │ ├── R3SurfelObjectProperty.h │ │ ├── R3SurfelObjectRelationship.cpp │ │ ├── R3SurfelObjectRelationship.h │ │ ├── R3SurfelObjectSet.cpp │ │ ├── R3SurfelObjectSet.h │ │ ├── R3SurfelPoint.cpp │ │ ├── R3SurfelPoint.h │ │ ├── R3SurfelPointGraph.cpp │ │ ├── R3SurfelPointGraph.h │ │ ├── R3SurfelPointSet.cpp │ │ ├── R3SurfelPointSet.h │ │ ├── R3SurfelScan.cpp │ │ ├── R3SurfelScan.h │ │ ├── R3SurfelScene.cpp │ │ ├── R3SurfelScene.h │ │ ├── R3SurfelTree.cpp │ │ ├── R3SurfelTree.h │ │ ├── R3SurfelUtils.cpp │ │ ├── R3SurfelUtils.h │ │ ├── R3Surfels.cpp │ │ └── R3Surfels.h │ ├── RGBD │ │ ├── Makefile │ │ ├── RGBD.cpp │ │ ├── RGBD.h │ │ ├── RGBDCamera.cpp │ │ ├── RGBDCamera.h │ │ ├── RGBDConfiguration.cpp │ │ ├── RGBDConfiguration.h │ │ ├── RGBDImage.cpp │ │ ├── RGBDImage.h │ │ ├── RGBDSegmentation.cpp │ │ ├── RGBDSegmentation.h │ │ ├── RGBDSurface.cpp │ │ ├── RGBDSurface.h │ │ ├── RGBDTransform.cpp │ │ ├── RGBDTransform.h │ │ ├── RGBDUtil.cpp │ │ └── RGBDUtil.h │ ├── RNBasics │ │ ├── Makefile │ │ ├── RNArray.I │ │ ├── RNArray.cpp │ │ ├── RNArray.h │ │ ├── RNBase.cpp │ │ ├── RNBase.h │ │ ├── RNBasics.cpp │ │ ├── RNBasics.h │ │ ├── RNBasics.vcxproj │ │ ├── RNBasics.vcxproj.filters │ │ ├── RNCompat.h │ │ ├── RNError.cpp │ │ ├── RNError.h │ │ ├── RNExtern.h │ │ ├── RNFile.cpp │ │ ├── RNFile.h │ │ ├── RNFlags.cpp │ │ ├── RNFlags.h │ │ ├── RNGrfx.I │ │ ├── RNGrfx.cpp │ │ ├── RNGrfx.h │ │ ├── RNHeap.cpp │ │ ├── RNHeap.h │ │ ├── RNIntval.cpp │ │ ├── RNIntval.h │ │ ├── RNMap.cpp │ │ ├── RNMap.h │ │ ├── RNMem.cpp │ │ ├── RNMem.h │ │ ├── RNQueue.I │ │ ├── RNQueue.cpp │ │ ├── RNQueue.h │ │ ├── RNRgb.cpp │ │ ├── RNRgb.h │ │ ├── RNScalar.cpp │ │ ├── RNScalar.h │ │ ├── RNSvd.cpp │ │ ├── RNSvd.h │ │ ├── RNTime.cpp │ │ ├── RNTime.h │ │ ├── RNType.cpp │ │ ├── RNType.h │ │ ├── json.cpp │ │ └── json.h │ ├── RNMath │ │ ├── Makefile │ │ ├── RNAlgebraic.cpp │ │ ├── RNAlgebraic.h │ │ ├── RNDenseLUMatrix.cpp │ │ ├── RNDenseLUMatrix.h │ │ ├── RNDenseMatrix.cpp │ │ ├── RNDenseMatrix.h │ │ ├── RNEquation.cpp │ │ ├── RNEquation.h │ │ ├── RNLapack.h │ │ ├── RNMath.cpp │ │ ├── RNMath.h │ │ ├── RNMatrix.cpp │ │ ├── RNMatrix.h │ │ ├── RNPolynomial.cpp │ │ ├── RNPolynomial.h │ │ ├── RNSystemOfEquations.cpp │ │ ├── RNSystemOfEquations.h │ │ ├── RNVector.cpp │ │ └── RNVector.h │ ├── fglut │ │ ├── AUTHORS │ │ ├── Makefile │ │ ├── README │ │ ├── cygwin_config.h │ │ ├── fglut.c │ │ ├── fglut.h │ │ ├── fglut.sln │ │ ├── fglut.vcxproj │ │ ├── fglut.vcxproj.filters │ │ ├── freeglut.h │ │ ├── freeglut_callbacks.c │ │ ├── freeglut_cursor.c │ │ ├── freeglut_display.c │ │ ├── freeglut_ext.c │ │ ├── freeglut_ext.h │ │ ├── freeglut_font.c │ │ ├── freeglut_font_data.c │ │ ├── freeglut_gamemode.c │ │ ├── freeglut_geometry.c │ │ ├── freeglut_glutfont_definitions.c │ │ ├── freeglut_init.c │ │ ├── freeglut_input_devices.c │ │ ├── freeglut_internal.h │ │ ├── freeglut_joystick.c │ │ ├── freeglut_main.c │ │ ├── freeglut_menu.c │ │ ├── freeglut_misc.c │ │ ├── freeglut_overlay.c │ │ ├── freeglut_spaceball.c │ │ ├── freeglut_state.c │ │ ├── freeglut_std.h │ │ ├── freeglut_stroke_mono_roman.c │ │ ├── freeglut_stroke_roman.c │ │ ├── freeglut_structure.c │ │ ├── freeglut_teapot.c │ │ ├── freeglut_teapot_data.h │ │ ├── freeglut_videoresize.c │ │ ├── freeglut_window.c │ │ ├── glut.h │ │ ├── linux_config.h │ │ └── mac_config.h │ ├── gaps.h │ ├── jpeg │ │ ├── Makefile │ │ ├── README │ │ ├── jcapimin.c │ │ ├── jcapistd.c │ │ ├── jccoefct.c │ │ ├── jccolor.c │ │ ├── jcdctmgr.c │ │ ├── jchuff.c │ │ ├── jchuff.h │ │ ├── jcinit.c │ │ ├── jcmainct.c │ │ ├── jcmarker.c │ │ ├── jcmaster.c │ │ ├── jcomapi.c │ │ ├── jconfig.h │ │ ├── jcparam.c │ │ ├── jcphuff.c │ │ ├── jcprepct.c │ │ ├── jcsample.c │ │ ├── jctrans.c │ │ ├── jdapimin.c │ │ ├── jdapistd.c │ │ ├── jdatadst.c │ │ ├── jdatasrc.c │ │ ├── jdcoefct.c │ │ ├── jdcolor.c │ │ ├── jdct.h │ │ ├── jddctmgr.c │ │ ├── jdhuff.c │ │ ├── jdhuff.h │ │ ├── jdinput.c │ │ ├── jdmainct.c │ │ ├── jdmarker.c │ │ ├── jdmaster.c │ │ ├── jdmerge.c │ │ ├── jdphuff.c │ │ ├── jdpostct.c │ │ ├── jdsample.c │ │ ├── jdtrans.c │ │ ├── jerror.c │ │ ├── jerror.h │ │ ├── jfdctflt.c │ │ ├── jfdctfst.c │ │ ├── jfdctint.c │ │ ├── jidctflt.c │ │ ├── jidctfst.c │ │ ├── jidctint.c │ │ ├── jidctred.c │ │ ├── jinclude.h │ │ ├── jmemmgr.c │ │ ├── jmemnobs.c │ │ ├── jmemsys.h │ │ ├── jmorecfg.h │ │ ├── jpeg.vcxproj │ │ ├── jpeg.vcxproj.filters │ │ ├── jpegint.h │ │ ├── jpeglib.h │ │ ├── jquant1.c │ │ ├── jquant2.c │ │ ├── jutils.c │ │ ├── jversion.h │ │ └── libjpeg.doc │ ├── png │ │ ├── Makefile │ │ ├── PNG-LICENSE.txt │ │ ├── PNG-README.txt │ │ ├── ZLIB_README.txt │ │ ├── adler32.c │ │ ├── compress.c │ │ ├── config.h │ │ ├── crc32.c │ │ ├── crc32.h │ │ ├── deflate.c │ │ ├── deflate.h │ │ ├── example.c │ │ ├── gzclose.c │ │ ├── gzguts.h │ │ ├── gzlib.c │ │ ├── gzread.c │ │ ├── gzwrite.c │ │ ├── infback.c │ │ ├── inffast.c │ │ ├── inffast.h │ │ ├── inffixed.h │ │ ├── inflate.c │ │ ├── inflate.h │ │ ├── inftrees.c │ │ ├── inftrees.h │ │ ├── minigzip.c │ │ ├── png.c │ │ ├── png.h │ │ ├── png.vcxproj │ │ ├── png.vcxproj.filters │ │ ├── pngconf.h │ │ ├── pngerror.c │ │ ├── pngget.c │ │ ├── pngmem.c │ │ ├── pngpread.c │ │ ├── pngpriv.h │ │ ├── pngread.c │ │ ├── pngrio.c │ │ ├── pngrtran.c │ │ ├── pngrutil.c │ │ ├── pngset.c │ │ ├── pngtest.c │ │ ├── pngtrans.c │ │ ├── pngwio.c │ │ ├── pngwrite.c │ │ ├── pngwtran.c │ │ ├── pngwutil.c │ │ ├── trees.c │ │ ├── trees.h │ │ ├── uncompr.c │ │ ├── zconf.h │ │ ├── zlib.h │ │ ├── zutil.c │ │ └── zutil.h │ └── splm │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.txt │ │ ├── compiler.h │ │ ├── splm.c │ │ ├── splm.h │ │ ├── splm_ccsm.c │ │ ├── splm_cholmod.c │ │ ├── splm_crsm.c │ │ ├── splm_csparse.c │ │ ├── splm_dss.c │ │ ├── splm_hessian.c │ │ ├── splm_ldlp.c │ │ ├── splm_ma27.c │ │ ├── splm_ma47.c │ │ ├── splm_ma57.c │ │ ├── splm_ma77.c │ │ ├── splm_misc.c │ │ ├── splm_mumps.c │ │ ├── splm_pardiso.c │ │ ├── splm_priv.h │ │ ├── splm_spooles.c │ │ ├── splm_stm.c │ │ ├── splm_superlu.c │ │ ├── splm_taucs.c │ │ ├── splm_time.c │ │ └── splm_umfpack.c └── vc │ ├── Makefile │ ├── README.txt │ ├── glut │ ├── GL │ │ └── glut.h │ ├── README-win32.txt │ ├── glut.def │ ├── glut32.dll │ └── glut32.lib │ ├── makefiles │ ├── Makefile.apps │ ├── Makefile.pkgs │ └── Makefile.std │ └── vc.sln ├── makefile └── sun3dsfm ├── LICENSE.md ├── README.md ├── align2view.m ├── depth2XYZcamera.m ├── depthConsistencyParallel.m ├── depthRead.m ├── estimateRt.m ├── fitModel3D.m ├── fitRtByICP.m ├── getTimeStamp.m ├── icp.m ├── lib ├── estimateRigidTransform │ ├── crossTimesMatrix.m │ ├── estimateRigidTransform.m │ ├── estimateRigidTransform.zip │ ├── license.txt │ └── quat2rot.m ├── peter │ ├── derivative5.m │ ├── fundmatrix.m │ ├── gaussfilt.m │ ├── harris.m │ ├── hcross.m │ ├── hline.m │ ├── hnormalise.m │ ├── homography2d.m │ ├── iscolinear.m │ ├── matchbycorrelation.m │ ├── matchbymonogenicphase.m │ ├── matrix2quaternion.m │ ├── monofilt.m │ ├── nonmaxsuppts.m │ ├── normalise2dpts.m │ ├── quaternion2matrix.m │ ├── ransac.m │ ├── ransacfitfundmatrix.m │ ├── ransacfithomography.m │ └── show.m └── vlfeat │ ├── .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 ├── loadConf.m ├── matchSIFTdesImagesBidirectional.m ├── nonmaxsup.m ├── outputCameraExtrinsics.m ├── outputConf.m ├── outputPly.m ├── ransacfitRt.m ├── rectifyScene.m ├── save_matches.m ├── sun3Dsfm.m ├── transformCameraRt.m ├── transformPointCloud.m ├── transformRT.m └── writePLYhead.m /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | browse.VC.db-wal 3 | **/browse.VC.db-wal 4 | .vscode 5 | .vscode/** 6 | **/.DS_Store 7 | tests/** 8 | tests/ 9 | **/*.o 10 | **/examples/out/* 11 | **/examples/bin/* 12 | **/examples/*/*.o 13 | *.a 14 | **/*.a 15 | bin/** 16 | bin/ 17 | out/** 18 | out/ -------------------------------------------------------------------------------- /LICENSE.TXT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Maciej Halber 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. -------------------------------------------------------------------------------- /basics/Readme.md: -------------------------------------------------------------------------------- 1 | # basics 2 | 3 | Basics was a project on building a simple visualization toolkit for graphcis and vision. It's development has since been abandoned. -------------------------------------------------------------------------------- /basics/third_party/imgui/makefile: -------------------------------------------------------------------------------- 1 | ifeq ($(UNAME),Darwin) 2 | CC = clang++ 3 | else 4 | CC = g++ 5 | endif 6 | 7 | CPPFLAGS = -O3 -g0 -std=c++11 -Wall -Wno-\#warnings 8 | SRCS = imgui.cpp imgui_draw.cpp imgui_demo.cpp 9 | OBJS = $(SRCS:.cpp=.o) 10 | 11 | dear_imgui: $(OBJS) 12 | 13 | clean: 14 | rm *.o 15 | 16 | # Compile command 17 | %.o: %.cpp 18 | $(CC) $(CPPFLAGS) -c $< -o $@ 19 | -------------------------------------------------------------------------------- /basics/window/window.h: -------------------------------------------------------------------------------- 1 | // window.h 2 | #pragma once 3 | 4 | #include "win.h" 5 | #include "ui.h" 6 | 7 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ ! -d "bin" ]; then 3 | mkdir bin 4 | fi 5 | 6 | if [ ! -d "out" ]; then 7 | mkdir out 8 | fi 9 | 10 | echo "Building gaps!" 11 | make -C gaps 12 | 13 | echo "Building fetregister and fetbenchmark!" 14 | make 15 | -------------------------------------------------------------------------------- /fetbenchmark/Readme.md: -------------------------------------------------------------------------------- 1 | # fetregister 2 | 3 | Fetregister is main application in this code-base, implementing the algorithm described in ["Fine-to-Coarse Global Registration of RGB-D Scans"][1]. 4 | 5 | ## Compiling 6 | It should be possible to compile this code by simply running make in current folder. 7 | 8 | ## Running 9 | To run the code you need the configuration(.conf) file which stores your computed poses. The format of configuration file is described at [our project website](http://scanregistration.cs.princeton.edu). 10 | Simple statistic( RMSE, Mean and Standard Deviation) can be obtained by simply running 11 | ~~~~ 12 | fetbenchmark 13 | ~~~~ 14 | To get more detailed, per correspondence errors, run: 15 | ~~~~ 16 | fetregister -v 17 | ~~~~ 18 | 19 | [1]: http://scanregistration.cs.princeton.edu/assets/HalberF2C_CVPR2017.pdf "Fine-to-Coarse Global Registration of RGB-D Scans" -------------------------------------------------------------------------------- /fetbenchmark/makefile: -------------------------------------------------------------------------------- 1 | #Base Settings 2 | UNAME = $(shell uname -s) 3 | 4 | ifeq ($(UNAME),Darwin) 5 | CC = clang++ 6 | else 7 | CC = g++ 8 | endif 9 | 10 | CPPFLAGS = -O3 -g0 -std=c++11 -Wall -Wno-\#warnings -Wno-sign-compare 11 | 12 | # Executable name 13 | EXE_NAME = fetbenchmark 14 | 15 | # Useful Directories 16 | BIN_DIR = ../bin/ 17 | LIB_DIR = /usr/local/lib/ 18 | OUT_DIR = ../out/ 19 | BSC_DIR = basics/ 20 | 21 | # List of source files 22 | SRCS = fetbenchmark.cpp 23 | OBJS = $(SRCS:%.cpp=$(OUT_DIR)%.o) 24 | 25 | # Compile and link options 26 | CPPFLAGS += -I. -I/usr/local/include -I../$(BSC_DIR) 27 | 28 | # Make targets 29 | all: clean fetbenchmark 30 | 31 | fetbenchmark: $(OBJS) 32 | $(CC) $(FRAMEWORKS) $(CPPFLAGS) $(OBJS) -o ${BIN_DIR}${EXE_NAME} 33 | 34 | clean: 35 | rm -f $(OUT_DIR)*.a $(OUT_DIR)*.o ${BIN_DIR}${EXE_NAME} ${BIN_DIR}${EXE_NAME}.exe 36 | 37 | 38 | # Compile command 39 | $(OUT_DIR)%.o: %.cpp 40 | $(CC) $(CPPFLAGS) -c $< -o $@ 41 | 42 | 43 | # GNU Make: targets that don't build files 44 | .PHONY: all clean 45 | -------------------------------------------------------------------------------- /gaps/.gitignore: -------------------------------------------------------------------------------- 1 | pkgs/*/*.o 2 | apps/*/*.o 3 | lib/*/*.a 4 | bin/*/* 5 | -------------------------------------------------------------------------------- /gaps/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007 Thomas Funkhouser 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /gaps/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for GAPS 3 | # 4 | 5 | 6 | 7 | # 8 | # Make targets 9 | # 10 | 11 | opt: 12 | $(MAKE) target "TARGET=$@" 13 | 14 | debug: 15 | $(MAKE) target "TARGET=$@" 16 | 17 | mesa: 18 | $(MAKE) target "TARGET=$@" 19 | 20 | clean: 21 | $(MAKE) target "TARGET=$@" 22 | 23 | release: pkgs apps docs makefiles vc 24 | mkdir -p release 25 | cp README.txt release 26 | cp LICENSE.txt release 27 | cp Makefile release 28 | cp -r makefiles release 29 | $(MAKE) target "TARGET=$@" 30 | 31 | target: 32 | cd pkgs; $(MAKE) $(TARGET) 33 | cd apps; $(MAKE) $(TARGET) 34 | cd vc; $(MAKE) $(TARGET) 35 | # cd docs; $(MAKE) $(TARGET) 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /gaps/apps/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for GAPS apps 3 | # 4 | 5 | opt: 6 | $(MAKE) target "TARGET=$@" 7 | 8 | debug: 9 | $(MAKE) target "TARGET=$@" 10 | 11 | mesa: 12 | $(MAKE) target "TARGET=$@" 13 | 14 | clean: 15 | $(MAKE) target "TARGET=$@" 16 | 17 | release: 18 | mkdir -p ../release/apps 19 | cp Makefile ../release/apps 20 | $(MAKE) target "TARGET=$@" 21 | 22 | target: 23 | cd conf2fet; $(MAKE) $(TARGET) 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /gaps/apps/conf2fet/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=conf2fet 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | 10 | # 11 | # With Ceres 12 | # 13 | 14 | #USER_CFLAGS=-I/usr/local/suitesparse -I/usr/local/include/eigen3 -DRN_USE_CERES -DRN_USE_SPLM -DRN_USE_CSPARSE 15 | #USER_LIBS=-L/usr/local/lib -lceres -lsplm -lCSparse -lminpack -lccolamd -lcamd -lcolamd -lamd -Wl,-Bdynamic -lcxsparse -lcholmod -lccolamd -lcamd -lcolamd -lamd -lsuitesparseconfig -llapack -lblas -Wl,-Bstatic -lcxsparse -Wl,-Bdynamic -lgomp -lglog -lgflags 16 | 17 | 18 | # 19 | # Without Ceres 20 | # 21 | 22 | USER_CFLAGS=-DRN_USE_SPLM -DRN_USE_CSPARSE 23 | USER_LIBS=-lsplm -lCSparse 24 | 25 | 26 | 27 | # 28 | # Pkg libraries 29 | # 30 | 31 | PKG_LIBS=-lFET -lR3Surfels -lR3Shapes -lR2Shapes -lRNMath -lRNBasics -ljpeg -lpng 32 | 33 | 34 | # 35 | # R3 application makefile 36 | # 37 | 38 | include ../../makefiles/Makefile.apps 39 | 40 | 41 | -------------------------------------------------------------------------------- /gaps/apps/conf2fet/Readme.md: -------------------------------------------------------------------------------- 1 | # conf2fet 2 | 3 | conf2fet utility processes provided configuration file and produces feature(.fcb) files. 4 | 5 | ## Compiling 6 | This utility should be compiled while compiling gaps. To recompile, you should be able to simply run **make** command in this folder. 7 | 8 | ## Running 9 | Once configuration file is generated, you can generate fet file running following command: 10 | ~~~~ 11 | conf2fet 12 | ~~~~ 13 | While conf2file has multiple parameters, two most important ones are -load_every_kth_image and -min_feature_spacing. As described in [our paper][1], for our experiments we used n=5 and m=0.05 for these repesctive arguments. Thus the command in the whole is: 14 | ~~~~ 15 | conf2fet -load_every_kth_image n -min_feature_spacing m -v 16 | ~~~~ 17 | Here we also added -v for more verbose printing. 18 | 19 | [1]: https://arxiv.org/pdf/1607.08539v3.pdf "Fine-to-Coarse Global Registration of RGB-D Scans" -------------------------------------------------------------------------------- /gaps/docs/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for GAPS docs 3 | # 4 | 5 | opt: 6 | ./makeall 7 | 8 | debug: 9 | ./makeall 10 | 11 | release: 12 | mkdir -p ../release/docs 13 | cp Makefile ../release/docs 14 | cp makeall ../release/docs 15 | cp makepkg ../release/docs 16 | cp makepkg.awk ../release/docs 17 | cp -r headers ../release/docs 18 | cp ./*.html ../release/docs 19 | 20 | clean: 21 | - rm -f *~ *.html 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /gaps/docs/makeall: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | for pkg in RNBasics R2Shapes R3Shapes R3Graphics; do 4 | echo $pkg 5 | ./makepkg $pkg 6 | done 7 | 8 | -------------------------------------------------------------------------------- /gaps/docs/makepkg: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | # usage : makepkg name 3 | 4 | # Create header 5 | echo "" > $1.html 6 | echo "" >> $1.html 7 | echo " $1 Package " >> $1.html 8 | echo "" >> $1.html 9 | echo "" >> $1.html 10 | echo "

$1 Package

" >> $1.html 11 | echo >> $1.html 12 | echo >> $1.html 13 | echo >> $1.html 14 | 15 | # Create description 16 | if [ -e headers/$1.header ]; then 17 | # Read description, list of classes, and examples from header 18 | cat headers/$1.header >> $1.html 19 | fi 20 | 21 | # Create class members 22 | awk -f makepkg.awk ../pkgs/$1/*.h >> $1.html 23 | sed -e "s/RNFoobar/$1/g" < $1.html > $1.html.new 24 | mv $1.html.new $1.html 25 | echo >> $1.html 26 | echo >> $1.html 27 | echo >> $1.html 28 | 29 | # Create trailer 30 | echo "
" >> $1.html 31 | echo 'Click this to go back to list of GAPS packages.' >> $1.html 32 | echo "

" >> $1.html 33 | echo "" >> $1.html 34 | echo "

funk@cs.princeton.edu
" >> $1.html 35 | echo >> $1.html 36 | echo "" >> $1.html 37 | echo >> $1.html 38 | echo >> $1.html 39 | echo >> $1.html 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse.h: -------------------------------------------------------------------------------- 1 | #ifndef ___CS_PARSE_INCLUDED__ 2 | #define ___CS_PARSE_INCLUDED__ 3 | 4 | extern "C" { 5 | #include "CSparse/cs.h" 6 | }; 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name and list of source files. 3 | # 4 | 5 | NAME=CSparse 6 | CSRCS= cs_add.c cs_amd.c cs_chol.c cs_cholsol.c cs_counts.c cs_cumsum.c \ 7 | cs_droptol.c cs_dropzeros.c cs_dupl.c cs_entry.c \ 8 | cs_etree.c cs_fkeep.c cs_gaxpy.c cs_happly.c cs_house.c cs_ipvec.c \ 9 | cs_lsolve.c cs_ltsolve.c cs_lu.c cs_lusol.c cs_util.c cs_multiply.c \ 10 | cs_permute.c cs_pinv.c cs_post.c cs_pvec.c cs_qr.c cs_qrsol.c \ 11 | cs_scatter.c cs_schol.c cs_sqr.c cs_symperm.c cs_tdfs.c cs_malloc.c \ 12 | cs_transpose.c cs_compress.c cs_usolve.c cs_utsolve.c cs_scc.c \ 13 | cs_maxtrans.c cs_dmperm.c cs_updown.c cs_print.c cs_norm.c cs_load.c \ 14 | cs_dfs.c cs_reach.c cs_spsolve.c cs_ereach.c cs_leaf.c cs_randperm.c 15 | 16 | 17 | 18 | # 19 | # R3 library makefile 20 | # 21 | 22 | include ../../makefiles/Makefile.pkgs 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/README.txt: -------------------------------------------------------------------------------- 1 | CSparse/Source directory: primary ANSI C source code files for CSparse. 2 | All of these files are printed verbatim in the book. To compile the 3 | libcsparse.a C-callable library, just type "make" in this directory. 4 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_cholsol.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* x=A\b where A is symmetric positive definite; b overwritten with solution */ 3 | int cs_cholsol (int order, const cs *A, double *b) 4 | { 5 | double *x ; 6 | css *S ; 7 | csn *N ; 8 | int n, ok ; 9 | if (!CS_CSC (A) || !b) return (0) ; /* check inputs */ 10 | n = A->n ; 11 | S = cs_schol (order, A) ; /* ordering and symbolic analysis */ 12 | N = cs_chol (A, S) ; /* numeric Cholesky factorization */ 13 | x = cs_malloc (n, sizeof (double)) ; /* get workspace */ 14 | ok = (S && N && x) ; 15 | if (ok) 16 | { 17 | cs_ipvec (S->pinv, b, x, n) ; /* x = P*b */ 18 | cs_lsolve (N->L, x) ; /* x = L\x */ 19 | cs_ltsolve (N->L, x) ; /* x = L'\x */ 20 | cs_pvec (S->pinv, x, b, n) ; /* b = P'*x */ 21 | } 22 | cs_free (x) ; 23 | cs_sfree (S) ; 24 | cs_nfree (N) ; 25 | return (ok) ; 26 | } 27 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_compress.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* C = compressed-column form of a triplet matrix T */ 3 | cs *cs_compress (const cs *T) 4 | { 5 | int m, n, nz, p, k, *Cp, *Ci, *w, *Ti, *Tj ; 6 | double *Cx, *Tx ; 7 | cs *C ; 8 | if (!CS_TRIPLET (T)) return (NULL) ; /* check inputs */ 9 | m = T->m ; n = T->n ; Ti = T->i ; Tj = T->p ; Tx = T->x ; nz = T->nz ; 10 | C = cs_spalloc (m, n, nz, Tx != NULL, 0) ; /* allocate result */ 11 | w = cs_calloc (n, sizeof (int)) ; /* get workspace */ 12 | if (!C || !w) return (cs_done (C, w, NULL, 0)) ; /* out of memory */ 13 | Cp = C->p ; Ci = C->i ; Cx = C->x ; 14 | for (k = 0 ; k < nz ; k++) w [Tj [k]]++ ; /* column counts */ 15 | cs_cumsum (Cp, w, n) ; /* column pointers */ 16 | for (k = 0 ; k < nz ; k++) 17 | { 18 | Ci [p = w [Tj [k]]++] = Ti [k] ; /* A(i,j) is the pth entry in C */ 19 | if (Cx) Cx [p] = Tx [k] ; 20 | } 21 | return (cs_done (C, w, NULL, 1)) ; /* success; free w and return C */ 22 | } 23 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_cumsum.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* p [0..n] = cumulative sum of c [0..n-1], and then copy p [0..n-1] into c */ 3 | double cs_cumsum (int *p, int *c, int n) 4 | { 5 | int i, nz = 0 ; 6 | double nz2 = 0 ; 7 | if (!p || !c) return (-1) ; /* check inputs */ 8 | for (i = 0 ; i < n ; i++) 9 | { 10 | p [i] = nz ; 11 | nz += c [i] ; 12 | nz2 += c [i] ; /* also in double to avoid int overflow */ 13 | c [i] = p [i] ; /* also copy p[0..n-1] back into c[0..n-1]*/ 14 | } 15 | p [n] = nz ; 16 | return (nz2) ; /* return sum (c [0..n-1]) */ 17 | } 18 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_droptol.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | static int cs_tol (int i, int j, double aij, void *tol) 3 | { 4 | return (fabs (aij) > *((double *) tol)) ; 5 | } 6 | int cs_droptol (cs *A, double tol) 7 | { 8 | return (cs_fkeep (A, &cs_tol, &tol)) ; /* keep all large entries */ 9 | } 10 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_dropzeros.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | static int cs_nonzero (int i, int j, double aij, void *other) 3 | { 4 | return (aij != 0) ; 5 | } 6 | int cs_dropzeros (cs *A) 7 | { 8 | return (cs_fkeep (A, &cs_nonzero, NULL)) ; /* keep all nonzero entries */ 9 | } 10 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_entry.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* add an entry to a triplet matrix; return 1 if ok, 0 otherwise */ 3 | int cs_entry (cs *T, int i, int j, double x) 4 | { 5 | if (!CS_TRIPLET (T) || i < 0 || j < 0) return (0) ; /* check inputs */ 6 | if (T->nz >= T->nzmax && !cs_sprealloc (T,2*(T->nzmax))) return (0) ; 7 | if (T->x) T->x [T->nz] = x ; 8 | T->i [T->nz] = i ; 9 | T->p [T->nz++] = j ; 10 | T->m = CS_MAX (T->m, i+1) ; 11 | T->n = CS_MAX (T->n, j+1) ; 12 | return (1) ; 13 | } 14 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_fkeep.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* drop entries for which fkeep(A(i,j)) is false; return nz if OK, else -1 */ 3 | int cs_fkeep (cs *A, int (*fkeep) (int, int, double, void *), void *other) 4 | { 5 | int j, p, nz = 0, n, *Ap, *Ai ; 6 | double *Ax ; 7 | if (!CS_CSC (A) || !fkeep) return (-1) ; /* check inputs */ 8 | n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ; 9 | for (j = 0 ; j < n ; j++) 10 | { 11 | p = Ap [j] ; /* get current location of col j */ 12 | Ap [j] = nz ; /* record new location of col j */ 13 | for ( ; p < Ap [j+1] ; p++) 14 | { 15 | if (fkeep (Ai [p], j, Ax ? Ax [p] : 1, other)) 16 | { 17 | if (Ax) Ax [nz] = Ax [p] ; /* keep A(i,j) */ 18 | Ai [nz++] = Ai [p] ; 19 | } 20 | } 21 | } 22 | Ap [n] = nz ; /* finalize A */ 23 | cs_sprealloc (A, 0) ; /* remove extra space from A */ 24 | return (nz) ; 25 | } 26 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_gaxpy.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* y = A*x+y */ 3 | int cs_gaxpy (const cs *A, const double *x, double *y) 4 | { 5 | int p, j, n, *Ap, *Ai ; 6 | double *Ax ; 7 | if (!CS_CSC (A) || !x || !y) return (0) ; /* check inputs */ 8 | n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ; 9 | for (j = 0 ; j < n ; j++) 10 | { 11 | for (p = Ap [j] ; p < Ap [j+1] ; p++) 12 | { 13 | y [Ai [p]] += Ax [p] * x [j] ; 14 | } 15 | } 16 | return (1) ; 17 | } 18 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_happly.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* apply the ith Householder vector to x */ 3 | int cs_happly (const cs *V, int i, double beta, double *x) 4 | { 5 | int p, *Vp, *Vi ; 6 | double *Vx, tau = 0 ; 7 | if (!CS_CSC (V) || !x) return (0) ; /* check inputs */ 8 | Vp = V->p ; Vi = V->i ; Vx = V->x ; 9 | for (p = Vp [i] ; p < Vp [i+1] ; p++) /* tau = v'*x */ 10 | { 11 | tau += Vx [p] * x [Vi [p]] ; 12 | } 13 | tau *= beta ; /* tau = beta*(v'*x) */ 14 | for (p = Vp [i] ; p < Vp [i+1] ; p++) /* x = x - v*tau */ 15 | { 16 | x [Vi [p]] -= Vx [p] * tau ; 17 | } 18 | return (1) ; 19 | } 20 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_house.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* create a Householder reflection [v,beta,s]=house(x), overwrite x with v, 3 | * where (I-beta*v*v')*x = s*e1. See Algo 5.1.1, Golub & Van Loan, 3rd ed. */ 4 | double cs_house (double *x, double *beta, int n) 5 | { 6 | double s, sigma = 0 ; 7 | int i ; 8 | if (!x || !beta) return (-1) ; /* check inputs */ 9 | for (i = 1 ; i < n ; i++) sigma += x [i] * x [i] ; 10 | if (sigma == 0) 11 | { 12 | s = fabs (x [0]) ; /* s = |x(0)| */ 13 | (*beta) = (x [0] <= 0) ? 2 : 0 ; 14 | x [0] = 1 ; 15 | } 16 | else 17 | { 18 | s = sqrt (x [0] * x [0] + sigma) ; /* s = norm (x) */ 19 | x [0] = (x [0] <= 0) ? (x [0] - s) : (-sigma / (x [0] + s)) ; 20 | (*beta) = -1. / (s * x [0]) ; 21 | } 22 | return (s) ; 23 | } 24 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_ipvec.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* x(p) = b, for dense vectors x and b; p=NULL denotes identity */ 3 | int cs_ipvec (const int *p, const double *b, double *x, int n) 4 | { 5 | int k ; 6 | if (!x || !b) return (0) ; /* check inputs */ 7 | for (k = 0 ; k < n ; k++) x [p ? p [k] : k] = b [k] ; 8 | return (1) ; 9 | } 10 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_leaf.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* consider A(i,j), node j in ith row subtree and return lca(jprev,j) */ 3 | int cs_leaf (int i, int j, const int *first, int *maxfirst, int *prevleaf, 4 | int *ancestor, int *jleaf) 5 | { 6 | int q, s, sparent, jprev ; 7 | if (!first || !maxfirst || !prevleaf || !ancestor || !jleaf) return (-1) ; 8 | *jleaf = 0 ; 9 | if (i <= j || first [j] <= maxfirst [i]) return (-1) ; /* j not a leaf */ 10 | maxfirst [i] = first [j] ; /* update max first[j] seen so far */ 11 | jprev = prevleaf [i] ; /* jprev = previous leaf of ith subtree */ 12 | prevleaf [i] = j ; 13 | *jleaf = (jprev == -1) ? 1: 2 ; /* j is first or subsequent leaf */ 14 | if (*jleaf == 1) return (i) ; /* if 1st leaf, q = root of ith subtree */ 15 | for (q = jprev ; q != ancestor [q] ; q = ancestor [q]) ; 16 | for (s = jprev ; s != q ; s = sparent) 17 | { 18 | sparent = ancestor [s] ; /* path compression */ 19 | ancestor [s] = q ; 20 | } 21 | return (q) ; /* q = least common ancester (jprev,j) */ 22 | } 23 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_load.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* load a triplet matrix from a file */ 3 | cs *cs_load (FILE *f) 4 | { 5 | int i, j ; 6 | double x ; 7 | cs *T ; 8 | if (!f) return (NULL) ; /* check inputs */ 9 | T = cs_spalloc (0, 0, 1, 1, 1) ; /* allocate result */ 10 | while (fscanf (f, "%d %d %lg\n", &i, &j, &x) == 3) 11 | { 12 | if (!cs_entry (T, i, j, x)) return (cs_spfree (T)) ; 13 | } 14 | return (T) ; 15 | } 16 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_lsolve.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* solve Lx=b where x and b are dense. x=b on input, solution on output. */ 3 | int cs_lsolve (const cs *L, double *x) 4 | { 5 | int p, j, n, *Lp, *Li ; 6 | double *Lx ; 7 | if (!CS_CSC (L) || !x) return (0) ; /* check inputs */ 8 | n = L->n ; Lp = L->p ; Li = L->i ; Lx = L->x ; 9 | for (j = 0 ; j < n ; j++) 10 | { 11 | x [j] /= Lx [Lp [j]] ; 12 | for (p = Lp [j]+1 ; p < Lp [j+1] ; p++) 13 | { 14 | x [Li [p]] -= Lx [p] * x [j] ; 15 | } 16 | } 17 | return (1) ; 18 | } 19 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_ltsolve.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* solve L'x=b where x and b are dense. x=b on input, solution on output. */ 3 | int cs_ltsolve (const cs *L, double *x) 4 | { 5 | int p, j, n, *Lp, *Li ; 6 | double *Lx ; 7 | if (!CS_CSC (L) || !x) return (0) ; /* check inputs */ 8 | n = L->n ; Lp = L->p ; Li = L->i ; Lx = L->x ; 9 | for (j = n-1 ; j >= 0 ; j--) 10 | { 11 | for (p = Lp [j]+1 ; p < Lp [j+1] ; p++) 12 | { 13 | x [j] -= Lx [p] * x [Li [p]] ; 14 | } 15 | x [j] /= Lx [Lp [j]] ; 16 | } 17 | return (1) ; 18 | } 19 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_lusol.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* x=A\b where A is unsymmetric; b overwritten with solution */ 3 | int cs_lusol (int order, const cs *A, double *b, double tol) 4 | { 5 | double *x ; 6 | css *S ; 7 | csn *N ; 8 | int n, ok ; 9 | if (!CS_CSC (A) || !b) return (0) ; /* check inputs */ 10 | n = A->n ; 11 | S = cs_sqr (order, A, 0) ; /* ordering and symbolic analysis */ 12 | N = cs_lu (A, S, tol) ; /* numeric LU factorization */ 13 | x = cs_malloc (n, sizeof (double)) ; /* get workspace */ 14 | ok = (S && N && x) ; 15 | if (ok) 16 | { 17 | cs_ipvec (N->pinv, b, x, n) ; /* x = b(p) */ 18 | cs_lsolve (N->L, x) ; /* x = L\x */ 19 | cs_usolve (N->U, x) ; /* x = U\x */ 20 | cs_ipvec (S->q, x, b, n) ; /* b(q) = x */ 21 | } 22 | cs_free (x) ; 23 | cs_sfree (S) ; 24 | cs_nfree (N) ; 25 | return (ok) ; 26 | } 27 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_malloc.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | #ifdef MATLAB_MEX_FILE 3 | #define malloc mxMalloc 4 | #define free mxFree 5 | #define realloc mxRealloc 6 | #define calloc mxCalloc 7 | #endif 8 | 9 | /* wrapper for malloc */ 10 | void *cs_malloc (int n, size_t size) 11 | { 12 | return (malloc (CS_MAX (n,1) * size)) ; 13 | } 14 | 15 | /* wrapper for calloc */ 16 | void *cs_calloc (int n, size_t size) 17 | { 18 | return (calloc (CS_MAX (n,1), size)) ; 19 | } 20 | 21 | /* wrapper for free */ 22 | void *cs_free (void *p) 23 | { 24 | if (p) free (p) ; /* free p if it is not already NULL */ 25 | return (NULL) ; /* return NULL to simplify the use of cs_free */ 26 | } 27 | 28 | /* wrapper for realloc */ 29 | void *cs_realloc (void *p, int n, size_t size, int *ok) 30 | { 31 | void *pnew ; 32 | pnew = realloc (p, CS_MAX (n,1) * size) ; /* realloc the block */ 33 | *ok = (pnew != NULL) ; /* realloc fails if pnew is NULL */ 34 | return ((*ok) ? pnew : p) ; /* return original p if failure */ 35 | } 36 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_norm.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* 1-norm of a sparse matrix = max (sum (abs (A))), largest column sum */ 3 | double cs_norm (const cs *A) 4 | { 5 | int p, j, n, *Ap ; 6 | double *Ax, norm = 0, s ; 7 | if (!CS_CSC (A) || !A->x) return (-1) ; /* check inputs */ 8 | n = A->n ; Ap = A->p ; Ax = A->x ; 9 | for (j = 0 ; j < n ; j++) 10 | { 11 | for (s = 0, p = Ap [j] ; p < Ap [j+1] ; p++) s += fabs (Ax [p]) ; 12 | norm = CS_MAX (norm, s) ; 13 | } 14 | return (norm) ; 15 | } 16 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_pinv.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* pinv = p', or p = pinv' */ 3 | int *cs_pinv (int const *p, int n) 4 | { 5 | int k, *pinv ; 6 | if (!p) return (NULL) ; /* p = NULL denotes identity */ 7 | pinv = cs_malloc (n, sizeof (int)) ; /* allocate result */ 8 | if (!pinv) return (NULL) ; /* out of memory */ 9 | for (k = 0 ; k < n ; k++) pinv [p [k]] = k ;/* invert the permutation */ 10 | return (pinv) ; /* return result */ 11 | } 12 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_pvec.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* x = b(p), for dense vectors x and b; p=NULL denotes identity */ 3 | int cs_pvec (const int *p, const double *b, double *x, int n) 4 | { 5 | int k ; 6 | if (!x || !b) return (0) ; /* check inputs */ 7 | for (k = 0 ; k < n ; k++) x [k] = b [p ? p [k] : k] ; 8 | return (1) ; 9 | } 10 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_randperm.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* return a random permutation vector, the identity perm, or p = n-1:-1:0. 3 | * seed = -1 means p = n-1:-1:0. seed = 0 means p = identity. otherwise 4 | * p = random permutation. */ 5 | int *cs_randperm (int n, int seed) 6 | { 7 | int *p, k, j, t ; 8 | if (seed == 0) return (NULL) ; /* return p = NULL (identity) */ 9 | p = cs_malloc (n, sizeof (int)) ; /* allocate result */ 10 | if (!p) return (NULL) ; /* out of memory */ 11 | for (k = 0 ; k < n ; k++) p [k] = n-k-1 ; 12 | if (seed == -1) return (p) ; /* return reverse permutation */ 13 | srand (seed) ; /* get new random number seed */ 14 | for (k = 0 ; k < n ; k++) 15 | { 16 | j = k + (rand ( ) % (n-k)) ; /* j = rand int in range k to n-1 */ 17 | t = p [j] ; /* swap p[k] and p[j] */ 18 | p [j] = p [k] ; 19 | p [k] = t ; 20 | } 21 | return (p) ; 22 | } 23 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_reach.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* xi [top...n-1] = nodes reachable from graph of G*P' via nodes in B(:,k). 3 | * xi [n...2n-1] used as workspace */ 4 | int cs_reach (cs *G, const cs *B, int k, int *xi, const int *pinv) 5 | { 6 | int p, n, top, *Bp, *Bi, *Gp ; 7 | if (!CS_CSC (G) || !CS_CSC (B) || !xi) return (-1) ; /* check inputs */ 8 | n = G->n ; Bp = B->p ; Bi = B->i ; Gp = G->p ; 9 | top = n ; 10 | for (p = Bp [k] ; p < Bp [k+1] ; p++) 11 | { 12 | if (!CS_MARKED (Gp, Bi [p])) /* start a dfs at unmarked node i */ 13 | { 14 | top = cs_dfs (Bi [p], G, top, xi, xi+n, pinv) ; 15 | } 16 | } 17 | for (p = top ; p < n ; p++) CS_MARK (Gp, xi [p]) ; /* restore G */ 18 | return (top) ; 19 | } 20 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_scatter.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* x = x + beta * A(:,j), where x is a dense vector and A(:,j) is sparse */ 3 | int cs_scatter (const cs *A, int j, double beta, int *w, double *x, int mark, 4 | cs *C, int nz) 5 | { 6 | int i, p, *Ap, *Ai, *Ci ; 7 | double *Ax ; 8 | if (!CS_CSC (A) || !w || !CS_CSC (C)) return (-1) ; /* check inputs */ 9 | Ap = A->p ; Ai = A->i ; Ax = A->x ; Ci = C->i ; 10 | for (p = Ap [j] ; p < Ap [j+1] ; p++) 11 | { 12 | i = Ai [p] ; /* A(i,j) is nonzero */ 13 | if (w [i] < mark) 14 | { 15 | w [i] = mark ; /* i is new entry in column j */ 16 | Ci [nz++] = i ; /* add i to pattern of C(:,j) */ 17 | if (x) x [i] = beta * Ax [p] ; /* x(i) = beta*A(i,j) */ 18 | } 19 | else if (x) x [i] += beta * Ax [p] ; /* i exists in C(:,j) already */ 20 | } 21 | return (nz) ; 22 | } 23 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_tdfs.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* depth-first search and postorder of a tree rooted at node j */ 3 | int cs_tdfs (int j, int k, int *head, const int *next, int *post, int *stack) 4 | { 5 | int i, p, top = 0 ; 6 | if (!head || !next || !post || !stack) return (-1) ; /* check inputs */ 7 | stack [0] = j ; /* place j on the stack */ 8 | while (top >= 0) /* while (stack is not empty) */ 9 | { 10 | p = stack [top] ; /* p = top of stack */ 11 | i = head [p] ; /* i = youngest child of p */ 12 | if (i == -1) 13 | { 14 | top-- ; /* p has no unordered children left */ 15 | post [k++] = p ; /* node p is the kth postordered node */ 16 | } 17 | else 18 | { 19 | head [p] = next [i] ; /* remove i from children of p */ 20 | stack [++top] = i ; /* start dfs on child node i */ 21 | } 22 | } 23 | return (k) ; 24 | } 25 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_transpose.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* C = A' */ 3 | cs *cs_transpose (const cs *A, int values) 4 | { 5 | int p, q, j, *Cp, *Ci, n, m, *Ap, *Ai, *w ; 6 | double *Cx, *Ax ; 7 | cs *C ; 8 | if (!CS_CSC (A)) return (NULL) ; /* check inputs */ 9 | m = A->m ; n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ; 10 | C = cs_spalloc (n, m, Ap [n], values && Ax, 0) ; /* allocate result */ 11 | w = cs_calloc (m, sizeof (int)) ; /* get workspace */ 12 | if (!C || !w) return (cs_done (C, w, NULL, 0)) ; /* out of memory */ 13 | Cp = C->p ; Ci = C->i ; Cx = C->x ; 14 | for (p = 0 ; p < Ap [n] ; p++) w [Ai [p]]++ ; /* row counts */ 15 | cs_cumsum (Cp, w, m) ; /* row pointers */ 16 | for (j = 0 ; j < n ; j++) 17 | { 18 | for (p = Ap [j] ; p < Ap [j+1] ; p++) 19 | { 20 | Ci [q = w [Ai [p]]++] = j ; /* place A(i,j) as entry C(j,i) */ 21 | if (Cx) Cx [q] = Ax [p] ; 22 | } 23 | } 24 | return (cs_done (C, w, NULL, 1)) ; /* success; free w and return C */ 25 | } 26 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_usolve.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* solve Ux=b where x and b are dense. x=b on input, solution on output. */ 3 | int cs_usolve (const cs *U, double *x) 4 | { 5 | int p, j, n, *Up, *Ui ; 6 | double *Ux ; 7 | if (!CS_CSC (U) || !x) return (0) ; /* check inputs */ 8 | n = U->n ; Up = U->p ; Ui = U->i ; Ux = U->x ; 9 | for (j = n-1 ; j >= 0 ; j--) 10 | { 11 | x [j] /= Ux [Up [j+1]-1] ; 12 | for (p = Up [j] ; p < Up [j+1]-1 ; p++) 13 | { 14 | x [Ui [p]] -= Ux [p] * x [j] ; 15 | } 16 | } 17 | return (1) ; 18 | } 19 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/cs_utsolve.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* solve U'x=b where x and b are dense. x=b on input, solution on output. */ 3 | int cs_utsolve (const cs *U, double *x) 4 | { 5 | int p, j, n, *Up, *Ui ; 6 | double *Ux ; 7 | if (!CS_CSC (U) || !x) return (0) ; /* check inputs */ 8 | n = U->n ; Up = U->p ; Ui = U->i ; Ux = U->x ; 9 | for (j = 0 ; j < n ; j++) 10 | { 11 | for (p = Up [j] ; p < Up [j+1]-1 ; p++) 12 | { 13 | x [j] -= Ux [p] * x [Ui [p]] ; 14 | } 15 | x [j] /= Ux [Up [j+1]-1] ; 16 | } 17 | return (1) ; 18 | } 19 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/CSparse/foo: -------------------------------------------------------------------------------- 1 | # Modify the "-O" optimization option for best performance (-O3 on Linux): 2 | CC = gcc 3 | CFLAGS = -O 4 | 5 | AR = ar cr 6 | RANLIB = ranlib 7 | 8 | all: libcsparse.a 9 | 10 | CS = cs_add.o cs_amd.o cs_chol.o cs_cholsol.o cs_counts.o cs_cumsum.o \ 11 | cs_droptol.o cs_dropzeros.o cs_dupl.o cs_entry.o \ 12 | cs_etree.o cs_fkeep.o cs_gaxpy.o cs_happly.o cs_house.o cs_ipvec.o \ 13 | cs_lsolve.o cs_ltsolve.o cs_lu.o cs_lusol.o cs_util.o cs_multiply.o \ 14 | cs_permute.o cs_pinv.o cs_post.o cs_pvec.o cs_qr.o cs_qrsol.o \ 15 | cs_scatter.o cs_schol.o cs_sqr.o cs_symperm.o cs_tdfs.o cs_malloc.o \ 16 | cs_transpose.o cs_compress.o cs_usolve.o cs_utsolve.o cs_scc.o \ 17 | cs_maxtrans.o cs_dmperm.o cs_updown.o cs_print.o cs_norm.o cs_load.o \ 18 | cs_dfs.o cs_reach.o cs_spsolve.o cs_ereach.o cs_leaf.o cs_randperm.o 19 | 20 | $(CS): cs.h Makefile 21 | 22 | %.o: %.c cs.h 23 | $(CC) $(CFLAGS) -c $< 24 | 25 | libcsparse.a: $(CS) 26 | $(AR) libcsparse.a $(CS) 27 | $(RANLIB) libcsparse.a 28 | 29 | clean: 30 | rm -f *.o 31 | 32 | purge: distclean 33 | 34 | distclean: clean 35 | rm -f *.a 36 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name and list of source files. 3 | # 4 | 5 | NAME=CSparse 6 | CSRCS= cs_add.c cs_amd.c cs_chol.c cs_cholsol.c cs_counts.c cs_cumsum.c \ 7 | cs_droptol.c cs_dropzeros.c cs_dupl.c cs_entry.c \ 8 | cs_etree.c cs_fkeep.c cs_gaxpy.c cs_happly.c cs_house.c cs_ipvec.c \ 9 | cs_lsolve.c cs_ltsolve.c cs_lu.c cs_lusol.c cs_util.c cs_multiply.c \ 10 | cs_permute.c cs_pinv.c cs_post.c cs_pvec.c cs_qr.c cs_qrsol.c \ 11 | cs_scatter.c cs_schol.c cs_sqr.c cs_symperm.c cs_tdfs.c cs_malloc.c \ 12 | cs_transpose.c cs_compress.c cs_usolve.c cs_utsolve.c cs_scc.c \ 13 | cs_maxtrans.c cs_dmperm.c cs_updown.c cs_print.c cs_norm.c cs_load.c \ 14 | cs_dfs.c cs_reach.c cs_spsolve.c cs_ereach.c cs_leaf.c cs_randperm.c 15 | 16 | 17 | 18 | # 19 | # R3 library makefile 20 | # 21 | 22 | include ../../makefiles/Makefile.pkgs 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/README.txt: -------------------------------------------------------------------------------- 1 | CSparse/Source directory: primary ANSI C source code files for CSparse. 2 | All of these files are printed verbatim in the book. To compile the 3 | libcsparse.a C-callable library, just type "make" in this directory. 4 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_cholsol.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* x=A\b where A is symmetric positive definite; b overwritten with solution */ 3 | int cs_cholsol (int order, const cs *A, double *b) 4 | { 5 | double *x ; 6 | css *S ; 7 | csn *N ; 8 | int n, ok ; 9 | if (!CS_CSC (A) || !b) return (0) ; /* check inputs */ 10 | n = A->n ; 11 | S = cs_schol (order, A) ; /* ordering and symbolic analysis */ 12 | N = cs_chol (A, S) ; /* numeric Cholesky factorization */ 13 | x = cs_malloc (n, sizeof (double)) ; /* get workspace */ 14 | ok = (S && N && x) ; 15 | if (ok) 16 | { 17 | cs_ipvec (S->pinv, b, x, n) ; /* x = P*b */ 18 | cs_lsolve (N->L, x) ; /* x = L\x */ 19 | cs_ltsolve (N->L, x) ; /* x = L'\x */ 20 | cs_pvec (S->pinv, x, b, n) ; /* b = P'*x */ 21 | } 22 | cs_free (x) ; 23 | cs_sfree (S) ; 24 | cs_nfree (N) ; 25 | return (ok) ; 26 | } 27 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_compress.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* C = compressed-column form of a triplet matrix T */ 3 | cs *cs_compress (const cs *T) 4 | { 5 | int m, n, nz, p, k, *Cp, *Ci, *w, *Ti, *Tj ; 6 | double *Cx, *Tx ; 7 | cs *C ; 8 | if (!CS_TRIPLET (T)) return (NULL) ; /* check inputs */ 9 | m = T->m ; n = T->n ; Ti = T->i ; Tj = T->p ; Tx = T->x ; nz = T->nz ; 10 | C = cs_spalloc (m, n, nz, Tx != NULL, 0) ; /* allocate result */ 11 | w = cs_calloc (n, sizeof (int)) ; /* get workspace */ 12 | if (!C || !w) return (cs_done (C, w, NULL, 0)) ; /* out of memory */ 13 | Cp = C->p ; Ci = C->i ; Cx = C->x ; 14 | for (k = 0 ; k < nz ; k++) w [Tj [k]]++ ; /* column counts */ 15 | cs_cumsum (Cp, w, n) ; /* column pointers */ 16 | for (k = 0 ; k < nz ; k++) 17 | { 18 | Ci [p = w [Tj [k]]++] = Ti [k] ; /* A(i,j) is the pth entry in C */ 19 | if (Cx) Cx [p] = Tx [k] ; 20 | } 21 | return (cs_done (C, w, NULL, 1)) ; /* success; free w and return C */ 22 | } 23 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_cumsum.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* p [0..n] = cumulative sum of c [0..n-1], and then copy p [0..n-1] into c */ 3 | double cs_cumsum (int *p, int *c, int n) 4 | { 5 | int i, nz = 0 ; 6 | double nz2 = 0 ; 7 | if (!p || !c) return (-1) ; /* check inputs */ 8 | for (i = 0 ; i < n ; i++) 9 | { 10 | p [i] = nz ; 11 | nz += c [i] ; 12 | nz2 += c [i] ; /* also in double to avoid int overflow */ 13 | c [i] = p [i] ; /* also copy p[0..n-1] back into c[0..n-1]*/ 14 | } 15 | p [n] = nz ; 16 | return (nz2) ; /* return sum (c [0..n-1]) */ 17 | } 18 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_droptol.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | static int cs_tol (int i, int j, double aij, void *tol) 3 | { 4 | return (fabs (aij) > *((double *) tol)) ; 5 | } 6 | int cs_droptol (cs *A, double tol) 7 | { 8 | return (cs_fkeep (A, &cs_tol, &tol)) ; /* keep all large entries */ 9 | } 10 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_dropzeros.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | static int cs_nonzero (int i, int j, double aij, void *other) 3 | { 4 | return (aij != 0) ; 5 | } 6 | int cs_dropzeros (cs *A) 7 | { 8 | return (cs_fkeep (A, &cs_nonzero, NULL)) ; /* keep all nonzero entries */ 9 | } 10 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_entry.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* add an entry to a triplet matrix; return 1 if ok, 0 otherwise */ 3 | int cs_entry (cs *T, int i, int j, double x) 4 | { 5 | if (!CS_TRIPLET (T) || i < 0 || j < 0) return (0) ; /* check inputs */ 6 | if (T->nz >= T->nzmax && !cs_sprealloc (T,2*(T->nzmax))) return (0) ; 7 | if (T->x) T->x [T->nz] = x ; 8 | T->i [T->nz] = i ; 9 | T->p [T->nz++] = j ; 10 | T->m = CS_MAX (T->m, i+1) ; 11 | T->n = CS_MAX (T->n, j+1) ; 12 | return (1) ; 13 | } 14 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_fkeep.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* drop entries for which fkeep(A(i,j)) is false; return nz if OK, else -1 */ 3 | int cs_fkeep (cs *A, int (*fkeep) (int, int, double, void *), void *other) 4 | { 5 | int j, p, nz = 0, n, *Ap, *Ai ; 6 | double *Ax ; 7 | if (!CS_CSC (A) || !fkeep) return (-1) ; /* check inputs */ 8 | n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ; 9 | for (j = 0 ; j < n ; j++) 10 | { 11 | p = Ap [j] ; /* get current location of col j */ 12 | Ap [j] = nz ; /* record new location of col j */ 13 | for ( ; p < Ap [j+1] ; p++) 14 | { 15 | if (fkeep (Ai [p], j, Ax ? Ax [p] : 1, other)) 16 | { 17 | if (Ax) Ax [nz] = Ax [p] ; /* keep A(i,j) */ 18 | Ai [nz++] = Ai [p] ; 19 | } 20 | } 21 | } 22 | Ap [n] = nz ; /* finalize A */ 23 | cs_sprealloc (A, 0) ; /* remove extra space from A */ 24 | return (nz) ; 25 | } 26 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_gaxpy.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* y = A*x+y */ 3 | int cs_gaxpy (const cs *A, const double *x, double *y) 4 | { 5 | int p, j, n, *Ap, *Ai ; 6 | double *Ax ; 7 | if (!CS_CSC (A) || !x || !y) return (0) ; /* check inputs */ 8 | n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ; 9 | for (j = 0 ; j < n ; j++) 10 | { 11 | for (p = Ap [j] ; p < Ap [j+1] ; p++) 12 | { 13 | y [Ai [p]] += Ax [p] * x [j] ; 14 | } 15 | } 16 | return (1) ; 17 | } 18 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_happly.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* apply the ith Householder vector to x */ 3 | int cs_happly (const cs *V, int i, double beta, double *x) 4 | { 5 | int p, *Vp, *Vi ; 6 | double *Vx, tau = 0 ; 7 | if (!CS_CSC (V) || !x) return (0) ; /* check inputs */ 8 | Vp = V->p ; Vi = V->i ; Vx = V->x ; 9 | for (p = Vp [i] ; p < Vp [i+1] ; p++) /* tau = v'*x */ 10 | { 11 | tau += Vx [p] * x [Vi [p]] ; 12 | } 13 | tau *= beta ; /* tau = beta*(v'*x) */ 14 | for (p = Vp [i] ; p < Vp [i+1] ; p++) /* x = x - v*tau */ 15 | { 16 | x [Vi [p]] -= Vx [p] * tau ; 17 | } 18 | return (1) ; 19 | } 20 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_house.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* create a Householder reflection [v,beta,s]=house(x), overwrite x with v, 3 | * where (I-beta*v*v')*x = s*e1. See Algo 5.1.1, Golub & Van Loan, 3rd ed. */ 4 | double cs_house (double *x, double *beta, int n) 5 | { 6 | double s, sigma = 0 ; 7 | int i ; 8 | if (!x || !beta) return (-1) ; /* check inputs */ 9 | for (i = 1 ; i < n ; i++) sigma += x [i] * x [i] ; 10 | if (sigma == 0) 11 | { 12 | s = fabs (x [0]) ; /* s = |x(0)| */ 13 | (*beta) = (x [0] <= 0) ? 2 : 0 ; 14 | x [0] = 1 ; 15 | } 16 | else 17 | { 18 | s = sqrt (x [0] * x [0] + sigma) ; /* s = norm (x) */ 19 | x [0] = (x [0] <= 0) ? (x [0] - s) : (-sigma / (x [0] + s)) ; 20 | (*beta) = -1. / (s * x [0]) ; 21 | } 22 | return (s) ; 23 | } 24 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_ipvec.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* x(p) = b, for dense vectors x and b; p=NULL denotes identity */ 3 | int cs_ipvec (const int *p, const double *b, double *x, int n) 4 | { 5 | int k ; 6 | if (!x || !b) return (0) ; /* check inputs */ 7 | for (k = 0 ; k < n ; k++) x [p ? p [k] : k] = b [k] ; 8 | return (1) ; 9 | } 10 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_leaf.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* consider A(i,j), node j in ith row subtree and return lca(jprev,j) */ 3 | int cs_leaf (int i, int j, const int *first, int *maxfirst, int *prevleaf, 4 | int *ancestor, int *jleaf) 5 | { 6 | int q, s, sparent, jprev ; 7 | if (!first || !maxfirst || !prevleaf || !ancestor || !jleaf) return (-1) ; 8 | *jleaf = 0 ; 9 | if (i <= j || first [j] <= maxfirst [i]) return (-1) ; /* j not a leaf */ 10 | maxfirst [i] = first [j] ; /* update max first[j] seen so far */ 11 | jprev = prevleaf [i] ; /* jprev = previous leaf of ith subtree */ 12 | prevleaf [i] = j ; 13 | *jleaf = (jprev == -1) ? 1: 2 ; /* j is first or subsequent leaf */ 14 | if (*jleaf == 1) return (i) ; /* if 1st leaf, q = root of ith subtree */ 15 | for (q = jprev ; q != ancestor [q] ; q = ancestor [q]) ; 16 | for (s = jprev ; s != q ; s = sparent) 17 | { 18 | sparent = ancestor [s] ; /* path compression */ 19 | ancestor [s] = q ; 20 | } 21 | return (q) ; /* q = least common ancester (jprev,j) */ 22 | } 23 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_load.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* load a triplet matrix from a file */ 3 | cs *cs_load (FILE *f) 4 | { 5 | int i, j ; 6 | double x ; 7 | cs *T ; 8 | if (!f) return (NULL) ; /* check inputs */ 9 | T = cs_spalloc (0, 0, 1, 1, 1) ; /* allocate result */ 10 | while (fscanf (f, "%d %d %lg\n", &i, &j, &x) == 3) 11 | { 12 | if (!cs_entry (T, i, j, x)) return (cs_spfree (T)) ; 13 | } 14 | return (T) ; 15 | } 16 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_lsolve.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* solve Lx=b where x and b are dense. x=b on input, solution on output. */ 3 | int cs_lsolve (const cs *L, double *x) 4 | { 5 | int p, j, n, *Lp, *Li ; 6 | double *Lx ; 7 | if (!CS_CSC (L) || !x) return (0) ; /* check inputs */ 8 | n = L->n ; Lp = L->p ; Li = L->i ; Lx = L->x ; 9 | for (j = 0 ; j < n ; j++) 10 | { 11 | x [j] /= Lx [Lp [j]] ; 12 | for (p = Lp [j]+1 ; p < Lp [j+1] ; p++) 13 | { 14 | x [Li [p]] -= Lx [p] * x [j] ; 15 | } 16 | } 17 | return (1) ; 18 | } 19 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_ltsolve.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* solve L'x=b where x and b are dense. x=b on input, solution on output. */ 3 | int cs_ltsolve (const cs *L, double *x) 4 | { 5 | int p, j, n, *Lp, *Li ; 6 | double *Lx ; 7 | if (!CS_CSC (L) || !x) return (0) ; /* check inputs */ 8 | n = L->n ; Lp = L->p ; Li = L->i ; Lx = L->x ; 9 | for (j = n-1 ; j >= 0 ; j--) 10 | { 11 | for (p = Lp [j]+1 ; p < Lp [j+1] ; p++) 12 | { 13 | x [j] -= Lx [p] * x [Li [p]] ; 14 | } 15 | x [j] /= Lx [Lp [j]] ; 16 | } 17 | return (1) ; 18 | } 19 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_lusol.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* x=A\b where A is unsymmetric; b overwritten with solution */ 3 | int cs_lusol (int order, const cs *A, double *b, double tol) 4 | { 5 | double *x ; 6 | css *S ; 7 | csn *N ; 8 | int n, ok ; 9 | if (!CS_CSC (A) || !b) return (0) ; /* check inputs */ 10 | n = A->n ; 11 | S = cs_sqr (order, A, 0) ; /* ordering and symbolic analysis */ 12 | N = cs_lu (A, S, tol) ; /* numeric LU factorization */ 13 | x = cs_malloc (n, sizeof (double)) ; /* get workspace */ 14 | ok = (S && N && x) ; 15 | if (ok) 16 | { 17 | cs_ipvec (N->pinv, b, x, n) ; /* x = b(p) */ 18 | cs_lsolve (N->L, x) ; /* x = L\x */ 19 | cs_usolve (N->U, x) ; /* x = U\x */ 20 | cs_ipvec (S->q, x, b, n) ; /* b(q) = x */ 21 | } 22 | cs_free (x) ; 23 | cs_sfree (S) ; 24 | cs_nfree (N) ; 25 | return (ok) ; 26 | } 27 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_malloc.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | #ifdef MATLAB_MEX_FILE 3 | #define malloc mxMalloc 4 | #define free mxFree 5 | #define realloc mxRealloc 6 | #define calloc mxCalloc 7 | #endif 8 | 9 | /* wrapper for malloc */ 10 | void *cs_malloc (int n, size_t size) 11 | { 12 | return (malloc (CS_MAX (n,1) * size)) ; 13 | } 14 | 15 | /* wrapper for calloc */ 16 | void *cs_calloc (int n, size_t size) 17 | { 18 | return (calloc (CS_MAX (n,1), size)) ; 19 | } 20 | 21 | /* wrapper for free */ 22 | void *cs_free (void *p) 23 | { 24 | if (p) free (p) ; /* free p if it is not already NULL */ 25 | return (NULL) ; /* return NULL to simplify the use of cs_free */ 26 | } 27 | 28 | /* wrapper for realloc */ 29 | void *cs_realloc (void *p, int n, size_t size, int *ok) 30 | { 31 | void *pnew ; 32 | pnew = realloc (p, CS_MAX (n,1) * size) ; /* realloc the block */ 33 | *ok = (pnew != NULL) ; /* realloc fails if pnew is NULL */ 34 | return ((*ok) ? pnew : p) ; /* return original p if failure */ 35 | } 36 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_norm.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* 1-norm of a sparse matrix = max (sum (abs (A))), largest column sum */ 3 | double cs_norm (const cs *A) 4 | { 5 | int p, j, n, *Ap ; 6 | double *Ax, norm = 0, s ; 7 | if (!CS_CSC (A) || !A->x) return (-1) ; /* check inputs */ 8 | n = A->n ; Ap = A->p ; Ax = A->x ; 9 | for (j = 0 ; j < n ; j++) 10 | { 11 | for (s = 0, p = Ap [j] ; p < Ap [j+1] ; p++) s += fabs (Ax [p]) ; 12 | norm = CS_MAX (norm, s) ; 13 | } 14 | return (norm) ; 15 | } 16 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_permute.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* C = A(p,q) where p and q are permutations of 0..m-1 and 0..n-1. */ 3 | cs *cs_permute (const cs *A, const int *pinv, const int *q, int values) 4 | { 5 | int t, j, k, nz = 0, m, n, *Ap, *Ai, *Cp, *Ci ; 6 | double *Cx, *Ax ; 7 | cs *C ; 8 | if (!CS_CSC (A)) return (NULL) ; /* check inputs */ 9 | m = A->m ; n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ; 10 | C = cs_spalloc (m, n, Ap [n], values && Ax != NULL, 0) ; /* alloc result */ 11 | if (!C) return (cs_done (C, NULL, NULL, 0)) ; /* out of memory */ 12 | Cp = C->p ; Ci = C->i ; Cx = C->x ; 13 | for (k = 0 ; k < n ; k++) 14 | { 15 | Cp [k] = nz ; /* column k of C is column q[k] of A */ 16 | j = q ? (q [k]) : k ; 17 | for (t = Ap [j] ; t < Ap [j+1] ; t++) 18 | { 19 | if (Cx) Cx [nz] = Ax [t] ; /* row i of A is row pinv[i] of C */ 20 | Ci [nz++] = pinv ? (pinv [Ai [t]]) : Ai [t] ; 21 | } 22 | } 23 | Cp [n] = nz ; /* finalize the last column of C */ 24 | return (cs_done (C, NULL, NULL, 1)) ; 25 | } 26 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_pinv.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* pinv = p', or p = pinv' */ 3 | int *cs_pinv (int const *p, int n) 4 | { 5 | int k, *pinv ; 6 | if (!p) return (NULL) ; /* p = NULL denotes identity */ 7 | pinv = cs_malloc (n, sizeof (int)) ; /* allocate result */ 8 | if (!pinv) return (NULL) ; /* out of memory */ 9 | for (k = 0 ; k < n ; k++) pinv [p [k]] = k ;/* invert the permutation */ 10 | return (pinv) ; /* return result */ 11 | } 12 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_pvec.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* x = b(p), for dense vectors x and b; p=NULL denotes identity */ 3 | int cs_pvec (const int *p, const double *b, double *x, int n) 4 | { 5 | int k ; 6 | if (!x || !b) return (0) ; /* check inputs */ 7 | for (k = 0 ; k < n ; k++) x [k] = b [p ? p [k] : k] ; 8 | return (1) ; 9 | } 10 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_randperm.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* return a random permutation vector, the identity perm, or p = n-1:-1:0. 3 | * seed = -1 means p = n-1:-1:0. seed = 0 means p = identity. otherwise 4 | * p = random permutation. */ 5 | int *cs_randperm (int n, int seed) 6 | { 7 | int *p, k, j, t ; 8 | if (seed == 0) return (NULL) ; /* return p = NULL (identity) */ 9 | p = cs_malloc (n, sizeof (int)) ; /* allocate result */ 10 | if (!p) return (NULL) ; /* out of memory */ 11 | for (k = 0 ; k < n ; k++) p [k] = n-k-1 ; 12 | if (seed == -1) return (p) ; /* return reverse permutation */ 13 | srand (seed) ; /* get new random number seed */ 14 | for (k = 0 ; k < n ; k++) 15 | { 16 | j = k + (rand ( ) % (n-k)) ; /* j = rand int in range k to n-1 */ 17 | t = p [j] ; /* swap p[k] and p[j] */ 18 | p [j] = p [k] ; 19 | p [k] = t ; 20 | } 21 | return (p) ; 22 | } 23 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_reach.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* xi [top...n-1] = nodes reachable from graph of G*P' via nodes in B(:,k). 3 | * xi [n...2n-1] used as workspace */ 4 | int cs_reach (cs *G, const cs *B, int k, int *xi, const int *pinv) 5 | { 6 | int p, n, top, *Bp, *Bi, *Gp ; 7 | if (!CS_CSC (G) || !CS_CSC (B) || !xi) return (-1) ; /* check inputs */ 8 | n = G->n ; Bp = B->p ; Bi = B->i ; Gp = G->p ; 9 | top = n ; 10 | for (p = Bp [k] ; p < Bp [k+1] ; p++) 11 | { 12 | if (!CS_MARKED (Gp, Bi [p])) /* start a dfs at unmarked node i */ 13 | { 14 | top = cs_dfs (Bi [p], G, top, xi, xi+n, pinv) ; 15 | } 16 | } 17 | for (p = top ; p < n ; p++) CS_MARK (Gp, xi [p]) ; /* restore G */ 18 | return (top) ; 19 | } 20 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_scatter.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* x = x + beta * A(:,j), where x is a dense vector and A(:,j) is sparse */ 3 | int cs_scatter (const cs *A, int j, double beta, int *w, double *x, int mark, 4 | cs *C, int nz) 5 | { 6 | int i, p, *Ap, *Ai, *Ci ; 7 | double *Ax ; 8 | if (!CS_CSC (A) || !w || !CS_CSC (C)) return (-1) ; /* check inputs */ 9 | Ap = A->p ; Ai = A->i ; Ax = A->x ; Ci = C->i ; 10 | for (p = Ap [j] ; p < Ap [j+1] ; p++) 11 | { 12 | i = Ai [p] ; /* A(i,j) is nonzero */ 13 | if (w [i] < mark) 14 | { 15 | w [i] = mark ; /* i is new entry in column j */ 16 | Ci [nz++] = i ; /* add i to pattern of C(:,j) */ 17 | if (x) x [i] = beta * Ax [p] ; /* x(i) = beta*A(i,j) */ 18 | } 19 | else if (x) x [i] += beta * Ax [p] ; /* i exists in C(:,j) already */ 20 | } 21 | return (nz) ; 22 | } 23 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_tdfs.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* depth-first search and postorder of a tree rooted at node j */ 3 | int cs_tdfs (int j, int k, int *head, const int *next, int *post, int *stack) 4 | { 5 | int i, p, top = 0 ; 6 | if (!head || !next || !post || !stack) return (-1) ; /* check inputs */ 7 | stack [0] = j ; /* place j on the stack */ 8 | while (top >= 0) /* while (stack is not empty) */ 9 | { 10 | p = stack [top] ; /* p = top of stack */ 11 | i = head [p] ; /* i = youngest child of p */ 12 | if (i == -1) 13 | { 14 | top-- ; /* p has no unordered children left */ 15 | post [k++] = p ; /* node p is the kth postordered node */ 16 | } 17 | else 18 | { 19 | head [p] = next [i] ; /* remove i from children of p */ 20 | stack [++top] = i ; /* start dfs on child node i */ 21 | } 22 | } 23 | return (k) ; 24 | } 25 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_transpose.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* C = A' */ 3 | cs *cs_transpose (const cs *A, int values) 4 | { 5 | int p, q, j, *Cp, *Ci, n, m, *Ap, *Ai, *w ; 6 | double *Cx, *Ax ; 7 | cs *C ; 8 | if (!CS_CSC (A)) return (NULL) ; /* check inputs */ 9 | m = A->m ; n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ; 10 | C = cs_spalloc (n, m, Ap [n], values && Ax, 0) ; /* allocate result */ 11 | w = cs_calloc (m, sizeof (int)) ; /* get workspace */ 12 | if (!C || !w) return (cs_done (C, w, NULL, 0)) ; /* out of memory */ 13 | Cp = C->p ; Ci = C->i ; Cx = C->x ; 14 | for (p = 0 ; p < Ap [n] ; p++) w [Ai [p]]++ ; /* row counts */ 15 | cs_cumsum (Cp, w, m) ; /* row pointers */ 16 | for (j = 0 ; j < n ; j++) 17 | { 18 | for (p = Ap [j] ; p < Ap [j+1] ; p++) 19 | { 20 | Ci [q = w [Ai [p]]++] = j ; /* place A(i,j) as entry C(j,i) */ 21 | if (Cx) Cx [q] = Ax [p] ; 22 | } 23 | } 24 | return (cs_done (C, w, NULL, 1)) ; /* success; free w and return C */ 25 | } 26 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_usolve.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* solve Ux=b where x and b are dense. x=b on input, solution on output. */ 3 | int cs_usolve (const cs *U, double *x) 4 | { 5 | int p, j, n, *Up, *Ui ; 6 | double *Ux ; 7 | if (!CS_CSC (U) || !x) return (0) ; /* check inputs */ 8 | n = U->n ; Up = U->p ; Ui = U->i ; Ux = U->x ; 9 | for (j = n-1 ; j >= 0 ; j--) 10 | { 11 | x [j] /= Ux [Up [j+1]-1] ; 12 | for (p = Up [j] ; p < Up [j+1]-1 ; p++) 13 | { 14 | x [Ui [p]] -= Ux [p] * x [j] ; 15 | } 16 | } 17 | return (1) ; 18 | } 19 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/cs_utsolve.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* solve U'x=b where x and b are dense. x=b on input, solution on output. */ 3 | int cs_utsolve (const cs *U, double *x) 4 | { 5 | int p, j, n, *Up, *Ui ; 6 | double *Ux ; 7 | if (!CS_CSC (U) || !x) return (0) ; /* check inputs */ 8 | n = U->n ; Up = U->p ; Ui = U->i ; Ux = U->x ; 9 | for (j = 0 ; j < n ; j++) 10 | { 11 | for (p = Up [j] ; p < Up [j+1]-1 ; p++) 12 | { 13 | x [j] -= Ux [p] * x [Ui [p]] ; 14 | } 15 | x [j] /= Ux [Up [j+1]-1] ; 16 | } 17 | return (1) ; 18 | } 19 | -------------------------------------------------------------------------------- /gaps/pkgs/CSparse/foo: -------------------------------------------------------------------------------- 1 | # Modify the "-O" optimization option for best performance (-O3 on Linux): 2 | CC = gcc 3 | CFLAGS = -O 4 | 5 | AR = ar cr 6 | RANLIB = ranlib 7 | 8 | all: libcsparse.a 9 | 10 | CS = cs_add.o cs_amd.o cs_chol.o cs_cholsol.o cs_counts.o cs_cumsum.o \ 11 | cs_droptol.o cs_dropzeros.o cs_dupl.o cs_entry.o \ 12 | cs_etree.o cs_fkeep.o cs_gaxpy.o cs_happly.o cs_house.o cs_ipvec.o \ 13 | cs_lsolve.o cs_ltsolve.o cs_lu.o cs_lusol.o cs_util.o cs_multiply.o \ 14 | cs_permute.o cs_pinv.o cs_post.o cs_pvec.o cs_qr.o cs_qrsol.o \ 15 | cs_scatter.o cs_schol.o cs_sqr.o cs_symperm.o cs_tdfs.o cs_malloc.o \ 16 | cs_transpose.o cs_compress.o cs_usolve.o cs_utsolve.o cs_scc.o \ 17 | cs_maxtrans.o cs_dmperm.o cs_updown.o cs_print.o cs_norm.o cs_load.o \ 18 | cs_dfs.o cs_reach.o cs_spsolve.o cs_ereach.o cs_leaf.o cs_randperm.o 19 | 20 | $(CS): cs.h Makefile 21 | 22 | %.o: %.c cs.h 23 | $(CC) $(CFLAGS) -c $< 24 | 25 | libcsparse.a: $(CS) 26 | $(AR) libcsparse.a $(CS) 27 | $(RANLIB) libcsparse.a 28 | 29 | clean: 30 | rm -f *.o 31 | 32 | purge: distclean 33 | 34 | distclean: clean 35 | rm -f *.a 36 | -------------------------------------------------------------------------------- /gaps/pkgs/FET/FET.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for FET module */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "FET.h" 8 | 9 | 10 | 11 | /* Private variables */ 12 | 13 | static int FET_active_count = 0; 14 | 15 | 16 | 17 | int R3InitFET(void) 18 | { 19 | // Check whether are already initialized 20 | if ((FET_active_count++) > 0) return TRUE; 21 | 22 | // Initialize dependencies 23 | if (!R3InitShapes()) return FALSE; 24 | 25 | // return OK status 26 | return TRUE; 27 | } 28 | 29 | 30 | 31 | void R3StopFET(void) 32 | { 33 | // Check whether have been initialized 34 | if ((--FET_active_count) > 0) return; 35 | 36 | // Stop dependencies 37 | R3StopShapes(); 38 | } 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /gaps/pkgs/FET/FET.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////// 2 | // Package include files 3 | //////////////////////////////////////////////////////////////////////// 4 | 5 | #include "RNMath/RNMath.h" 6 | #include "R3Shapes/R3Shapes.h" 7 | 8 | 9 | 10 | //////////////////////////////////////////////////////////////////////// 11 | // icpview class declarations 12 | //////////////////////////////////////////////////////////////////////// 13 | 14 | struct FETDescriptor; 15 | struct FETFeature; 16 | struct FETCorrespondence; 17 | struct FETShape; 18 | struct FETMatch; 19 | struct FETReconstruction; 20 | 21 | 22 | 23 | //////////////////////////////////////////////////////////////////////// 24 | // icpview include files 25 | //////////////////////////////////////////////////////////////////////// 26 | 27 | #include "FETDescriptor.h" 28 | #include "FETFeature.h" 29 | #include "FETCorrespondence.h" 30 | #include "FETShape.h" 31 | #include "FETMatch.h" 32 | #include "FETReconstruction.h" 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /gaps/pkgs/FET/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=FET 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp \ 14 | FETReconstruction.cpp \ 15 | FETMatch.cpp \ 16 | FETShape.cpp \ 17 | FETCorrespondence.cpp \ 18 | FETFeature.cpp \ 19 | FETDescriptor.cpp 20 | 21 | 22 | 23 | # 24 | # Include flags for optimization 25 | # 26 | 27 | #USER_CFLAGS=-I/usr/local/suitesparse -I/usr/local/include/eigen3 -DRN_USE_CERES -DRN_USE_MINPACK -DRN_USE_SPLM -DRN_USE_CSPARSE 28 | #USER_CFLAGS=-I/usr/include/suitesparse -I/usr/include/eigen3 -DRN_USE_CERES -DRN_USE_MINPACK -DRN_USE_SPLM -DRN_USE_CSPARSE 29 | USER_CFLAGS=-DRN_USE_CSPARSE -DRN_USE_SPLM 30 | 31 | 32 | 33 | # 34 | # Dependencies 35 | # 36 | 37 | PKG_DEPENDENCIES=R3Shapes R2Shapes RNMath RNBasics 38 | 39 | 40 | 41 | # 42 | # PKG makefile 43 | # 44 | 45 | include ../../makefiles/Makefile.pkgs 46 | 47 | 48 | -------------------------------------------------------------------------------- /gaps/pkgs/PDB/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=PDB 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp \ 14 | PDBElement.cpp PDBAminoAcid.cpp \ 15 | PDBAtom.cpp PDBResidue.cpp PDBChain.cpp PDBModel.cpp PDBFile.cpp \ 16 | PDBBond.cpp PDBAtomTypes.cpp PDBUtil.cpp PDBDistance.cpp 17 | 18 | 19 | 20 | # 21 | # Dependencies 22 | # 23 | 24 | PKG_DEPENDENCIES = R3Shapes R2Shapes RNBasics 25 | 26 | 27 | 28 | # 29 | # PKG makefile 30 | # 31 | 32 | include ../../makefiles/Makefile.pkgs 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /gaps/pkgs/PDB/PDB.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for PDB package */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "PDB.h" 8 | 9 | 10 | 11 | // Global variables 12 | 13 | RNMark PDBmark = 1; 14 | 15 | 16 | 17 | /* Private variables */ 18 | 19 | static int PDBactive_count = 0; 20 | 21 | 22 | 23 | int PDBInit(void) 24 | { 25 | // Check whether are already initialized 26 | if ((PDBactive_count++) > 0) return TRUE; 27 | 28 | // Initialize submodules 29 | // ??? 30 | 31 | // Return OK status 32 | return TRUE; 33 | } 34 | 35 | 36 | 37 | void PDBStop(void) 38 | { 39 | // Check whether have been initialized 40 | if ((--PDBactive_count) > 0) return; 41 | 42 | // Stop submodules 43 | // ??? 44 | } 45 | 46 | 47 | 48 | void PDBClearMarks(void) 49 | { 50 | // Create new mark 51 | PDBmark++; 52 | } 53 | -------------------------------------------------------------------------------- /gaps/pkgs/PDB/PDBPick.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/gaps/pkgs/PDB/PDBPick.cpp -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=R2Shapes 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | CCSRCS=R2Shapes.cpp \ 14 | R2Draw.cpp R2Io.cpp R2Kdtree.cpp \ 15 | R2Dist.cpp R2Cont.cpp R2Isect.cpp R2Parall.cpp R2Perp.cpp R2Relate.cpp R2Align.cpp \ 16 | R2Grid.cpp \ 17 | R2Polyline.cpp R2Arc.cpp R2Curve.cpp \ 18 | R2Polygon.cpp R2Circle.cpp R2Box.cpp R2Solid.cpp \ 19 | R2Shape.cpp \ 20 | R2Affine.cpp R2Xform.cpp R2Crdsys.cpp R2Diad.cpp R3Matrix.cpp \ 21 | R2Halfspace.cpp R2Span.cpp R2Ray.cpp R2Line.cpp R2Point.cpp R2Vector.cpp \ 22 | R2Image.cpp 23 | 24 | 25 | # 26 | # Dependencies 27 | # 28 | 29 | PKG_DEPENDENCIES = RNBasics jpeg png 30 | 31 | 32 | 33 | # 34 | # PKG makefile 35 | # 36 | 37 | include ../../makefiles/Makefile.pkgs 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Curve.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R2 curve class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R2Shapes/R2Shapes.h" 8 | 9 | 10 | 11 | /* Public functions */ 12 | 13 | int 14 | R2InitCurve() 15 | { 16 | /* Return success */ 17 | return TRUE; 18 | } 19 | 20 | 21 | 22 | void 23 | R2StopCurve() 24 | { 25 | } 26 | 27 | 28 | 29 | R2Curve:: 30 | R2Curve(void) 31 | { 32 | } 33 | 34 | 35 | 36 | R2Curve:: 37 | ~R2Curve(void) 38 | { 39 | } 40 | 41 | 42 | 43 | const RNBoolean R2Curve:: 44 | IsCurve(void) const 45 | { 46 | // All curve shapes are curves 47 | return TRUE; 48 | } 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Curve.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R2 curve class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R2InitCurve(); 8 | void R2StopCurve(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R2Curve : public R2Shape { 15 | public: 16 | // Constructors/destructors ??? 17 | R2Curve(void); 18 | ~R2Curve(void); 19 | 20 | // Shape property functions/operators 21 | const RNBoolean IsCurve(void) const; 22 | 23 | // Curve property functions/operators 24 | // virtual const R2Point Start(void) const = 0; 25 | // virtual const R2Point End(void) const = 0; 26 | }; 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Draw.h: -------------------------------------------------------------------------------- 1 | /* Include file for R2 draw utility */ 2 | 3 | 4 | 5 | inline void 6 | R2LoadPoint(const R2Point& point) 7 | { 8 | // Load vertex 9 | R2LoadPoint(point.Coords()); 10 | } 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Io.h: -------------------------------------------------------------------------------- 1 | /* Include file for input/output utility */ 2 | 3 | 4 | 5 | /* Function declarations */ 6 | 7 | RNArray *R2ReadSpans(RNArray& spans, const char *filename); 8 | RNArray *R2ReadWiseFile(RNArray& spans, const char *filename); 9 | RNArray *R2ReadXFigFile(RNArray& spans, const char *filename); 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Relate.h: -------------------------------------------------------------------------------- 1 | /* Include file for R2 miscelleaneous relationship utility */ 2 | 3 | 4 | 5 | /* Miscellaneous relationship function declarations */ 6 | 7 | RNAngle R2InteriorAngle(const R2Vector& vector1, const R2Vector& vector2); 8 | RNAngle R2InteriorAngle(const R2Vector& vector, const R2Line& line); 9 | RNAngle R2InteriorAngle(const R2Vector& vector, const R2Ray& ray); 10 | RNAngle R2InteriorAngle(const R2Vector& vector, const R2Span& span); 11 | 12 | RNArea R2IntersectionArea(const R2Box& box1, const R2Box& box2); 13 | RNArea R2IntersectionArea(const R2Circle& circle1, const R2Circle& circle2); 14 | 15 | RNBoolean R2Abuts(const R2Box& box1, const R2Box& box2); 16 | 17 | int R2Splits(const R2Line& line, const R2Span& span); 18 | int R2Splits(const R2Line& line, const R2Span& span, R2Span *below_result, R2Span *above_result = NULL); 19 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Shape.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R2 shape class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R2Shapes/R2Shapes.h" 8 | 9 | 10 | 11 | /* Public draw flags */ 12 | 13 | const R2DrawFlags R2_EDGES_DRAW_FLAG (0x001); 14 | const R2DrawFlags R2_SURFACES_DRAW_FLAG (0x002); 15 | const R2DrawFlags R2_NULL_DRAW_FLAGS (0x000); 16 | const R2DrawFlags R2_EVERYTHING_DRAW_FLAGS (0xFFF); 17 | const R2DrawFlags R2_DEFAULT_DRAW_FLAGS (R2_EVERYTHING_DRAW_FLAGS); 18 | 19 | 20 | 21 | /* Public functions */ 22 | 23 | int 24 | R2InitShape() 25 | { 26 | /* Return success */ 27 | return TRUE; 28 | } 29 | 30 | 31 | 32 | void 33 | R2StopShape() 34 | { 35 | } 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Shapes.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS shapes module */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R2Shapes.h" 8 | 9 | 10 | 11 | /* Private variables */ 12 | 13 | static int R2shapes_active_count = 0; 14 | 15 | 16 | 17 | int R2InitShapes(void) 18 | { 19 | // Check whether are already initialized 20 | if ((R2shapes_active_count++) > 0) return TRUE; 21 | 22 | // Initialize dependencies 23 | if (!RNInitBasics()) return FALSE; 24 | 25 | // Initialize submodules 26 | if (!R2InitCircle()) return FALSE; 27 | 28 | // return OK status 29 | return TRUE; 30 | } 31 | 32 | 33 | 34 | void R2StopShapes(void) 35 | { 36 | // Check whether have been initialized 37 | if ((--R2shapes_active_count) > 0) return; 38 | 39 | // Stop submodules 40 | R2StopCircle(); 41 | 42 | // Stop dependencies 43 | RNStopBasics(); 44 | } 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Solid.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R2 solid class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R2Shapes/R2Shapes.h" 8 | 9 | 10 | 11 | /* Public functions */ 12 | 13 | int 14 | R2InitSolid() 15 | { 16 | /* Return success */ 17 | return TRUE; 18 | } 19 | 20 | 21 | 22 | void 23 | R2StopSolid() 24 | { 25 | } 26 | 27 | 28 | 29 | R2Solid:: 30 | R2Solid(void) 31 | { 32 | } 33 | 34 | 35 | 36 | R2Solid:: 37 | ~R2Solid(void) 38 | { 39 | } 40 | 41 | 42 | 43 | const RNBoolean R2Solid:: 44 | IsSolid(void) const 45 | { 46 | // All solid shapes are solids 47 | return TRUE; 48 | } 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Solid.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R2 solid class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R2InitSolid(); 8 | void R2StopSolid(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R2Solid : public R2Shape { 15 | public: 16 | // Constructors/destructors ??? 17 | R2Solid(void); 18 | ~R2Solid(void); 19 | 20 | // Shape property functions/operators 21 | const RNBoolean IsSolid(void) const; 22 | }; 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Graphics/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=R3Graphics 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp \ 14 | R3Scene.cpp R3SceneNode.cpp R3SceneElement.cpp R3SceneReference.cpp \ 15 | R3Viewer.cpp R3Frustum.cpp R3Camera.cpp R2Viewport.cpp \ 16 | R3AreaLight.cpp R3SpotLight.cpp R3PointLight.cpp R3DirectionalLight.cpp R3Light.cpp \ 17 | R3Material.cpp R3Brdf.cpp R2Texture.cpp 18 | 19 | 20 | 21 | # 22 | # Dependencies 23 | # 24 | 25 | PKG_DEPENDENCIES = R3Shapes R2Shapes RNBasics 26 | 27 | 28 | 29 | # 30 | # PKG makefile 31 | # 32 | 33 | include ../../makefiles/Makefile.pkgs 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Graphics/R3Graphics.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS graphics module */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Graphics.h" 8 | 9 | 10 | 11 | /* Private variables */ 12 | 13 | static int R3graphics_active_count = 0; 14 | 15 | 16 | 17 | int R3InitGraphics(void) 18 | { 19 | // Check whether are already initialized 20 | if ((R3graphics_active_count++) > 0) return TRUE; 21 | 22 | // Initialize dependencies 23 | if (!R3InitShapes()) return FALSE; 24 | 25 | // Initialize submodules 26 | if (!R3InitMaterial()) return FALSE; 27 | 28 | // return OK status 29 | return TRUE; 30 | } 31 | 32 | 33 | 34 | void R3StopGraphics(void) 35 | { 36 | // Check whether have been initialized 37 | if ((--R3graphics_active_count) > 0) return; 38 | 39 | // Stop submodules 40 | R3StopMaterial(); 41 | 42 | // Stop dependencies 43 | R3StopShapes(); 44 | } 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Base.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS basics */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Shapes/R3Shapes.h" 8 | 9 | 10 | 11 | 12 | /* Public draw flags */ 13 | 14 | #if FALSE 15 | 16 | const R3DrawFlags R3_EDGES_DRAW_FLAG (0x001); 17 | const R3DrawFlags R3_SURFACES_DRAW_FLAG (0x002); 18 | const R3DrawFlags R3_SURFACE_NORMALS_DRAW_FLAG (0x010); 19 | const R3DrawFlags R3_SURFACE_TEXTURE_DRAW_FLAG (0x020); 20 | const R3DrawFlags R3_VERTEX_NORMALS_DRAW_FLAG (0x100); 21 | const R3DrawFlags R3_VERTEX_TEXTURE_COORDS_DRAW_FLAG (0x200); 22 | 23 | const R3DrawFlags R3_NULL_DRAW_FLAGS (0x000); 24 | const R3DrawFlags R3_EVERYTHING_DRAW_FLAGS (0xFFF); 25 | const R3DrawFlags R3_DEFAULT_DRAW_FLAGS (R3_EVERYTHING_DRAW_FLAGS & 26 | ~R3_VERTEX_TEXTURE_COORDS_DRAW_FLAG & 27 | ~R3_EDGES_DRAW_FLAG); 28 | #endif 29 | 30 | 31 | 32 | int R3InitBase() 33 | { 34 | /* Return OK status */ 35 | return TRUE; 36 | } 37 | 38 | 39 | 40 | void R3StopBase() 41 | { 42 | } 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Base.h: -------------------------------------------------------------------------------- 1 | /* Include file for GAPS basic stuff */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R3InitBase(); 8 | void R3StopBase(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R3Base {}; 15 | 16 | 17 | 18 | /* Draw flags definition */ 19 | 20 | typedef RNFlags R3DrawFlags; 21 | #define R3_NULL_DRAW_FLAGS (0x000) 22 | #define R3_EDGES_DRAW_FLAG (0x001) 23 | #define R3_SURFACES_DRAW_FLAG (0x002) 24 | #define R3_SURFACE_NORMALS_DRAW_FLAG (0x010) 25 | #define R3_SURFACE_TEXTURE_DRAW_FLAG (0x020) 26 | #define R3_SURFACE_MATERIAL_DRAW_FLAG (0x040) 27 | #define R3_VERTEX_NORMALS_DRAW_FLAG (0x100) 28 | #define R3_VERTEX_TEXTURE_COORDS_DRAW_FLAG (0x200) 29 | #define R3_VERTEX_COLORS_DRAW_FLAG (0x400) 30 | #define R3_EVERYTHING_DRAW_FLAGS (0x773) 31 | #define R3_DEFAULT_DRAW_FLAGS (R3_EVERYTHING_DRAW_FLAGS & ~R3_EDGES_DRAW_FLAG) 32 | 33 | #define R3_VERTEX_SHARED_FLAG (0x1000) 34 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Curve.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R3 curve class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R3InitCurve(); 8 | void R3StopCurve(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R3Curve : public R3Shape { 15 | public: 16 | // Constructors/destructors ??? 17 | R3Curve(void); 18 | virtual ~R3Curve(void); 19 | 20 | // Curve properties 21 | virtual const RNScalar StartParameter(void) const = 0; 22 | virtual const RNScalar EndParameter(void) const = 0; 23 | virtual const R3Point StartPosition(void) const; 24 | virtual const R3Point EndPosition(void) const; 25 | 26 | // Point access 27 | virtual R3Point PointPosition(RNScalar u) const = 0; 28 | virtual R3Vector PointDerivative(RNScalar u) const = 0; 29 | virtual R3Vector PointDirection(RNScalar u) const; 30 | 31 | // Shape property functions/operators 32 | const RNBoolean IsCurve(void) const; 33 | }; 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Draw.h: -------------------------------------------------------------------------------- 1 | /* Include file for R3 draw utility */ 2 | 3 | 4 | 5 | /* Inline macros */ 6 | 7 | #define R3LoadRgb RNLoadRgb 8 | 9 | 10 | 11 | /* Inline functions */ 12 | 13 | inline void 14 | R3LoadNormal(const R3Vector& normal) 15 | { 16 | // Load normal vector 17 | R3LoadNormal(normal.Coords()); 18 | } 19 | 20 | 21 | 22 | inline void 23 | R3LoadPoint(const R3Point& point) 24 | { 25 | // Load vertex 26 | R3LoadPoint(point.Coords()); 27 | } 28 | 29 | 30 | 31 | inline void 32 | R3LoadTextureCoords(const R2Point& texcoords) 33 | { 34 | // Set texture coordinate (within R3BeginXXX and R3EndXXX) 35 | R3LoadTextureCoords(texcoords.Coords()); 36 | } 37 | 38 | 39 | 40 | inline void 41 | R3DrawText(const R3Point& p, const char *str) 42 | { 43 | // Draw text at point 44 | R3DrawText(p.X(), p.Y(), p.Z(), str); 45 | } 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Relate.h: -------------------------------------------------------------------------------- 1 | /* Include file for R3 miscelleaneous relationship utility */ 2 | 3 | 4 | 5 | /* Miscellaneous relationship function declarations */ 6 | 7 | R3Point R3Interpolate(const R3Point& point1, const R3Point& point2, RNScalar t1, RNScalar t2, RNScalar t); 8 | 9 | RNAngle R3InteriorAngle(const R3Vector& vector1, const R3Vector& vector2); 10 | RNAngle R3InteriorAngle(const R3Vector& vector, const R3Line& line); 11 | RNAngle R3InteriorAngle(const R3Vector& vector, const R3Ray& ray); 12 | RNAngle R3InteriorAngle(const R3Vector& vector, const R3Span& span); 13 | RNAngle R3InteriorAngle(const R3Vector& vector, const R3Plane& plane); 14 | 15 | RNBoolean R3Abuts(const R3Box& box1, const R3Box& box2); 16 | 17 | int R3Splits(const R3Plane& plane, const R3Span& span); 18 | int R3Splits(const R3Plane& plane, const R3Span& span, R3Span *below_result, R3Span *above_result = NULL); 19 | int R3Splits(const R3Plane& plane, const R3Triangle& triangle); 20 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Shapes.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS shapes module */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Shapes.h" 8 | 9 | 10 | 11 | /* Public 3DR variables -- must be set by the application ??? */ 12 | 13 | #if (RN_3D_GRFX == RN_3DR) 14 | R3dHandle_t R3dr_rc = NULL; 15 | G3dHandle_t R3dr_gc = NULL; 16 | #endif 17 | 18 | 19 | 20 | /* Private variables */ 21 | 22 | static int R3shapes_active_count = 0; 23 | 24 | 25 | 26 | int R3InitShapes(void) 27 | { 28 | // Check whether are already initialized 29 | if ((R3shapes_active_count++) > 0) return TRUE; 30 | 31 | // Initialize dependencies 32 | if (!R2InitShapes()) return FALSE; 33 | 34 | // Initialize submodules 35 | if (!R3InitCircle()) return FALSE; 36 | 37 | // return OK status 38 | return TRUE; 39 | } 40 | 41 | 42 | 43 | void R3StopShapes(void) 44 | { 45 | // Check whether have been initialized 46 | if ((--R3shapes_active_count) > 0) return; 47 | 48 | // Stop submodules 49 | R3StopCircle(); 50 | 51 | // Stop dependencies 52 | R2StopShapes(); 53 | } 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Solid.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R3 solid class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Shapes/R3Shapes.h" 8 | 9 | 10 | 11 | /* Public functions */ 12 | 13 | int 14 | R3InitSolid() 15 | { 16 | /* Return success */ 17 | return TRUE; 18 | } 19 | 20 | 21 | 22 | void 23 | R3StopSolid() 24 | { 25 | } 26 | 27 | 28 | 29 | R3Solid:: 30 | R3Solid(void) 31 | { 32 | } 33 | 34 | 35 | 36 | R3Solid:: 37 | ~R3Solid(void) 38 | { 39 | } 40 | 41 | 42 | 43 | const RNBoolean R3Solid:: 44 | IsSolid(void) const 45 | { 46 | // All solid shapes are solids 47 | return TRUE; 48 | } 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Solid.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R3 solid class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R3InitSolid(); 8 | void R3StopSolid(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R3Solid : public R3Shape { 15 | public: 16 | // Constructors/destructors ??? 17 | R3Solid(void); 18 | ~R3Solid(void); 19 | 20 | // Shape property functions/operators 21 | const RNBoolean IsSolid(void) const; 22 | }; 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Surface.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R3 surface class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Shapes/R3Shapes.h" 8 | 9 | 10 | 11 | /* Public functions */ 12 | 13 | int 14 | R3InitSurface() 15 | { 16 | /* Return success */ 17 | return TRUE; 18 | } 19 | 20 | 21 | 22 | void 23 | R3StopSurface() 24 | { 25 | } 26 | 27 | 28 | 29 | R3Surface:: 30 | R3Surface(void) 31 | { 32 | } 33 | 34 | 35 | 36 | R3Surface:: 37 | ~R3Surface(void) 38 | { 39 | } 40 | 41 | 42 | 43 | const RNBoolean R3Surface:: 44 | IsSurface(void) const 45 | { 46 | // All surface shapes are surfaces 47 | return TRUE; 48 | } 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Surface.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R3 surface class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R3InitSurface(); 8 | void R3StopSurface(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R3Surface : public R3Shape { 15 | public: 16 | // Constructors/destructors ??? 17 | R3Surface(void); 18 | ~R3Surface(void); 19 | 20 | // Shape property functions/operators 21 | const RNBoolean IsSurface(void) const; 22 | }; 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Surfels/R3Surfels.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS surfels module */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Surfels.h" 8 | 9 | 10 | 11 | /* Private variables */ 12 | 13 | static int R3surfels_active_count = 0; 14 | 15 | 16 | 17 | int R3InitSurfels(void) 18 | { 19 | // Check whether are already initialized 20 | if ((R3surfels_active_count++) > 0) return TRUE; 21 | 22 | // Initialize dependencies 23 | if (!R3InitShapes()) return FALSE; 24 | 25 | // return OK status 26 | return TRUE; 27 | } 28 | 29 | 30 | 31 | void R3StopSurfels(void) 32 | { 33 | // Check whether have been initialized 34 | if ((--R3surfels_active_count) > 0) return; 35 | 36 | // Stop dependencies 37 | R3StopShapes(); 38 | } 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /gaps/pkgs/RGBD/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=RGBD 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | CCSRCS=RGBD.cpp \ 14 | RGBDSegmentation.cpp \ 15 | RGBDTransform.cpp \ 16 | RGBDConfiguration.cpp \ 17 | RGBDSurface.cpp RGBDImage.cpp \ 18 | RGBDCamera.cpp RGBDUtil.cpp 19 | 20 | 21 | # 22 | # Dependencies 23 | # 24 | 25 | PKG_DEPENDENCIES = R3Shapes R2Shapes RNBasics jpeg png 26 | 27 | 28 | 29 | # 30 | # PKG makefile 31 | # 32 | 33 | include ../../makefiles/Makefile.pkgs 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /gaps/pkgs/RGBD/RGBD.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS rgbd module */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "RGBD.h" 8 | 9 | 10 | 11 | /* Private variables */ 12 | 13 | static int RGBD_active_count = 0; 14 | 15 | 16 | 17 | int R2InitShapes(void) 18 | { 19 | // Check whether are already initialized 20 | if ((RGBD_active_count++) > 0) return TRUE; 21 | 22 | // Initialize dependencies 23 | if (!R3InitShapes()) return FALSE; 24 | 25 | // return OK status 26 | return TRUE; 27 | } 28 | 29 | 30 | 31 | void R2StopShapes(void) 32 | { 33 | // Check whether have been initialized 34 | if ((--RGBD_active_count) > 0) return; 35 | 36 | // Stop dependencies 37 | R3StopShapes(); 38 | } 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=RNBasics 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp \ 14 | RNTime.cpp \ 15 | RNGrfx.cpp RNRgb.cpp \ 16 | RNMap.cpp RNHeap.cpp RNQueue.cpp RNArray.cpp \ 17 | RNSvd.cpp RNIntval.cpp RNScalar.cpp \ 18 | RNType.cpp \ 19 | RNFlags.cpp \ 20 | RNFile.cpp RNMem.cpp \ 21 | RNError.cpp \ 22 | RNBase.cpp \ 23 | json.cpp 24 | 25 | 26 | 27 | # 28 | # PKG makefile 29 | # 30 | 31 | include ../../makefiles/Makefile.pkgs 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNBase.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS base class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "RNBasics.h" 8 | 9 | 10 | 11 | /* Global variables */ 12 | 13 | RNMark RNmark = 1; 14 | 15 | 16 | 17 | int RNInitBase() 18 | { 19 | /* Return OK status */ 20 | return TRUE; 21 | } 22 | 23 | 24 | 25 | void RNStopBase() 26 | { 27 | } 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNBase.h: -------------------------------------------------------------------------------- 1 | /* Include file for GAPS basics */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int RNInitBase(); 8 | void RNStopBase(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class RNBase {}; 15 | 16 | 17 | 18 | /* TRUE/FALSE constant definitions */ 19 | 20 | typedef int RNBoolean; 21 | #ifndef TRUE 22 | #define TRUE 1 23 | #endif 24 | #ifndef FALSE 25 | #define FALSE 0 26 | #endif 27 | 28 | 29 | 30 | /* Programming convenience macros */ 31 | 32 | #define brcase break; case 33 | 34 | 35 | 36 | /* Standard types */ 37 | 38 | typedef int RNMark; 39 | 40 | 41 | 42 | /* Global variables */ 43 | 44 | extern RNMark RNmark; 45 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNBasics.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS basics module */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "RNBasics.h" 8 | 9 | 10 | 11 | /* Private variables */ 12 | 13 | static int RNbasics_active_count = 0; 14 | 15 | 16 | 17 | int RNInitBasics(void) 18 | { 19 | // Check whether are already initialized 20 | if ((RNbasics_active_count++) > 0) return TRUE; 21 | 22 | // Initialize submodules 23 | RNSeedRandomScalar(); 24 | 25 | // Return OK status 26 | return TRUE; 27 | } 28 | 29 | 30 | 31 | void RNStopBasics(void) 32 | { 33 | // Check whether have been initialized 34 | if ((--RNbasics_active_count) > 0) return; 35 | 36 | // Stop submodules 37 | // ??? 38 | } 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNError.h: -------------------------------------------------------------------------------- 1 | /* Include file for GAPS error utility */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int RNInitError(); 8 | void RNStopError(); 9 | 10 | 11 | 12 | /* Error file functions */ 13 | 14 | void RNSetErrorFile(FILE *fp); 15 | void RNSetErrorLevel(int level); 16 | 17 | 18 | 19 | /* Error reporting functions */ 20 | 21 | void RNAbort(const char *fmt, ...); 22 | void RNFail(const char *fmt, ...); 23 | void RNWarning(const char *fmt, ...); 24 | 25 | 26 | 27 | /* Define my own assert function */ 28 | 29 | #ifdef assert 30 | # undef assert 31 | #endif 32 | 33 | #ifdef NDEBUG 34 | #define assert(__x__) 35 | #else 36 | #define assert(__x__) \ 37 | if (!(__x__)) RNAbort("Assertion error %s at line %d in file %s", #__x__, __LINE__, __FILE__) 38 | #endif 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNExtern.h: -------------------------------------------------------------------------------- 1 | /* Include file for external stuff */ 2 | 3 | 4 | 5 | /* Usual C include files */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | 17 | 18 | /* Standard library include files */ 19 | 20 | #include 21 | #include 22 | 23 | 24 | 25 | /* Machine dependent include files */ 26 | 27 | #if (RN_OS == RN_WINDOWS) 28 | # include 29 | # include 30 | #else 31 | # include 32 | # include 33 | # include 34 | #endif 35 | 36 | 37 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNFile.h: -------------------------------------------------------------------------------- 1 | // Include file for file management utilities 2 | 3 | 4 | 5 | //////////////////////////////////////////////////////////////////////// 6 | // File existance funcitons 7 | //////////////////////////////////////////////////////////////////////// 8 | 9 | RNBoolean RNFileExists(const char *filename); 10 | 11 | 12 | 13 | //////////////////////////////////////////////////////////////////////// 14 | // File seek funcitons 15 | //////////////////////////////////////////////////////////////////////// 16 | 17 | int RNFileSeek(FILE *fp, unsigned long long offset, int whence); 18 | unsigned long long RNFileTell(FILE *fp); 19 | 20 | 21 | 22 | //////////////////////////////////////////////////////////////////////// 23 | // File seek constants 24 | //////////////////////////////////////////////////////////////////////// 25 | 26 | #define RN_FILE_SEEK_SET SEEK_SET 27 | #define RN_FILE_SEEK_CUR SEEK_CUR 28 | #define RN_FILE_SEEK_END SEEK_END 29 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNFlags.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the GAPS flags class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "RNBasics.h" 8 | 9 | 10 | 11 | /* Public functions */ 12 | 13 | int 14 | RNInitFlags() 15 | { 16 | /* Return success */ 17 | return TRUE; 18 | } 19 | 20 | 21 | 22 | void 23 | RNStopFlags() 24 | { 25 | } 26 | 27 | 28 | 29 | RNFlags:: 30 | RNFlags(void) 31 | : flags(0) 32 | { 33 | } 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNMem.h: -------------------------------------------------------------------------------- 1 | /* Include file for GAPS mem utility */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int RNInitMem(); 8 | void RNStopMem(); 9 | 10 | 11 | 12 | /* Memory allocation/deallocation functions */ 13 | 14 | #if FALSE 15 | 16 | void *operator new(size_t size); 17 | void *operator new(size_t size, size_t extra); 18 | void operator delete(void *data); 19 | 20 | #endif 21 | 22 | 23 | 24 | /* Standard memory manipulation functions */ 25 | 26 | #define RN_SWAP_BUFFER_SIZE 1024 27 | void RNSwap(void *node1, void *node2, void *buffer, int size); 28 | void RNCopy(const void *src, void *dst, int size); 29 | void RNZero(void *data, int size); 30 | int RNCompare(const void *src1, const void *src2, int size); 31 | 32 | 33 | 34 | /* Memory usage statistics */ 35 | 36 | long RNMaxMemoryUsage(void); 37 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNSvd.h: -------------------------------------------------------------------------------- 1 | // Include file for SVD functions 2 | 3 | 4 | 5 | // Function to perform singular value decomposition 6 | 7 | extern void RNSvdDecompose(int m, int n, 8 | const RNScalar *a, 9 | RNScalar *u, RNScalar *w, RNScalar *vt); 10 | 11 | 12 | 13 | // Function to perform back substitution 14 | 15 | extern void RNSvdBacksubstitute(int m, int n, 16 | const RNScalar *u, const RNScalar *w, const RNScalar *vt, const RNScalar *b, 17 | RNScalar *x, RNScalar eps = RN_EPSILON); 18 | 19 | 20 | 21 | // Function to solve system of equations by SVD and back substitution 22 | 23 | extern void RNSvdSolve(int m, int n, 24 | const RNScalar *a, const RNScalar *b, 25 | RNScalar *x, RNScalar eps = RN_EPSILON); 26 | 27 | -------------------------------------------------------------------------------- /gaps/pkgs/RNMath/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=RNMath 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp \ 14 | RNPolynomial.cpp RNAlgebraic.cpp RNEquation.cpp RNSystemOfEquations.cpp \ 15 | RNDenseLUMatrix.cpp RNDenseMatrix.cpp RNMatrix.cpp \ 16 | RNVector.cpp 17 | 18 | 19 | # 20 | # Dependencies 21 | # 22 | 23 | PKG_DEPENDENCIES = RNBasics 24 | 25 | 26 | 27 | # 28 | # PKG makefile 29 | # 30 | 31 | include ../../makefiles/Makefile.pkgs 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /gaps/pkgs/RNMath/RNDenseLUMatrix.h: -------------------------------------------------------------------------------- 1 | // Include file for abstract matrix class 2 | 3 | 4 | 5 | // Class definition 6 | 7 | class RNDenseLUMatrix : public RNDenseMatrix { 8 | public: 9 | // Constructor/destructor 10 | RNDenseLUMatrix(void); 11 | RNDenseLUMatrix(int nrows, int ncols, RNScalar *values = NULL); 12 | RNDenseLUMatrix(const RNDenseLUMatrix& matrix); 13 | RNDenseLUMatrix(const RNDenseMatrix& matrix); 14 | RNDenseLUMatrix(const RNMatrix& matrix); 15 | virtual ~RNDenseLUMatrix(void); 16 | 17 | // Property functions/operators 18 | virtual RNScalar Determinant(void) const; 19 | virtual RNDenseMatrix Inverse(void) const; 20 | 21 | // Factoring functions/operations 22 | int DecomposeLU(RNDenseMatrix& L, RNDenseMatrix& U) const; 23 | 24 | protected: 25 | // Utility functions 26 | void Decompose(void); 27 | void BackSubstitute(RNDenseMatrix &b, RNDenseMatrix &x) const; 28 | 29 | private: 30 | int *pivots; 31 | }; 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /gaps/pkgs/RNMath/RNMath.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS math module */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "RNMath.h" 8 | 9 | 10 | 11 | /* Private variables */ 12 | 13 | static int RNmath_active_count = 0; 14 | 15 | 16 | 17 | int RNInitMath(void) 18 | { 19 | // Check whether are already initialized 20 | if ((RNmath_active_count++) > 0) return TRUE; 21 | 22 | // Initialize submodules 23 | RNSeedRandomScalar(); 24 | 25 | // Return OK status 26 | return TRUE; 27 | } 28 | 29 | 30 | 31 | void RNStopMath(void) 32 | { 33 | // Check whether have been initialized 34 | if ((--RNmath_active_count) > 0) return; 35 | 36 | // Stop submodules 37 | // ??? 38 | } 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /gaps/pkgs/RNMath/RNMath.h: -------------------------------------------------------------------------------- 1 | // Include file for RNMath package 2 | 3 | #ifndef __RN__MATH__H__ 4 | #define __RN__MATH__H__ 5 | 6 | 7 | 8 | 9 | // Dependency include files 10 | 11 | #include "RNBasics/RNBasics.h" 12 | 13 | 14 | 15 | // Declarations 16 | 17 | class RNVector; 18 | class RNMatrix; 19 | class RNDenseMatrix; 20 | class RNPolynomial; 21 | class RNPolynomialTerm; 22 | class RNAlgebraic; 23 | typedef RNAlgebraic RNExpression; 24 | class RNEquation; 25 | class RNSystemOfEquations; 26 | 27 | 28 | 29 | // Matrix classes 30 | 31 | #include "RNMath/RNLapack.h" 32 | #include "RNMath/RNVector.h" 33 | #include "RNMath/RNMatrix.h" 34 | #include "RNMath/RNDenseMatrix.h" 35 | #include "RNMath/RNDenseLUMatrix.h" 36 | 37 | 38 | // Expression and equation classes 39 | 40 | #include "RNMath/RNPolynomial.h" 41 | #include "RNMath/RNAlgebraic.h" 42 | #include "RNMath/RNEquation.h" 43 | #include "RNMath/RNSystemOfEquations.h" 44 | 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /gaps/pkgs/RNMath/RNMatrix.cpp: -------------------------------------------------------------------------------- 1 | // Source file for abstract matrix class 2 | 3 | 4 | // Include files 5 | 6 | #include "RNMath.h" 7 | 8 | 9 | 10 | RNMatrix:: 11 | RNMatrix(void) 12 | { 13 | } 14 | 15 | 16 | 17 | RNMatrix:: 18 | RNMatrix(const RNMatrix& matrix) 19 | { 20 | } 21 | 22 | 23 | 24 | RNMatrix:: 25 | ~RNMatrix(void) 26 | { 27 | } 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /gaps/pkgs/RNMath/RNMatrix.h: -------------------------------------------------------------------------------- 1 | // Include file for abstract matrix class 2 | 3 | 4 | 5 | // Class definition 6 | 7 | class RNMatrix { 8 | public: 9 | // Constructor/destructor 10 | RNMatrix(void); 11 | RNMatrix(const RNMatrix& matrix); 12 | virtual ~RNMatrix(void); 13 | 14 | // Entry access 15 | virtual int NRows(void) const = 0; 16 | virtual int NColumns(void) const = 0; 17 | virtual RNScalar Value(int i, int j) const = 0; 18 | virtual void SetValue(int i, int j, RNScalar value) = 0; 19 | 20 | // Property functions/operators 21 | virtual RNBoolean IsDense(void) const = 0; 22 | virtual RNBoolean IsSparse(void) const = 0; 23 | }; 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /gaps/pkgs/fglut/AUTHORS: -------------------------------------------------------------------------------- 1 | Pawel W. Olszta 2 | the person to be blamed for freeglut 3 | 4 | Andreas Umbach 5 | the first person to contribute to the freeglut project, 6 | contributed the cube and sphere geometry code 7 | 8 | Steve Baker 9 | joystick code (from his great PLIB), numerous hints 10 | tips on the freeglut usability 11 | and for taking the project over when Pawel bowed out 12 | 13 | Christopher John Purnell 14 | Don Heyse 15 | Dave McClurg 16 | John F. Fay 17 | Norman Vine 18 | Daniel Wagner 19 | Sven Panne 20 | contributing the project, using the product, and generally keeping it going 21 | 22 | Brian Paul 23 | Eric Sandall 24 | giving us the oomph! to make an official release 25 | 26 | James 'J.C.' Jones 27 | designing the new website 28 | 29 | ...and all the opengl-gamedev-l people that made Pawel start this project :) 30 | -------------------------------------------------------------------------------- /gaps/pkgs/fglut/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for freeglut library 3 | # 4 | 5 | 6 | 7 | # 8 | # Package name and list of source files. 9 | # 10 | 11 | NAME=fglut 12 | FGLUT_CSRCS = \ 13 | freeglut_callbacks.c \ 14 | freeglut_cursor.c \ 15 | freeglut_display.c \ 16 | freeglut_ext.c \ 17 | freeglut_font.c \ 18 | freeglut_glutfont_definitions.c \ 19 | freeglut_font_data.c \ 20 | freeglut_stroke_roman.c \ 21 | freeglut_stroke_mono_roman.c \ 22 | freeglut_gamemode.c \ 23 | freeglut_geometry.c \ 24 | freeglut_init.c \ 25 | freeglut_input_devices.c \ 26 | freeglut_spaceball.c \ 27 | freeglut_joystick.c \ 28 | freeglut_main.c \ 29 | freeglut_menu.c \ 30 | freeglut_misc.c \ 31 | freeglut_overlay.c \ 32 | freeglut_state.c \ 33 | freeglut_structure.c \ 34 | freeglut_teapot.c \ 35 | freeglut_videoresize.c \ 36 | freeglut_window.c 37 | 38 | ifeq ("$(shell uname -s)", "Darwin") 39 | CSRCS = $(NAME).c 40 | else 41 | CSRCS=$(FGLUT_CSRCS) 42 | endif 43 | 44 | 45 | 46 | # 47 | # R3 library makefile 48 | # 49 | 50 | include ../../makefiles/Makefile.pkgs 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /gaps/pkgs/fglut/fglut.c: -------------------------------------------------------------------------------- 1 | // Source file for fglut package stand-in 2 | 3 | 4 | 5 | // These are never used. They are just dummy functions 6 | // to compile and link when the native glut is used, and 7 | // thus the rest of the code in the fglut package is not 8 | // compiled 9 | 10 | 11 | 12 | int R3InitGlut(void) 13 | { 14 | // return OK status 15 | return 1; 16 | } 17 | 18 | 19 | 20 | void R3StopGlut(void) 21 | { 22 | } 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /gaps/pkgs/fglut/fglut.h: -------------------------------------------------------------------------------- 1 | // OpenGL GLUT include file 2 | 3 | 4 | // External include files 5 | 6 | #ifdef __APPLE__ 7 | // Use the native glut on mac 8 | # include "GLUT/glut.h" 9 | #else 10 | // Use this implementation 11 | # include "fglut/glut.h" 12 | #endif 13 | 14 | 15 | 16 | /* Initialization functions */ 17 | 18 | int R3InitGlut(void); 19 | void R3StopGlut(void); 20 | 21 | -------------------------------------------------------------------------------- /gaps/pkgs/fglut/fglut.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fglut", "fglut.vcxproj", "{245FD70C-6B13-4581-B674-838551C69144}" 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 | {245FD70C-6B13-4581-B674-838551C69144}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {245FD70C-6B13-4581-B674-838551C69144}.Debug|Win32.Build.0 = Debug|Win32 14 | {245FD70C-6B13-4581-B674-838551C69144}.Release|Win32.ActiveCfg = Release|Win32 15 | {245FD70C-6B13-4581-B674-838551C69144}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /gaps/pkgs/fglut/freeglut.h: -------------------------------------------------------------------------------- 1 | #ifndef __FREEGLUT_H__ 2 | #define __FREEGLUT_H__ 3 | 4 | /* 5 | * freeglut.h 6 | * 7 | * The freeglut library include file 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 10 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 12 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | */ 16 | 17 | #include "freeglut_std.h" 18 | #include "freeglut_ext.h" 19 | 20 | /*** END OF FILE ***/ 21 | 22 | #endif /* __FREEGLUT_H__ */ 23 | -------------------------------------------------------------------------------- /gaps/pkgs/fglut/glut.h: -------------------------------------------------------------------------------- 1 | #ifndef __GLUT_H__ 2 | #define __GLUT_H__ 3 | 4 | /* 5 | * glut.h 6 | * 7 | * The freeglut library include file 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 10 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 12 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | */ 16 | 17 | #include "freeglut_std.h" 18 | 19 | /*** END OF FILE ***/ 20 | 21 | #endif /* __GLUT_H__ */ 22 | -------------------------------------------------------------------------------- /gaps/pkgs/gaps.h: -------------------------------------------------------------------------------- 1 | // Include file for gaps packages 2 | 3 | #ifndef __GAPS__H__ 4 | #define __GAPS__H__ 5 | 6 | 7 | // Include all packages 8 | 9 | #include "RNBasics/RNBasics.h" 10 | #include "R2Shapes/R2Shapes.h" 11 | #include "R3Shapes/R3Shapes.h" 12 | #include "R3Graphics/R3Graphics.h" 13 | 14 | 15 | #endif 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /gaps/pkgs/jpeg/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=jpeg 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | # library object files common to compression and decompression 14 | COMSRCS= jcomapi.c jutils.c jerror.c jmemmgr.c jmemnobs.c 15 | 16 | # compression library object files 17 | CLIBSRCS= jcapimin.c jcapistd.c jctrans.c jcparam.c \ 18 | jdatadst.c jcinit.c jcmaster.c jcmarker.c jcmainct.c \ 19 | jcprepct.c jccoefct.c jccolor.c jcsample.c jchuff.c \ 20 | jcphuff.c jcdctmgr.c jfdctfst.c jfdctflt.c \ 21 | jfdctint.c 22 | 23 | # decompression library object files 24 | DLIBSRCS= jdapimin.c jdapistd.c jdtrans.c jdatasrc.c \ 25 | jdmaster.c jdinput.c jdmarker.c jdhuff.c jdphuff.c \ 26 | jdmainct.c jdcoefct.c jdpostct.c jddctmgr.c \ 27 | jidctfst.c jidctflt.c jidctint.c jidctred.c \ 28 | jdsample.c jdcolor.c jquant1.c jquant2.c jdmerge.c 29 | 30 | # JPEG library source files 31 | CSRCS=$(CLIBSRCS) $(DLIBSRCS) $(COMSRCS) 32 | 33 | 34 | 35 | # 36 | # GAPS library makefile 37 | # 38 | 39 | include ../../makefiles/Makefile.pkgs 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /gaps/pkgs/jpeg/jconfig.h: -------------------------------------------------------------------------------- 1 | /* jconfig.h. Generated automatically by configure. */ 2 | /* jconfig.cfg --- source file edited by configure script */ 3 | /* see jconfig.doc for explanations */ 4 | 5 | #define HAVE_PROTOTYPES 6 | #define HAVE_UNSIGNED_CHAR 7 | #define HAVE_UNSIGNED_SHORT 8 | #undef void 9 | #undef const 10 | #undef CHAR_IS_UNSIGNED 11 | #define HAVE_STDDEF_H 12 | #define HAVE_STDLIB_H 13 | #undef NEED_BSD_STRINGS 14 | #undef NEED_SYS_TYPES_H 15 | #undef NEED_FAR_POINTERS 16 | #undef NEED_SHORT_EXTERNAL_NAMES 17 | #undef INCOMPLETE_TYPES_BROKEN 18 | 19 | -------------------------------------------------------------------------------- /gaps/pkgs/jpeg/jversion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jversion.h 3 | * 4 | * Copyright (C) 1991-1998, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains software version identification. 9 | */ 10 | 11 | 12 | #define JVERSION "6b 27-Mar-1998" 13 | 14 | #define JCOPYRIGHT "Copyright (C) 1998, Thomas G. Lane" 15 | -------------------------------------------------------------------------------- /gaps/pkgs/png/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=png 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | # JPEG library source files 14 | PNG_CSRCS = \ 15 | png.c \ 16 | pngset.c \ 17 | pngget.c \ 18 | pngrutil.c \ 19 | pngtrans.c \ 20 | pngwutil.c \ 21 | pngread.c \ 22 | pngrio.c \ 23 | pngwio.c \ 24 | pngwrite.c \ 25 | pngrtran.c \ 26 | pngwtran.c \ 27 | pngmem.c \ 28 | pngerror.c \ 29 | pngpread.c 30 | 31 | ZLIB_CSRCS = \ 32 | adler32.c \ 33 | compress.c \ 34 | crc32.c \ 35 | deflate.c \ 36 | gzclose.c \ 37 | gzlib.c \ 38 | gzread.c \ 39 | gzwrite.c \ 40 | infback.c \ 41 | inffast.c \ 42 | inflate.c \ 43 | inftrees.c \ 44 | trees.c \ 45 | uncompr.c \ 46 | zutil.c 47 | 48 | CSRCS = $(PNG_CSRCS) $(ZLIB_CSRCS) 49 | 50 | 51 | 52 | # 53 | # GAPS library makefile 54 | # 55 | 56 | include ../../makefiles/Makefile.pkgs 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /gaps/pkgs/png/gzclose.c: -------------------------------------------------------------------------------- 1 | /* gzclose.c -- zlib gzclose() function 2 | * Copyright (C) 2004, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #include "gzguts.h" 7 | 8 | /* gzclose() is in a separate file so that it is linked in only if it is used. 9 | That way the other gzclose functions can be used instead to avoid linking in 10 | unneeded compression or decompression routines. */ 11 | int ZEXPORT gzclose(file) 12 | gzFile file; 13 | { 14 | #ifndef NO_GZCOMPRESS 15 | gz_statep state; 16 | 17 | if (file == NULL) 18 | return Z_STREAM_ERROR; 19 | state = (gz_statep)file; 20 | 21 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 22 | #else 23 | return gzclose_r(file); 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /gaps/pkgs/png/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /gaps/pkgs/splm/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name and list of source files. 3 | # 4 | 5 | NAME=splm 6 | CSRCS= splm.c \ 7 | splm_ccsm.c \ 8 | splm_crsm.c \ 9 | splm_csparse.c \ 10 | splm_hessian.c \ 11 | splm_misc.c \ 12 | splm_stm.c \ 13 | splm_time.c \ 14 | 15 | 16 | 17 | # 18 | # R3 library makefile 19 | # 20 | 21 | include ../../makefiles/Makefile.pkgs 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /gaps/vc/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for GAPS visual studio release 3 | # 4 | 5 | 6 | # 7 | # Set up options, etc. 8 | # 9 | 10 | RELEASE_DIR=../release 11 | 12 | 13 | 14 | # 15 | # Make targets 16 | # 17 | 18 | opt: 19 | 20 | debug: 21 | 22 | mesa: 23 | 24 | release: 25 | mkdir -p $(RELEASE_DIR)/vc 26 | cp vc.sln $(RELEASE_DIR)/vc 27 | cp -r glut $(RELEASE_DIR)/vc 28 | mkdir -p $(RELEASE_DIR)/bin 29 | mkdir -p $(RELEASE_DIR)/lib 30 | mkdir -p $(RELEASE_DIR)/bin/win32 31 | mkdir -p $(RELEASE_DIR)/lib/win32 32 | cp glut/glut32.dll $(RELEASE_DIR)/bin/win32 33 | cp glut/glut32.lib $(RELEASE_DIR)/lib/win32 34 | cp Makefile $(RELEASE_DIR)/vc 35 | cp README.txt $(RELEASE_DIR)/vc 36 | 37 | clean: 38 | - rm -f -r Debug Release ../bin/win32/*.exe ../bin/win32/*.ilk ../bin/win32/*.pdb ../lib/win32/*.lib vc.ncb vc.suo vc.sdf *~ 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /gaps/vc/README.txt: -------------------------------------------------------------------------------- 1 | To compile, you should be able to open vc.sln and "Rebuild Solution. 2 | 3 | ------------------------------------------------------------------------ 4 | 5 | This file contains notes about settings made when creating the vc.sln file. 6 | 7 | All: 8 | General: Output Directory = $(SolutionDir)/$(ConfigurationName)/$(ProjectName) 9 | General: Intermediate Directory = $(SolutionDir)/$(ConfigurationName)/$(ProjectName) 10 | Input: Additional Dependencies = R3Graphics.lib R3Shapes.lib R2Shapes.lib RNBasics.lib jpeg.lib glut32.lib glu32.lib opengl32.lib 11 | C/C++: General: Additional Include Directories = ../../pkgs 12 | C/C++: Advanced: Comple as C++ Code (Set TP explicitly) --- except jpeg, png, fglut 13 | C/C++: Advanced: Disable Specific warnings 4244, 4267, 4996 14 | 15 | For pkgs: 16 | Librarian: General: Output File = ../../lib/win32/${ProjectName}.lib 17 | 18 | For apps: 19 | Linker: General:Additional Library Directories = ../../lib/win32 20 | Linker: General: Output file = ../../bin/win32/$(ProjectName).exe 21 | -------------------------------------------------------------------------------- /gaps/vc/glut/glut32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/gaps/vc/glut/glut32.dll -------------------------------------------------------------------------------- /gaps/vc/glut/glut32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/gaps/vc/glut/glut32.lib -------------------------------------------------------------------------------- /gaps/vc/makefiles/Makefile.std: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile setup for GAPS 3 | # 4 | 5 | 6 | 7 | # 8 | # Targets 9 | # 10 | 11 | OBJS=$(CCSRCS:.C=.obj) $(CCSRCS:.c=.obj) 12 | INCS=$(HSRCS) $(CCSRCS:.C=.h) 13 | 14 | 15 | 16 | # 17 | # C flags 18 | # 19 | 20 | CC=cl 21 | BASE_CFLAGS=$(USER_CFLAGS) /TP /W3 -I. -I../../pkgs 22 | DEBUG_CFLAGS=-Zi $(BASE_CFLAGS) 23 | OPT_CFLAGS=-Ox -DNDEBUG $(BASE_CFLAGS) 24 | CFLAGS=$(DEBUG_CFLAGS) 25 | 26 | 27 | 28 | # 29 | # Directories 30 | # 31 | 32 | RELEASE_DIR=../../release 33 | EXE_DIR=../../bin/win32 34 | LIB_DIR=../../lib/win32 35 | 36 | 37 | 38 | # 39 | # Default rules 40 | # 41 | 42 | .SUFFIXES: .c .C .obj 43 | 44 | .C.obj: 45 | $(CC) $(CFLAGS) -c $< 46 | 47 | .c.obj: 48 | $(CC) $(CFLAGS) -c $< 49 | 50 | 51 | -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | BSC_DIR = basics/ 2 | THIRD_PARTY_DIR = $(BSC_DIR)third_party/ 3 | IMGUI_DIR = $(THIRD_PARTY_DIR)imgui/ 4 | 5 | fetregister: dear_imgui 6 | make -C fetregister 7 | 8 | fetbenchmark: 9 | make -C fetbenchmark 10 | 11 | dear_imgui: 12 | make -C $(IMGUI_DIR) 13 | -------------------------------------------------------------------------------- /sun3dsfm/depth2XYZcamera.m: -------------------------------------------------------------------------------- 1 | function XYZcamera = depth2XYZcamera(K, depth, resolution, max_dist) 2 | [x,y] = meshgrid(1:resolution(1), 1:resolution(2)); 3 | XYZcamera(:,:,1) = (x-K(1,3)).*depth/K(1,1); 4 | XYZcamera(:,:,2) = (y-K(2,3)).*depth/K(2,2); 5 | XYZcamera(:,:,3) = depth; 6 | XYZcamera(:,:,4) = depth~=0 & depth < max_dist; 7 | end 8 | -------------------------------------------------------------------------------- /sun3dsfm/depthRead.m: -------------------------------------------------------------------------------- 1 | function depth = depthRead(filename, bit_shift) 2 | depth = imread(filename); 3 | if bit_shift 4 | depth = bitor(bitshift(depth,-3), bitshift(depth,16-3)); 5 | end 6 | depth = single(depth)/1000; 7 | end 8 | -------------------------------------------------------------------------------- /sun3dsfm/estimateRt.m: -------------------------------------------------------------------------------- 1 | % Usage: Rt = estimateRt(x1, x2) 2 | % Rt = estimateRt(x) 3 | % 4 | % Arguments: 5 | % x1, x2 - Two sets of corresponding 3xN set of homogeneous 6 | % points. 7 | % 8 | % x - If a single argument is supplied it is assumed that it 9 | % is in the form x = [x1; x2] 10 | % Returns: 11 | % Rt - The rotation matrix such that x1 = R * x2 + t 12 | 13 | function Rt = estimateRt(x, npts) 14 | [T, Eps] = estimateRigidTransform(x(1:3,:), x(4:6,:)); 15 | Rt = T(1:3,:); 16 | end 17 | 18 | 19 | -------------------------------------------------------------------------------- /sun3dsfm/getTimeStamp.m: -------------------------------------------------------------------------------- 1 | function timeStamp = getTimeStamp() 2 | 3 | timeStamp = clock; 4 | timeStamp = sprintf('%.4d%.2d%.2d%.2d%.2d%.2d',timeStamp(1),timeStamp(2),timeStamp(3),timeStamp(4),timeStamp(5),round(timeStamp(6))); 5 | -------------------------------------------------------------------------------- /sun3dsfm/lib/estimateRigidTransform/crossTimesMatrix.m: -------------------------------------------------------------------------------- 1 | function V_times = crossTimesMatrix(V) 2 | % CROSSTIMESMATRIX 3 | % V_TIMES = CROSSTIMESMATRIX(V) returns a 3x3 (or a series of 3x3) cross times matrices of input vector(s) V 4 | % 5 | % Input: 6 | % V a 3xN matrix, rpresenting a series of 3x1 vectors 7 | % 8 | % Output: 9 | % V_TIMES (Vx) a series of 3x3 matrices where V_times(:,:,i) is the Vx matrix for the vector V(:,i) 10 | % 11 | % Babak Taati, 2003 12 | % (revised 2009) 13 | 14 | [a,b] = size(V); 15 | V_times = zeros(a, 3, b); 16 | 17 | % V_times(1,1,:) = 0; 18 | V_times(1,2,:) = - V(3,:); 19 | V_times(1,3,:) = V(2,:); 20 | 21 | V_times(2,1,:) = V(3,:); 22 | % V_times(2,2,:) = 0; 23 | V_times(2,3,:) = - V(1,:); 24 | 25 | V_times(3,1,:) = - V(2,:); 26 | V_times(3,2,:) = V(1,:); 27 | % V_times(3,3,:) = 0; 28 | -------------------------------------------------------------------------------- /sun3dsfm/lib/estimateRigidTransform/estimateRigidTransform.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/estimateRigidTransform/estimateRigidTransform.zip -------------------------------------------------------------------------------- /sun3dsfm/lib/estimateRigidTransform/quat2rot.m: -------------------------------------------------------------------------------- 1 | function R = quat2rot(Q) 2 | % QUAT2ROT 3 | % R = QUAT2ROT(Q) converts a quaternion (4x1 or 1x4) into a 3x3 rotation mattrix 4 | % 5 | % reference: google! 6 | % 7 | % Babak Taati, 2003 8 | % (revised 2009) 9 | 10 | q0 = Q(1); 11 | q1 = Q(2); 12 | q2 = Q(3); 13 | q3 = Q(4); 14 | 15 | R(1,1) = q0*q0 + q1*q1 - q2*q2 - q3*q3; 16 | R(1,2) = 2 * (q1*q2 - q0*q3); 17 | R(1,3) = 2 * (q1*q3 + q0*q2); 18 | 19 | R(2,1) = 2 * (q1*q2 + q0*q3); 20 | R(2,2) = q0*q0 - q1*q1 + q2*q2 - q3*q3; 21 | R(2,3) = 2 * (q2*q3 - q0*q1); 22 | 23 | R(3,1) = 2 * (q1*q3 - q0*q2); 24 | R(3,2) = 2 * (q2*q3 + q0*q1); 25 | R(3,3) = q0*q0 - q1*q1 - q2*q2 + q3*q3; 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /sun3dsfm/lib/peter/gaussfilt.m: -------------------------------------------------------------------------------- 1 | % GAUSSFILT - Small wrapper function for convenient Gaussian filtering 2 | % 3 | % Usage: smim = gaussfilt(im, sigma) 4 | % 5 | % Arguments: im - Image to be smoothed. 6 | % sigma - Standard deviation of Gaussian filter. 7 | % 8 | % Returns: smim - Smoothed image. 9 | % 10 | % See also: INTEGGAUSSFILT 11 | 12 | % Peter Kovesi 13 | % Centre for Explortion Targeting 14 | % The University of Western Australia 15 | % http://www.csse.uwa.edu.au/~pk/research/matlabfns/ 16 | 17 | % March 2010 18 | 19 | function smim = gaussfilt(im, sigma) 20 | 21 | assert(ndims(im) == 2, 'Image must be greyscale'); 22 | 23 | % If needed convert im to double 24 | if ~strcmp(class(im),'double') 25 | im = double(im); 26 | end 27 | 28 | sze = ceil(6*sigma); 29 | if ~mod(sze,2) % Ensure filter size is odd 30 | sze = sze+1; 31 | end 32 | sze = max(sze,1); % and make sure it is at least 1 33 | 34 | h = fspecial('gaussian', [sze sze], sigma); 35 | 36 | smim = filter2(h, im); 37 | -------------------------------------------------------------------------------- /sun3dsfm/lib/peter/hcross.m: -------------------------------------------------------------------------------- 1 | % HCROSS - Homogeneous cross product, result normalised to s = 1. 2 | % 3 | % Function to form cross product between two points, or lines, 4 | % in homogeneous coodinates. The result is normalised to lie 5 | % in the scale = 1 plane. 6 | % 7 | % Usage: c = hcross(a,b) 8 | % 9 | 10 | % Copyright (c) 2000-2005 Peter Kovesi 11 | % School of Computer Science & Software Engineering 12 | % The University of Western Australia 13 | % http://www.csse.uwa.edu.au/ 14 | % 15 | % Permission is hereby granted, free of charge, to any person obtaining a copy 16 | % of this software and associated documentation files (the "Software"), to deal 17 | % in the Software without restriction, subject to the following conditions: 18 | % 19 | % The above copyright notice and this permission notice shall be included in 20 | % all copies or substantial portions of the Software. 21 | % 22 | % The Software is provided "as is", without warranty of any kind. 23 | 24 | % April 2000 25 | 26 | function c = hcross(a,b) 27 | c = cross(a,b); 28 | c = c/c(3); 29 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/.gitattributes: -------------------------------------------------------------------------------- 1 | *.manifest -crlf -diff -merge 2 | *.vcproj binary 3 | *.sln binary 4 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/.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/* -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/data/box.pgm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/data/box.pgm -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/data/river1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/data/river1.jpg -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/data/river2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/data/river2.jpg -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/data/roofs1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/data/roofs1.jpg -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/data/roofs2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/data/roofs2.jpg -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/data/spots.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/data/spots.jpg -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/api.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/PASCAL2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/PASCAL2.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/caltech-collage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/caltech-collage.jpg -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/down.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/fulkerson.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/fulkerson.jpg -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/help.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/lenc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/lenc.jpg -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/liop-neighbours-sampling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/liop-neighbours-sampling.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/liop-patch-layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/liop-patch-layout.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/perdoch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/perdoch.jpg -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/perrone.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/perrone.jpg -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/placeholder.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/placeholder.jpg -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/sarbortova.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/sarbortova.jpg -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/sift-mosaic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/sift-mosaic.jpg -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/sulc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/sulc.jpg -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-vs-additional-deps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-vs-additional-deps.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-vs-additional-include.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-vs-additional-include.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-vs-additional-libdir.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-vs-additional-libdir.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-vs-all-configurations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-vs-all-configurations.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-vs-empty-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-vs-empty-project.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-vs-new-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-vs-new-project.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-vs-nodll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-vs-nodll.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-vs-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-vs-ok.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-vs-post-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-vs-post-step.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-vs-project-properties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-vs-project-properties.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-xcode-copy-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-xcode-copy-2.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-xcode-copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-xcode-copy.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-xcode-dylib.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-xcode-dylib.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-xcode-edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-xcode-edit.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-xcode-err.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-xcode-err.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-xcode-info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-xcode-info.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-xcode-new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-xcode-new.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/using-xcode-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/using-xcode-ok.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/vedaldi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/vedaldi.jpg -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/vl_blue.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/vl_blue.ico -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/vl_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/vl_blue.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/vl_blue.pxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/vl_blue.pxm -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/images/yandex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/docsrc/images/yandex.png -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/docsrc/license.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

VLFeat is distributed under the BSD license:

5 |
6 |
7 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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); -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/toolbox/demo/vl_demo_svm_data.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhalber/Fine-To-Coarse-Registration/db66d80c9edacd61fb08fededafb8d0fe5207c86/sun3dsfm/lib/vlfeat/toolbox/demo/vl_demo_svm_data.mat -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/toolbox/xtest/vl_assert_equal.m: -------------------------------------------------------------------------------- 1 | function vl_assert_equal(x, y, varargin) 2 | assert(isequalwithequalnans(x,y),varargin{:}) ; 3 | end 4 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/lib/vlfeat/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 | -------------------------------------------------------------------------------- /sun3dsfm/nonmaxsup.m: -------------------------------------------------------------------------------- 1 | function cim = nonmaxsup(m, radius) 2 | if (nargin == 1) radius = 1; end 3 | % Extract local maxima by performing a grey scale morphological 4 | % dilation and then finding points in the corner strength image that 5 | % match the dilated image and are also greater than the threshold. 6 | sze = 2 * radius + 1; % Size of mask. 7 | 8 | %areaM = ones(sze); 9 | 10 | [rr cc] = meshgrid(1:sze); 11 | areaM = sqrt((rr-(radius+1)).^2+(cc-(radius+1)).^2)<=sze/2; 12 | 13 | mx = ordfilt2(m, sum(sum(areaM)), areaM); % Grey-scale dilate. 14 | 15 | selectMap = (m == mx); 16 | 17 | selectMap = ordfilt2(selectMap, 9, ones(3,3)); 18 | 19 | 20 | % grow neighborhood of max threshold; 21 | 22 | cim = sparse(m .* selectMap); 23 | -------------------------------------------------------------------------------- /sun3dsfm/outputCameraExtrinsics.m: -------------------------------------------------------------------------------- 1 | function outputCameraExtrinsics(base_path, name, cameraRtC2W) 2 | 3 | cameraRtC2W = permute(cameraRtC2W,[2 1 3]); 4 | cameraRtC2W= reshape(cameraRtC2W,4,[]); 5 | cameraRtC2W = cameraRtC2W'; 6 | outTo = fullfile(base_path, 'extrinsics', name); 7 | if ~exist(outTo,'dir') 8 | mkdir(outTo); 9 | end 10 | fp = fopen(fullfile(outTo,[name '.txt']),'w'); 11 | for rowID=1:size(cameraRtC2W,1) 12 | fprintf(fp, '%.100g %.100g %.100g %.100g\n',cameraRtC2W(rowID,:)); 13 | end 14 | fclose(fp); 15 | disp(fullfile(outTo,[name '.txt'])); -------------------------------------------------------------------------------- /sun3dsfm/transformCameraRt.m: -------------------------------------------------------------------------------- 1 | function RtOut = transformCameraRt(RtIn) 2 | 3 | RtOut = [RtIn(1:3,1:3)', - RtIn(1:3,1:3)'* RtIn(1:3,4)]; 4 | -------------------------------------------------------------------------------- /sun3dsfm/transformPointCloud.m: -------------------------------------------------------------------------------- 1 | 2 | function XYZtransform = transformPointCloud(XYZ,Rt) 3 | XYZtransform = Rt(1:3,1:3) * XYZ + repmat(Rt(1:3,4),1,size(XYZ,2)); 4 | end -------------------------------------------------------------------------------- /sun3dsfm/transformRT.m: -------------------------------------------------------------------------------- 1 | function Y3D = transformRT(X3D, Rt, isInverse) 2 | 3 | if nargin<3 || ~isInverse 4 | Y3D = Rt(:,1:3) * X3D + repmat(Rt(:,4),1,size(X3D,2)); 5 | else 6 | Y3D = Rt(:,1:3)' * (X3D - repmat(Rt(:,4),1,size(X3D,2))); 7 | end 8 | -------------------------------------------------------------------------------- /sun3dsfm/writePLYhead.m: -------------------------------------------------------------------------------- 1 | function file = writePLYhead(PLYfilename, pointCount) 2 | 3 | file = fopen(PLYfilename,'w'); 4 | fprintf (file, 'ply\n'); 5 | %fprintf (file, 'format ascii 1.0\n'); 6 | fprintf (file, 'format binary_little_endian 1.0\n'); 7 | fprintf (file, 'element vertex %d\n', pointCount); 8 | fprintf (file, 'property float x\n'); 9 | fprintf (file, 'property float y\n'); 10 | fprintf (file, 'property float z\n'); 11 | fprintf (file, 'property uchar red\n'); 12 | fprintf (file, 'property uchar green\n'); 13 | fprintf (file, 'property uchar blue\n'); 14 | fprintf (file, 'end_header\n'); --------------------------------------------------------------------------------