├── .gitignore ├── AUTHORS ├── BUGS ├── CMakeLists.txt ├── COPYING ├── INSTALL ├── README ├── THIRDPARTYLICENSES ├── TODO ├── cmake ├── fix_pyproto.sh └── modules │ ├── FindOctave.cmake │ ├── FindVW.cmake │ ├── FindZeroMQ.cmake │ ├── MvpHelpers.cmake │ ├── ProtobufGenerate.cmake │ └── PythonHelpers.cmake ├── config.cmake.example ├── examples ├── mvprun │ ├── .gitignore │ ├── mvprun.m │ ├── mvprun_tile.m │ ├── proj_images.m │ ├── start_mvp.m │ └── start_octmvp.m ├── real │ └── real.mvp └── synth │ ├── data │ ├── 0.pinhole │ ├── 0.tif │ ├── 1.pinhole │ ├── 1.tif │ ├── 2.pinhole │ ├── 2.tif │ ├── 3.pinhole │ ├── 3.tif │ ├── ground-DEM.tif │ ├── ground-DRG.tif │ └── initial-DEM.tif │ └── mvp.conf ├── octmvp ├── CMakeLists.txt ├── init_mvp.m.in ├── m │ ├── Datum.m │ ├── GeoReference.m │ └── OrbitalImageCollection.m ├── src │ ├── CMakeLists.txt │ ├── MathSupport.h │ ├── _do_homog.cc │ ├── _init_mvp.cc │ └── tests │ │ ├── CMakeLists.txt │ │ ├── TestMathSupport.cxx │ │ └── gtest_main.cc ├── test_mvp.m.in └── wrap │ ├── AlbedoBox.m │ ├── AlgorithmVar.m │ ├── Correlator.m │ ├── Lighter.m │ ├── Objective.m │ ├── ObjectiveHelper.m │ ├── PatchBox.m │ ├── PixelResult.m │ ├── Seed.m │ ├── Seeder.m │ ├── Stepper.m │ └── TileResult.m ├── old ├── OrbitFoot │ ├── CMakeLists.txt │ ├── backproj_test.cc │ ├── orbitfoot.cc │ ├── orbitfoot.h │ └── tests │ │ ├── CMakeLists.txt │ │ └── TestOrbitFoot.cxx ├── compilefail │ ├── blah.cpp │ ├── blah.h │ ├── compile.sh │ └── test.cpp ├── matlab │ ├── 20111125_impl │ │ ├── mpbackproj.m │ │ ├── mpvisible.m │ │ ├── mvcTestPatchR4RealSingleSeed.m │ │ └── mvreal.m │ ├── geom_patch │ │ ├── MultiViewCorr.m │ │ ├── UnitNorm.m │ │ ├── mpcrop.m │ │ ├── mpgeoGaus.m │ │ ├── mpgeoGausP4.m │ │ ├── mpgrad.m │ │ ├── mporthoproj.m │ │ ├── mvGeoPatchGaus.m │ │ ├── mvJacP4.m │ │ ├── mvJacobian.m │ │ ├── mv_sym_separable_jacobian.m │ │ ├── mvcCombine2DEM.m │ │ ├── mvcErrors.m │ │ ├── mvcPatch.m │ │ ├── mvcPatchP4.m │ │ ├── mvcPatchZ.m │ │ ├── mvcTestGeoGausP4.m │ │ ├── mvcrop.m │ │ ├── mvorthoproj.m │ │ ├── mvread.m │ │ ├── ort2orb.m │ │ └── pix2dir.m │ ├── ggn │ │ ├── egfun.m │ │ ├── fluxSearch.m │ │ ├── ggn.m │ │ ├── lwsnonlin.m │ │ ├── testFluxSearch.m │ │ ├── testGGN.m │ │ └── testLwsNonlin.m │ ├── mvp_patch │ │ ├── .DS_Store │ │ ├── MultiViews.m │ │ ├── MultiViews.rtf │ │ ├── MultiViews.txt │ │ ├── PatchViews.m │ │ ├── RasterView.m │ │ ├── SingleView.m │ │ ├── TerainView.m │ │ ├── gradest.m │ │ ├── mvFcnGrad.m │ │ ├── mvGrad.m │ │ ├── symDet.m │ │ ├── symSloppy.m │ │ ├── testMultiViews.m │ │ ├── testPatchViews.m │ │ ├── testRasterView.m │ │ └── testSingleView.m │ └── photo_patch │ │ ├── DrPlaneHomography.m │ │ ├── GaussPhoto.m │ │ ├── NormalJacobian.m │ │ ├── PhotoComp.m │ │ ├── PlaneHomography.m │ │ ├── PlaneJacobian.m │ │ ├── PoissBias.m │ │ ├── PoissPhoto.m │ │ ├── PseudoJacobian.m │ │ └── quat2rot.m ├── mvp │ ├── CMakeLists.txt │ ├── Config.h.in │ ├── ConvexPolygon.cc │ ├── ConvexPolygon.h │ ├── MVPAlgorithm.cc │ ├── MVPAlgorithm.h │ ├── MVPAlgorithmOptions.proto │ ├── MVPJob.cc │ ├── MVPJob.h │ ├── MVPJobQueue.h │ ├── MVPJobRequest.proto │ ├── MVPMessages.proto │ ├── MVPTileProcessor.cc │ ├── MVPTileProcessor.h │ ├── MVPTileSeeder.cc │ ├── MVPTileSeeder.h │ ├── MVPTypes.h │ ├── MVPUserSettings.proto │ ├── MVPWorkspace.cc │ ├── MVPWorkspace.h │ ├── MVPWorkspaceRequest.proto │ ├── OrbitalImageCrop.cc │ ├── OrbitalImageCrop.h │ ├── OrbitalImageFileDescriptor.proto │ ├── OrbitalImageFootprint.cc │ ├── OrbitalImageFootprint.h │ ├── ZmqHelpers.h │ ├── mvpadmin.py │ ├── mvpd.cc │ ├── mvpdumpjob.cc │ ├── mvpworker.cc │ ├── octave │ │ ├── CMakeLists.txt │ │ ├── _mvprefl_findH.m │ │ ├── _mvprefl_testhelpers.m │ │ ├── _porthoproj_impl.m │ │ ├── _porthoproj_impl_ref.m │ │ ├── gausskernel.m │ │ ├── geotrans.m │ │ ├── loadjobfile.cc │ │ ├── lonlat2normal.m │ │ ├── lonlatalt2xyz.m │ │ ├── mvpalgorithm.m │ │ ├── mvpfootprint.m │ │ ├── mvpobj.m │ │ ├── mvpoptimset.m │ │ ├── mvppatches.m │ │ ├── mvpproj.m │ │ ├── mvprefl.m │ │ ├── mvprefl_fast.m │ │ ├── offsetgeoref.m │ │ ├── porthoproj.m │ │ └── tests │ │ │ ├── CMakeLists.txt │ │ │ ├── README │ │ │ ├── data │ │ │ ├── 2682_1937_12.real.job │ │ │ │ ├── camera0.pinhole │ │ │ │ ├── camera1.pinhole │ │ │ │ ├── camera2.pinhole │ │ │ │ ├── camera3.pinhole │ │ │ │ ├── image0.tif │ │ │ │ ├── image1.tif │ │ │ │ ├── image2.tif │ │ │ │ ├── image3.tif │ │ │ │ └── job │ │ │ ├── 2688_1938_12.synth.job │ │ │ │ ├── camera0.pinhole │ │ │ │ ├── camera1.pinhole │ │ │ │ ├── camera2.pinhole │ │ │ │ ├── camera3.pinhole │ │ │ │ ├── image0.tif │ │ │ │ ├── image1.tif │ │ │ │ ├── image2.tif │ │ │ │ ├── image3.tif │ │ │ │ └── job │ │ │ ├── real-ground-DEM.mat │ │ │ ├── synth-ground-DEM.tif │ │ │ └── synth-ground-DRG.tif │ │ │ ├── ts_gengseed.m │ │ │ ├── ts_genseed.m │ │ │ ├── ts_loadrealjob.m.in │ │ │ ├── ts_loadsynthjob.m.in │ │ │ ├── ts_plotobj.m │ │ │ ├── ts_showpatches.m │ │ │ └── ts_showpatchprints.m │ └── tests │ │ ├── CMakeLists.txt │ │ ├── TestConvexPolygon.cxx │ │ ├── TestMVPAlgorithm.cxx │ │ ├── TestMVPJob.cxx │ │ ├── TestMVPTileProcessor.cxx │ │ ├── TestMVPTileSeeder.cxx │ │ ├── TestMVPWorkspace.cxx │ │ ├── TestOrbitalImageCrop.cxx │ │ ├── TestOrbitalImageFootprint.cxx │ │ └── mvp.conf ├── mvpgui │ ├── README │ ├── mvpgui │ ├── mvpgui.m │ ├── mvpgui_cmd_cp.m │ ├── mvpgui_cmd_cpi.m │ ├── mvpgui_cmd_exit.m │ ├── mvpgui_cmd_help.m │ ├── mvpgui_cmd_hwin.m │ ├── mvpgui_cmd_llplot.m │ ├── mvpgui_cmd_poi.m │ ├── mvpgui_cmd_replot.m │ ├── mvpgui_cmd_rplot.m │ ├── mvpgui_cmd_save.m │ ├── mvpgui_gencmddb.m │ └── mvpgui_parseArgs.m ├── octave │ ├── README │ ├── _orthoproj_impl.m │ ├── _porthoproj_impl.m │ ├── _porthoproj_impl_affine.m │ ├── _porthoproj_impl_ref.m │ ├── ccrop.m │ ├── loadmvp.m │ ├── lonlat2normal.m │ ├── lonlatgrid.m │ ├── lonlatrad2xyz.m │ ├── mvperr.m │ ├── mvpobj.m │ ├── mvpproj.m │ ├── mvptest.m │ ├── notes │ ├── orthoproj.m │ ├── plane2normd.m │ ├── planedem.m │ └── porthoproj.m └── papers │ ├── amvp.bib │ ├── brainstorm │ ├── High-level Flowchart for MVC.pdf │ └── amvp_brainstorm.lyx │ ├── eccv2012 │ ├── eccv2012-eso-pic.sty │ ├── eccv2012-everyshi.sty │ ├── eccv2012-ruler.sty │ ├── eccv2012.bst │ ├── eccv2012.cls │ ├── eccv2012.layout │ ├── eccv2012.lyx │ ├── eccv2012kit │ │ ├── README.txt │ │ ├── eccv2012-eso-pic.sty │ │ ├── eccv2012-everyshi.sty │ │ ├── eccv2012-ruler.sty │ │ ├── eccv2012.bst │ │ ├── eccv2012.cls │ │ ├── eccv2012.layout │ │ ├── eccv2012.lyx │ │ ├── eccv2012submission.pdf │ │ ├── eccv2012submission.tex │ │ ├── egbib.bib │ │ ├── eijkel2.eps │ │ ├── eijkel2.pdf │ │ └── sidebyside.pdf │ └── figures │ │ └── tan_plane_image.svg │ ├── kdh_srproj │ ├── Kelsh_stereoplotter.jpg │ ├── Usgs_map_mercator.svg │ ├── Usgs_map_sinousidal_equal_area.svg │ ├── amvp_flowchart.dia │ ├── asp_flowchart.tiff │ ├── colorized_dem.tiff │ ├── coverpage_snrproj.doc │ ├── dem_bundle_adjust.tiff │ ├── dem_no_bundle_adjust.tiff │ ├── kdh_srproj.lyx │ ├── kdh_srproj.pdf │ ├── orbit0.png │ ├── orbit1.png │ ├── orbit2.png │ ├── orbit3.png │ ├── realllplot.svg │ ├── realrplot.svg │ ├── realrplotsmwin.svg │ ├── subpixel_mode_bottom.tiff │ ├── subpixel_mode_top.tiff │ ├── synthDEM.png │ ├── synthDRG.png │ ├── synthllplot.svg │ ├── synthorbit0.png │ ├── synthorbit1.png │ ├── synthorbit2.png │ ├── synthorbit3.png │ ├── synthrplot.svg │ ├── tan_plane_image.svg │ └── template_matching.tiff │ ├── lyx_notes │ ├── misc │ ├── mvp_flow.dia │ ├── mvp_flow.png │ ├── mvp_fullsystem.dia │ └── mvp_fullsystem.png │ ├── plainurl.bst │ └── proposal │ ├── amvp_flowchart.dia │ ├── amvp_flowchart.pdf │ ├── amvp_proposal.lyx │ ├── asp_flowchart.tiff │ ├── colorized_dem.tiff │ ├── dem_bundle_adjust.tiff │ ├── dem_no_bundle_adjust.tiff │ ├── subpixel_mode_bottom.tiff │ ├── subpixel_mode_top.tiff │ └── template_matching.tiff ├── python ├── CMakeLists.txt └── mvpadmin.py ├── src ├── CMakeLists.txt ├── mvp │ ├── Algorithm │ │ ├── AlbedoBox.cc │ │ ├── AlbedoBox.h │ │ ├── AlbedoBox │ │ │ └── DefaultAlbedoBox.m │ │ ├── AlgorithmVar.cc │ │ ├── AlgorithmVar.h │ │ ├── AlgorithmVar │ │ │ └── DefaultAlgorithmVar.m │ │ ├── CMakeLists.txt │ │ ├── Correlator.cc │ │ ├── Correlator.h │ │ ├── Correlator │ │ │ └── FminbndCorrelator.m │ │ ├── CorrelatorSettings.proto │ │ ├── Dummy.cc │ │ ├── Dummy.h │ │ ├── Dummy │ │ │ ├── DerivedDummy.cc │ │ │ └── DerivedDummy.m │ │ ├── DummySettings.proto │ │ ├── Lighter.cc │ │ ├── Lighter.h │ │ ├── Lighter │ │ │ └── NormalizingLighter.m │ │ ├── LighterSettings.proto │ │ ├── ObjectBase.h │ │ ├── Objective.cc │ │ ├── Objective.h │ │ ├── Objective │ │ │ └── AbsDiffObjective.m │ │ ├── ObjectiveHelper.cc │ │ ├── ObjectiveHelper.h │ │ ├── ObjectiveHelper │ │ │ └── DefaultObjectiveHelper.m │ │ ├── ObjectiveSettings.proto │ │ ├── PatchBox.cc │ │ ├── PatchBox.h │ │ ├── PatchBox │ │ │ └── DefaultPatchBox.m │ │ ├── PixelResult.cc │ │ ├── PixelResult.h │ │ ├── PixelResult │ │ │ └── DefaultPixelResult.m │ │ ├── Seed.cc │ │ ├── Seed.h │ │ ├── Seed │ │ │ └── DefaultSeed.m │ │ ├── Seeder.cc │ │ ├── Seeder.h │ │ ├── Seeder │ │ │ └── SimpleSeeder.m │ │ ├── SeederSettings.h │ │ ├── SeederSettings.proto │ │ ├── Stepper.cc │ │ ├── Stepper.h │ │ ├── Stepper │ │ │ └── SimpleStepper.m │ │ ├── StepperSettings.proto │ │ ├── Support │ │ │ ├── globals.m │ │ │ ├── pixel2post.m │ │ │ ├── quat2rot.m │ │ │ ├── rot2quat.m │ │ │ └── tanplane.m │ │ ├── TileResult.cc │ │ ├── TileResult.h │ │ ├── TileResult │ │ │ └── DefaultTileResult.m │ │ └── Types.h │ ├── CMakeLists.txt │ ├── Config.h.in │ ├── Core │ │ ├── CMakeLists.txt │ │ ├── ConvexPolygon.cc │ │ ├── ConvexPolygon.h │ │ ├── GlobalSettings.proto │ │ ├── Settings.cc │ │ ├── Settings.h │ │ └── tests │ │ │ ├── CMakeLists.txt │ │ │ ├── TestConvexPolygon.cxx │ │ │ ├── TestSettings.cxx │ │ │ └── mvprc │ ├── Frontend │ │ ├── CMakeLists.txt │ │ ├── Messages.proto │ │ ├── StatusTable.cc │ │ ├── StatusTable.h │ │ ├── ZmqHelpers.cc │ │ ├── ZmqHelpers.h │ │ ├── ZmqServerHelper.cc │ │ ├── ZmqServerHelper.h │ │ ├── ZmqWorkerHelper.cc │ │ ├── ZmqWorkerHelper.h │ │ ├── loadjobfile.cc │ │ ├── mvpd.cc │ │ ├── mvpdumpjob.cc │ │ ├── mvpworker.cc │ │ └── tests │ │ │ └── CMakeLists.txt │ ├── Image │ │ ├── CMakeLists.txt │ │ ├── OrbitalImage.cc │ │ ├── OrbitalImage.h │ │ ├── OrbitalImageCatalog.cc │ │ ├── OrbitalImageCatalog.h │ │ ├── OrbitalImageCollection.cc │ │ ├── OrbitalImageCollection.h │ │ ├── OrbitalImageDesc.proto │ │ └── tests │ │ │ ├── CMakeLists.txt │ │ │ ├── TestOrbitalImage.cxx │ │ │ ├── TestOrbitalImageCatalog.cxx │ │ │ └── TestOrbitalImageCollection.cxx │ ├── Octave │ │ ├── CMakeLists.txt │ │ ├── Conversions.h │ │ ├── Main.cc │ │ ├── Main.h │ │ ├── MvpWrapper.cc │ │ ├── MvpWrapper.h │ │ ├── OctaveWrapper.cc │ │ ├── OctaveWrapper.h │ │ ├── imread_vw.cc │ │ ├── init_mvp.cc │ │ ├── mosaic.m │ │ ├── oct-mvpclass.h │ │ ├── oct-typetraits.h │ │ ├── ov-mvpclass-ref.cc │ │ ├── ov-mvpclass-ref.h │ │ ├── tests │ │ │ ├── CMakeLists.txt │ │ │ ├── DummyProto.proto │ │ │ └── TestConversions.cxx │ │ ├── wrap.h │ │ └── wraps │ │ │ ├── AlbedoBox.cc │ │ │ ├── AlgorithmVar.cc │ │ │ ├── Correlator.cc │ │ │ ├── Datum.cc │ │ │ ├── Dummy.cc │ │ │ ├── GeoReference.cc │ │ │ ├── Lighter.cc │ │ │ ├── Objective.cc │ │ │ ├── ObjectiveHelper.cc │ │ │ ├── OrbitalImageCollection.cc │ │ │ ├── PatchBox.cc │ │ │ ├── PixelResult.cc │ │ │ ├── Seed.cc │ │ │ ├── Seeder.cc │ │ │ ├── Stepper.cc │ │ │ └── TileResult.cc │ └── Pipeline │ │ ├── AlgorithmSettings.proto │ │ ├── CMakeLists.txt │ │ ├── Job.cc │ │ ├── Job.h │ │ ├── JobDesc.proto │ │ ├── Session.cc │ │ ├── Session.h │ │ ├── SessionDesc.proto │ │ └── tests │ │ ├── CMakeLists.txt │ │ ├── TestSession.cxx │ │ └── test.mvp ├── test │ ├── CMakeLists.txt │ ├── Helpers.h │ ├── README │ ├── data │ │ ├── synth-ground-DEM.tif │ │ ├── synth-ground-DRG.tif │ │ ├── synth.0.pinhole │ │ ├── synth.0.tif │ │ ├── synth.1.pinhole │ │ ├── synth.1.tif │ │ ├── synth.2.pinhole │ │ ├── synth.2.tif │ │ ├── synth.3.pinhole │ │ └── synth.3.tif │ ├── loadtestenv.m.in │ └── test_main.cc └── tools │ ├── CMakeLists.txt │ ├── gen_synth_scene.cc │ ├── gen_synth_scene.h │ ├── plate2image.cc │ ├── print_pinhole.cc │ └── vwconvert.cc └── thirdparty ├── gtest ├── gtest-1.6.0 ├── CHANGES ├── CONTRIBUTORS ├── COPYING ├── README ├── include │ └── gtest │ │ ├── gtest-death-test.h │ │ ├── gtest-message.h │ │ ├── gtest-param-test.h │ │ ├── gtest-param-test.h.pump │ │ ├── gtest-printers.h │ │ ├── gtest-spi.h │ │ ├── gtest-test-part.h │ │ ├── gtest-typed-test.h │ │ ├── gtest.h │ │ ├── gtest_pred_impl.h │ │ ├── gtest_prod.h │ │ └── internal │ │ ├── gtest-death-test-internal.h │ │ ├── gtest-filepath.h │ │ ├── gtest-internal.h │ │ ├── gtest-linked_ptr.h │ │ ├── gtest-param-util-generated.h │ │ ├── gtest-param-util-generated.h.pump │ │ ├── gtest-param-util.h │ │ ├── gtest-port.h │ │ ├── gtest-string.h │ │ ├── gtest-tuple.h │ │ ├── gtest-tuple.h.pump │ │ ├── gtest-type-util.h │ │ └── gtest-type-util.h.pump └── src │ ├── gtest-all.cc │ ├── gtest-death-test.cc │ ├── gtest-filepath.cc │ ├── gtest-internal-inl.h │ ├── gtest-port.cc │ ├── gtest-printers.cc │ ├── gtest-test-part.cc │ ├── gtest-typed-test.cc │ ├── gtest.cc │ └── gtest_main.cc └── vw_protobuf ├── README ├── grab_protos.sh └── vw ├── Camera └── TsaiFile.proto ├── Cartography ├── DatumDesc.proto └── GeoReferenceDesc.proto └── Plate ├── IndexData.proto ├── IndexService.proto ├── PlateGeoReferenceDesc.proto ├── Rpc.proto └── tests └── TestRpcService.proto /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | \#*\# 3 | papers/proposal/amvp_proposal.pdf 4 | papers/brainstorm/amvp_brainstorm.pdf 5 | examples/synth/result.plate 6 | examples/synth/internal-result.plate 7 | examples/real/result.plate 8 | examples/real/internal-result.plate 9 | *.asv 10 | old/matlab/mvp_patch/AS15_3_3_tiles.mat 11 | old/matlab/mvp_patch/ASA_CG-2.2.tar 12 | old/matlab/mvp_patch/ASA_CG-2.2 13 | old/matlab/mvp_patch/ASA_CG-2.2_matlab 14 | .DS_Store 15 | build* 16 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | This open source version of the Multiple View Pipeline (MVP) was 2 | developed by the Intelligent Robotics Group (IRG), in the Intelligent 3 | Systems Division at NASA Ames Research Center in Moffett Field, CA. It 4 | builds on over ten years of IRG experience developing surface 5 | reconstruction tools for terrestrial robotic field tests and planetary 6 | exploration. 7 | 8 | Credit and thanks go to the following developers for contributing time 9 | and energy to this effort. 10 | 11 | Taemin Kim (NASA/SGT) - Principal Investigator 12 | Kyle Husmann (EAP/CalPoly) - Lead Developer 13 | Terry Fong (CS) - Project Manager 14 | -------------------------------------------------------------------------------- /THIRDPARTYLICENSES: -------------------------------------------------------------------------------- 1 | The NASA Multiple View Pipeline (MVP) would not be possible with out 2 | the use of third party software that is also open source. Licenses for 3 | the software we use are copied below. -------------------------------------------------------------------------------- /cmake/fix_pyproto.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SED=sed 4 | 5 | if [[ "`uname`" == "Darwin" ]]; then 6 | SED=gsed 7 | fi 8 | 9 | # Rename modules to lowercase: 10 | # import "mvp/Frontend/SessionDesc.proto"; 11 | # becomes 12 | # import "mvp/frontend/SessionDesc.proto"; 13 | $SED -e 's/^\(\s*import\s*"\)\(.*\)\(\/.*\)/\1\L\2\E\3/' $1 > $2 14 | -------------------------------------------------------------------------------- /cmake/modules/FindZeroMQ.cmake: -------------------------------------------------------------------------------- 1 | # Find zeromq 2 | 3 | # ZEROMQ_FOUND 4 | # ZEROMQ_LIBRARIES 5 | # ZEROMQ_INCLUDE_DIRS 6 | 7 | include(FindPackageHandleStandardArgs) 8 | 9 | find_library(ZEROMQ_LIBRARY NAMES zmq HINTS ${ZEROMQ_ROOT}/lib) 10 | 11 | find_path(ZEROMQ_INCLUDE_DIR NAMES zmq.hpp HINTS ${ZEROMQ_ROOT}/include) 12 | 13 | mark_as_advanced(ZEROMQ_LIBRARY ZEROMQ_INCLUDE_DIR) 14 | 15 | set(ZEROMQ_INCLUDE_DIRS ${ZEROMQ_INCLUDE_DIR}) 16 | set(ZEROMQ_LIBRARIES ${ZEROMQ_LIBRARY}) 17 | 18 | find_package_handle_standard_args(ZeroMQ REQUIRED_VARS ZEROMQ_LIBRARY ZEROMQ_INCLUDE_DIR) 19 | -------------------------------------------------------------------------------- /config.cmake.example: -------------------------------------------------------------------------------- 1 | # TODO: Make script for cmake -C BuildSetup.cmake instead 2 | 3 | set(BINARY_DIR_INSTALL ON CACHE BOOL "Install to the build dir") 4 | set(BUILD_TESTS ON CACHE BOOL "Build tests") 5 | 6 | set(VW_ROOT /byss/khusmann/projects/VisionWorkbench/build) 7 | set(GEARMAN_ROOT /byss/khusmann/projects/BinaryBuilder/build) 8 | 9 | set(BOOST_ROOT /byss/khusmann/projects/BinaryBuilder/build) 10 | set(Boost_NO_SYSTEM_PATHS TRUE) 11 | set(Boost_NO_BOOST_CMAKE TRUE) 12 | 13 | set(PROTOBUF_ROOT /byss/khusmann/projects/BinaryBuilder/build) 14 | set(PROTOBUF_LIBRARY ${PROTOBUF_ROOT}/lib/libprotobuf.so) 15 | set(PROTOBUF_INCLUDE_DIR ${PROTOBUF_ROOT}/include) 16 | set(PROTOBUF_PROTOC_EXECUTABLE ${PROTOBUF_ROOT}/bin/protoc) 17 | -------------------------------------------------------------------------------- /examples/mvprun/.gitignore: -------------------------------------------------------------------------------- 1 | *.job 2 | *.job.mat 3 | result* 4 | -------------------------------------------------------------------------------- /examples/mvprun/mvprun.m: -------------------------------------------------------------------------------- 1 | lighter = Lighter(job.algorithm_settings.lighter_settings); 2 | objective = Objective(job.algorithm_settings.objective_settings); 3 | 4 | post = pixel2post(job.georef, [32 32]); 5 | orientation = tanplane(post); 6 | 7 | %%%%%%%%%%%%%%%%%%% 8 | 9 | obj_helper = ObjectiveHelper(job.orbital_images, lighter, objective, post); 10 | 11 | curr_result = 1; 12 | alts = job.georef.datum().semi_major_axis() + linspace(-2000, 0, 20); 13 | result = {}; 14 | for i = alts 15 | seed = AlgorithmVar([i, orientation', [25,25], [0,0], 0, 0, 80]); 16 | result(curr_result) = obj_helper.func(seed); 17 | curr_result += 1; 18 | endfor 19 | 20 | %%%%%%%%%%%%%%%%%% 21 | 22 | correlator = Correlator(job.orbital_images, lighter, objective, job.algorithm_settings.correlator0_settings); 23 | 24 | seed = AlgorithmVar([job.georef.datum().semi_major_axis() + -500, orientation', [25,25], [0,0], 0, 0, 80]); 25 | tic 26 | d = correlator.correlate(post, seed); 27 | toc 28 | 29 | % vim:set syntax=octave: 30 | -------------------------------------------------------------------------------- /examples/mvprun/proj_images.m: -------------------------------------------------------------------------------- 1 | center_pixel = (job.tile_size - 1) / 2; 2 | curr_post = pixel2post(job.georef, center_pixel); 3 | algovar = AlgorithmVar([-1000+job.georef.datum().semi_major_axis(); 4 | tanplane(curr_post); [30;30]; [0;0]; 5 | 0; 0; 60]); 6 | 7 | xyz = curr_post * algovar.radius(); 8 | 9 | raw_patches = job.orbital_images.back_project(xyz, algovar.orientation(), [algovar.scale();algovar.scale()], algovar.window()); 10 | -------------------------------------------------------------------------------- /examples/mvprun/start_mvp.m: -------------------------------------------------------------------------------- 1 | source("../../build/src/test/loadtestenv.m"); 2 | system("../../build/src/mvp/Frontend/mvpdumpjob ../real/real.mvp 2682 1937 12"); 3 | 4 | job = loadjobfile("2682_1937_12.job"); 5 | -------------------------------------------------------------------------------- /examples/mvprun/start_octmvp.m: -------------------------------------------------------------------------------- 1 | source("../../build2/init_mvp.m"); 2 | #system("../../build/src/mvp/Frontend/mvpdumpjob ../real/real.mvp 2682 1937 12"); 3 | 4 | load 2682_1937_12.job.mat; 5 | 6 | job.orbital_images = OrbitalImageCollection(job.orbital_images); 7 | job.georef = GeoReference(Datum(job.georef.datum.semi_major_axis), job.georef.transform); 8 | -------------------------------------------------------------------------------- /examples/real/real.mvp: -------------------------------------------------------------------------------- 1 | input { 2 | image_pattern: "/home/khusmann/mvp_data/AS15_bundle/images/.*p\\.tif" 3 | camera_pattern: "/home/khusmann/mvp_data/AS15_bundle/images/.*p\\.pinhole" 4 | } 5 | 6 | render { 7 | bbox: "2682,1937:2685,1940" 8 | level: 12 9 | } 10 | 11 | output { 12 | # platefile: "zmq://localhost:5566/result.plate" 13 | platefile: "/home/khusmann/result.plate" 14 | datum: "D_MOON" 15 | map_projection: "equi" 16 | tile_size: 64 17 | } 18 | 19 | algorithm_settings { 20 | alt_min: -6000 21 | alt_max: 2000 22 | orbital_image_padding_x: 30 23 | orbital_image_padding_y: 30 24 | 25 | seeder_settings { 26 | alt: -1000 27 | 28 | window_x: 30 29 | window_y: 30 30 | gwindow_x: 0 31 | gwindow_y: 0 32 | smooth: 0 33 | gsmooth: 0 34 | scale: 60 35 | 36 | out_window_x: 20 37 | out_window_y: 20 38 | out_gwindow_x: 0 39 | out_gwindow_y: 0 40 | out_smooth: 0 41 | out_gsmooth: 0 42 | out_scale: 60 43 | } 44 | 45 | correlator0_settings { 46 | alt_search_range: 2000 47 | } 48 | 49 | correlator_settings { 50 | alt_search_range: 500 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /examples/synth/data/0.pinhole: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/examples/synth/data/0.pinhole -------------------------------------------------------------------------------- /examples/synth/data/0.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/examples/synth/data/0.tif -------------------------------------------------------------------------------- /examples/synth/data/1.pinhole: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/examples/synth/data/1.pinhole -------------------------------------------------------------------------------- /examples/synth/data/1.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/examples/synth/data/1.tif -------------------------------------------------------------------------------- /examples/synth/data/2.pinhole: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/examples/synth/data/2.pinhole -------------------------------------------------------------------------------- /examples/synth/data/2.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/examples/synth/data/2.tif -------------------------------------------------------------------------------- /examples/synth/data/3.pinhole: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/examples/synth/data/3.pinhole -------------------------------------------------------------------------------- /examples/synth/data/3.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/examples/synth/data/3.tif -------------------------------------------------------------------------------- /examples/synth/data/ground-DEM.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/examples/synth/data/ground-DEM.tif -------------------------------------------------------------------------------- /examples/synth/data/ground-DRG.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/examples/synth/data/ground-DRG.tif -------------------------------------------------------------------------------- /examples/synth/data/initial-DEM.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/examples/synth/data/initial-DEM.tif -------------------------------------------------------------------------------- /examples/synth/mvp.conf: -------------------------------------------------------------------------------- 1 | # 2 | # Dataset info 3 | # 4 | 5 | orbital-image-pattern = data/%d.tif 6 | camera-pattern = data/%d.pinhole 7 | pattern-index-start = 0 8 | pattern-index-end = 3 9 | 10 | # 11 | # Render Box 12 | # 13 | 14 | render-region = 335,242:336,243 15 | render-level = 9 16 | 17 | # 18 | # Platefile settings 19 | # 20 | 21 | datum = D_MOON 22 | map-projection = equi 23 | tile-size = 64 24 | 25 | # 26 | # Output paths 27 | # 28 | 29 | result-platefile = result.plate 30 | internal-result-platefile = internal-result.plate 31 | 32 | # 33 | # Algorithm settings 34 | # 35 | 36 | alt-min = -3000 37 | alt-max = -2000 38 | alt-search-range = 500 39 | 40 | seed-window-size = 32 41 | seed-window-smooth-size = 2 42 | 43 | use-octave = true 44 | test-algorithm = false 45 | -------------------------------------------------------------------------------- /octmvp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 2.8) 2 | project (OCTMVP) 3 | 4 | set(MVP_DIR ${CMAKE_SOURCE_DIR}/..) 5 | 6 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${MVP_DIR}/cmake/modules") 7 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -O0 -g") 8 | 9 | find_package(Octave) 10 | include_directories(${OCTAVE_INCLUDE_DIRS}) 11 | link_directories(${OCTAVE_LIBRARY_DIRS}) 12 | 13 | configure_file(init_mvp.m.in init_mvp.m) 14 | configure_file(test_mvp.m.in test_mvp.m) 15 | 16 | add_definitions(-DOCTMVP) 17 | 18 | add_subdirectory(src) 19 | 20 | enable_testing() 21 | -------------------------------------------------------------------------------- /octmvp/init_mvp.m.in: -------------------------------------------------------------------------------- 1 | mvpdirs = {"@CMAKE_CURRENT_BINARY_DIR@", 2 | "@CMAKE_CURRENT_BINARY_DIR@/src", 3 | "@CMAKE_CURRENT_SOURCE_DIR@/m", 4 | "@CMAKE_CURRENT_SOURCE_DIR@/wrap", 5 | "@CMAKE_SOURCE_DIR@/../src/mvp/Algorithm/AlbedoBox", 6 | "@CMAKE_SOURCE_DIR@/../src/mvp/Algorithm/AlgorithmVar", 7 | "@CMAKE_SOURCE_DIR@/../src/mvp/Algorithm/Correlator", 8 | "@CMAKE_SOURCE_DIR@/../src/mvp/Algorithm/Dummy", 9 | "@CMAKE_SOURCE_DIR@/../src/mvp/Algorithm/Lighter", 10 | "@CMAKE_SOURCE_DIR@/../src/mvp/Algorithm/Objective", 11 | "@CMAKE_SOURCE_DIR@/../src/mvp/Algorithm/ObjectiveHelper", 12 | "@CMAKE_SOURCE_DIR@/../src/mvp/Algorithm/PatchBox", 13 | "@CMAKE_SOURCE_DIR@/../src/mvp/Algorithm/PixelResult", 14 | "@CMAKE_SOURCE_DIR@/../src/mvp/Algorithm/Seed", 15 | "@CMAKE_SOURCE_DIR@/../src/mvp/Algorithm/Seeder", 16 | "@CMAKE_SOURCE_DIR@/../src/mvp/Algorithm/Stepper", 17 | "@CMAKE_SOURCE_DIR@/../src/mvp/Algorithm/TileResult", 18 | "@CMAKE_SOURCE_DIR@/../src/mvp/Algorithm/Support" 19 | }; 20 | 21 | cellfun(@addpath, mvpdirs); 22 | 23 | _init_mvp; 24 | -------------------------------------------------------------------------------- /octmvp/m/Datum.m: -------------------------------------------------------------------------------- 1 | function self = Datum(_radius) 2 | self = mvpclass(); 3 | 4 | self._radius = _radius; 5 | 6 | self.semi_major_axis = @(self) self._radius; 7 | self.geodetic_to_cartesian = @geodetic_to_cartesian; 8 | endfunction 9 | 10 | function xyz = geodetic_to_cartesian(self, lonlatalt) 11 | lonlatalt(1:2) *= pi / 180; 12 | 13 | clo = cos(lonlatalt(1)); 14 | slo = sin(lonlatalt(1)); 15 | cla = cos(lonlatalt(2)); 16 | sla = sin(lonlatalt(2)); 17 | 18 | n = [cla * clo; cla * slo; sla]; 19 | xyz = n * (lonlatalt(3) + self._radius); 20 | endfunction 21 | 22 | % vim:set syntax=octave: 23 | -------------------------------------------------------------------------------- /octmvp/m/GeoReference.m: -------------------------------------------------------------------------------- 1 | function self = GeoReference(_datum, _transform) 2 | self = mvpclass(); 3 | 4 | self._datum = _datum; 5 | self._transform = _transform; 6 | 7 | self.datum = @(self) self._datum; 8 | self.pixel_to_lonlat = @pixel_to_lonlat; 9 | endfunction 10 | 11 | function lonlat = pixel_to_lonlat(self, pixel) 12 | pixel = double(pixel); 13 | lonlat = self._transform * [pixel(:); 1]; 14 | lonlat /= lonlat(3); 15 | lonlat = lonlat(1:2); 16 | endfunction 17 | 18 | % vim:set syntax=octave: 19 | -------------------------------------------------------------------------------- /octmvp/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${MVP_DIR}/src) 2 | 3 | add_octfile(_init_mvp _init_mvp.cc ${MVP_DIR}/src/mvp/Octave/ov-mvpclass-ref.cc) 4 | add_octfile(_do_homog _do_homog.cc) 5 | 6 | add_subdirectory(tests) 7 | 8 | include_directories(${CMAKE_SOURCE_DIR}/thirdparty/gtest) 9 | -------------------------------------------------------------------------------- /octmvp/src/_do_homog.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include // octave_NA 3 | 4 | #include "MathSupport.h" 5 | 6 | // image, homog, sz 7 | DEFUN_DLD(_do_homog, args, nargout, "Oct project") { 8 | 9 | if (args.length() != 3) { 10 | error("Usage: _do_homog(image,homog,sz)"); 11 | return octave_value(); 12 | } 13 | 14 | Matrix image(args(0).matrix_value()); 15 | Matrix homog(args(1).matrix_value()); 16 | Matrix sz(args(2).matrix_value()); 17 | 18 | if (!(homog.rows() == 3 && homog.cols() == 3)) { 19 | error("Error: homog must be 3x3"); 20 | return octave_value(); 21 | } 22 | 23 | double h[3][3]; 24 | for (int r = 0; r < 3; r++) { 25 | for (int c = 0; c < 3; c++) { 26 | h[r][c] = homog(r, c); 27 | } 28 | } 29 | 30 | double rows = sz(1); 31 | double cols = sz(0); 32 | 33 | Matrix patch(rows, cols); 34 | for (int r = 0; r < rows; r++) { 35 | for (int c = 0; c < cols; c++) { 36 | double x = h[0][0] * c + h[0][1] * r + h[0][2]; 37 | double y = h[1][0] * c + h[1][1] * r + h[1][2]; 38 | double w = h[2][0] * c + h[2][1] * r + h[2][2]; 39 | x /= w; 40 | y /= w; 41 | patch(r, c) = bilinear_interp2(image, x, y); 42 | } 43 | } 44 | 45 | return octave_value(patch); 46 | } 47 | -------------------------------------------------------------------------------- /octmvp/src/_init_mvp.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | octave_value_list mvp_class(octave_value_list const& args, int nargout) { 5 | return octave_value(new octave_mvpclass_ref(boost::shared_ptr(new octave_mvpclass_impl()))); 6 | } 7 | 8 | DEFUN_DLD(_init_mvp, args, nargout, "register mvp classes") { 9 | octave_mvpclass_ref::register_type(); 10 | install_builtin_function(mvp_class, "mvpclass", std::string()); 11 | return octave_value(); 12 | } 13 | -------------------------------------------------------------------------------- /octmvp/src/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${MVP_DIR}/thirdparty/gtest/include) 2 | include_directories(${MVP_DIR}/thirdparty/gtest) 3 | add_library(gtest_main gtest_main.cc 4 | ${MVP_DIR}/thirdparty/gtest/src/gtest-all.cc) 5 | target_link_libraries(gtest_main pthread) 6 | 7 | include_directories(..) 8 | 9 | add_executable(TestMathSupport TestMathSupport.cxx) 10 | target_link_libraries(TestMathSupport gtest_main ${OCTAVE_LIBRARIES}) 11 | 12 | add_test(TestMathSupport TestMathSupport) 13 | -------------------------------------------------------------------------------- /octmvp/src/tests/TestMathSupport.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "MathSupport.h" 4 | 5 | TEST(bilinear_interp2, calculate) { 6 | Matrix im(2, 2); 7 | im(0, 0) = 1; im(0, 1) = 2; 8 | im(1, 0) = 3; im(1, 1) = 4; 9 | 10 | EXPECT_EQ(bilinear_interp2(im, 0, 0), 1); 11 | EXPECT_EQ(bilinear_interp2(im, 1, 0), 2); 12 | EXPECT_EQ(bilinear_interp2(im, 0, 1), 3); 13 | EXPECT_EQ(bilinear_interp2(im, 1, 1), 4); 14 | EXPECT_EQ(bilinear_interp2(im, 0.5, 0.5), (1 + 2 + 3 + 4) / 4.0); 15 | 16 | EXPECT_EQ(bilinear_interp2(im, 0.25, 0.25), 1.75); 17 | 18 | EXPECT_EQ(bilinear_interp2(im, -0.5, -0.5), 0.25); 19 | EXPECT_EQ(bilinear_interp2(im, 1.5, 1.5), 1); 20 | } 21 | 22 | TEST(quat2rot, calculate) { 23 | ColumnVector quat(4); 24 | quat(0) = 5; 25 | quat(1) = 6; 26 | quat(2) = 8; 27 | quat(3) = 10; 28 | quat /= 15; 29 | 30 | Matrix rot = quat2rot(quat); 31 | 32 | EXPECT_NEAR(rot(0, 0), -0.457778, 1e-4); EXPECT_NEAR(rot(0, 1), -0.017778, 1e-4); EXPECT_NEAR(rot(0, 2), 0.888889, 1e-4); 33 | EXPECT_NEAR(rot(1, 0), 0.871111, 1e-4); EXPECT_NEAR(rot(1, 1), -0.208889, 1e-4); EXPECT_NEAR(rot(1, 2), 0.444444, 1e-4); 34 | EXPECT_NEAR(rot(2, 0), 0.177778, 1e-4); EXPECT_NEAR(rot(2, 1), 0.977778, 1e-4); EXPECT_NEAR(rot(2, 2), 0.111111, 1e-4); 35 | } 36 | -------------------------------------------------------------------------------- /octmvp/src/tests/gtest_main.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | int main(int argc, char **argv) { 8 | const char * argvv [] = {"", "--silent"}; 9 | ::octave_main (2, (char **) argvv, true); 10 | 11 | testing::InitGoogleTest(&argc, argv); 12 | int status = RUN_ALL_TESTS(); 13 | 14 | do_octave_atexit(); 15 | 16 | return status; 17 | } 18 | -------------------------------------------------------------------------------- /octmvp/test_mvp.m.in: -------------------------------------------------------------------------------- 1 | addpath("@CMAKE_CURRENT_BINARY_DIR@"); 2 | init_mvp; 3 | 4 | cellfun(@runtests, mvpdirs); 5 | -------------------------------------------------------------------------------- /octmvp/wrap/AlbedoBox.m: -------------------------------------------------------------------------------- 1 | function self = AlbedoBox(varargin) 2 | self = DefaultAlbedoBox(varargin{:}); 3 | endfunction 4 | -------------------------------------------------------------------------------- /octmvp/wrap/AlgorithmVar.m: -------------------------------------------------------------------------------- 1 | function self = AlgorithmVar(varargin) 2 | self = DefaultAlgorithmVar(varargin{:}); 3 | endfunction 4 | -------------------------------------------------------------------------------- /octmvp/wrap/Correlator.m: -------------------------------------------------------------------------------- 1 | function self = Correlator(varargin) 2 | self = FminbndCorrelator(varargin{:}); 3 | endfunction 4 | -------------------------------------------------------------------------------- /octmvp/wrap/Lighter.m: -------------------------------------------------------------------------------- 1 | function self = Lighter(varargin) 2 | self = NormalizingLighter(varargin{:}); 3 | endfunction 4 | -------------------------------------------------------------------------------- /octmvp/wrap/Objective.m: -------------------------------------------------------------------------------- 1 | function self = Objective(varargin) 2 | self = AbsDiffObjective(varargin{:}); 3 | endfunction 4 | -------------------------------------------------------------------------------- /octmvp/wrap/ObjectiveHelper.m: -------------------------------------------------------------------------------- 1 | function self = ObjectiveHelper(varargin) 2 | self = DefaultObjectiveHelper(varargin{:}); 3 | endfunction 4 | -------------------------------------------------------------------------------- /octmvp/wrap/PatchBox.m: -------------------------------------------------------------------------------- 1 | function self = PatchBox(varargin) 2 | self = DefaultPatchBox(varargin{:}); 3 | endfunction 4 | -------------------------------------------------------------------------------- /octmvp/wrap/PixelResult.m: -------------------------------------------------------------------------------- 1 | function self = PixelResult(varargin) 2 | self = DefaultPixelResult(varargin{:}); 3 | endfunction 4 | -------------------------------------------------------------------------------- /octmvp/wrap/Seed.m: -------------------------------------------------------------------------------- 1 | function self = Seed(varargin) 2 | self = DefaultSeed(varargin{:}); 3 | endfunction 4 | -------------------------------------------------------------------------------- /octmvp/wrap/Seeder.m: -------------------------------------------------------------------------------- 1 | function self = Seeder(varargin) 2 | self = SimpleSeeder(varargin{:}); 3 | endfunction 4 | -------------------------------------------------------------------------------- /octmvp/wrap/Stepper.m: -------------------------------------------------------------------------------- 1 | function self = Stepper(varargin) 2 | self = SimpleStepper(varargin{:}); 3 | endfunction 4 | -------------------------------------------------------------------------------- /octmvp/wrap/TileResult.m: -------------------------------------------------------------------------------- 1 | function self = TileResult(varargin) 2 | self = DefaultTileResult(varargin{:}); 3 | endfunction 4 | -------------------------------------------------------------------------------- /old/OrbitFoot/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find VW packages 2 | find_package(VW REQUIRED COMPONENTS Cartography Camera Plate) 3 | include_directories(${VW_INCLUDE_DIRS}) 4 | 5 | add_executable(orbitfoot orbitfoot.cc) 6 | target_link_libraries(orbitfoot ${VW_LIBRARIES}) 7 | 8 | add_executable(backproj_test backproj_test.cc) 9 | target_link_libraries(backproj_test ${VW_LIBRARIES}) 10 | 11 | if (BUILD_TESTS) 12 | add_subdirectory(tests) 13 | endif() 14 | -------------------------------------------------------------------------------- /old/OrbitFoot/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) 2 | include_directories(${CMAKE_SOURCE_DIR}/src) 3 | 4 | find_package(GTest REQUIRED) 5 | include_directories(${GTEST_INCLUDE_DIRS}) 6 | 7 | find_package(VW REQUIRED COMPONENTS Cartography Camera Plate) 8 | include_directories(${VW_INCLUDE_DIRS}) 9 | 10 | add_executable(TestOrbitFoot TestOrbitFoot.cxx 11 | ${CMAKE_SOURCE_DIR}/src/test/test_main.cc) 12 | target_link_libraries(TestOrbitFoot ${GTEST_LIBRARIES} 13 | ${VW_LIBRARY} 14 | ${VW_CARTOGRAPHY_LIBRARY} 15 | ${VW_CAMERA_LIBRARY}) 16 | set_target_properties(TestOrbitFoot PROPERTIES COMPILE_FLAGS 17 | "-DTEST_SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}\\\" -DTEST_OBJDIR=\\\"${CMAKE_CURRENT_BINARY_DIR}\\\"") 18 | 19 | add_test(AllTestsInOrbitFoot TestOrbitFoot) 20 | -------------------------------------------------------------------------------- /old/compilefail/blah.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | void start() { 9 | const char * argvv [] = {"", "--silent"}; 10 | ::octave_main (2, (char **) argvv, true); 11 | } 12 | 13 | void end() { 14 | std::cout << "eh" << std::endl; 15 | do_octave_atexit(); 16 | } 17 | -------------------------------------------------------------------------------- /old/compilefail/blah.h: -------------------------------------------------------------------------------- 1 | void start(); 2 | void end(); 3 | -------------------------------------------------------------------------------- /old/compilefail/compile.sh: -------------------------------------------------------------------------------- 1 | g++ -Wall -fPIC -I/opt/local/include -I/opt/local/include/octave-3.6.3 -c blah.cpp 2 | 3 | g++ -dynamiclib -o libzip.dylib blah.o -L/opt/local/lib/octave/3.6.3 -loctinterp -loctave -lcruft 4 | 5 | g++ -Wall -fPIC -o test.o -c test.cpp 6 | 7 | # this works: 8 | #g++ test.o -o run -L/opt/local/lib/octave/3.6.3 libzip.dylib /opt/local/lib/octave/3.6.3/liboctinterp.dylib -loctave -lcruft /opt/local/lib/libprotobuf.dylib 9 | # this doesn't work: 10 | g++ test.o -o run -L/opt/local/lib/octave/3.6.3 libzip.dylib /opt/local/lib/libprotobuf.dylib /opt/local/lib/octave/3.6.3/liboctinterp.dylib -loctave -lcruft 11 | 12 | #if you recompile protobuffers with mp-gcc45 (same as what octave was compiled with), both work 13 | -------------------------------------------------------------------------------- /old/compilefail/test.cpp: -------------------------------------------------------------------------------- 1 | #include "blah.h" 2 | #include 3 | 4 | int main(int argc, char* argv[]) 5 | { 6 | std::cout << "hello world" << std::endl; 7 | start(); 8 | end(); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /old/matlab/20111125_impl/mpbackproj.m: -------------------------------------------------------------------------------- 1 | function [Ortho, R] = mpbackproj(Patch, R) 2 | % Patch: multiple view structure 3 | % Ortho: Back-projected images 4 | % Sight: Projected point of Patch Center 5 | % R: Rotation 6 | 7 | if nargin < 2, R=q2dcm(Patch.q); end 8 | for i=1:Patch.n 9 | % homography 10 | Sight{i} = Patch.r*Patch.Pe{i}+Patch.camera{i}(:,4); 11 | H = [Patch.camera{i}(:,1:3)*R(:,1:2)*diag(Patch.scaleSpatial) Sight{i}]; 12 | 13 | tform = maketform('projective',inv(H)'); 14 | Ortho(:,:,i) = imtransform(Patch.image{i},tform,'bicubic',... 15 | 'xdata',Patch.xdata,'ydata',Patch.ydata); 16 | end -------------------------------------------------------------------------------- /old/matlab/20111125_impl/mpvisible.m: -------------------------------------------------------------------------------- 1 | function visible = mpvisible(Views) 2 | 3 | if ~isfield(Views, 'rangeLarge') 4 | Views.rangeLarge = [Views.elevation Views.elevation]; 5 | end 6 | 7 | if ~isfield(Views, 'radiusMoon') 8 | Views.radiusMoon = Views.radiusMoon; 9 | end 10 | 11 | if numel(Views.image) ~= numel(Views.camera) 12 | disp('error in szR(2) ~= szA(3)'); 13 | end 14 | 15 | if ~isfield(Views, 'v') 16 | v = pix2dir(Views.georef,Views.center); 17 | else 18 | v = Views.v; 19 | end 20 | 21 | % augment the width by radiusMoon (2) of the cubic nterpolation 22 | Views.georef=Views.georef; 23 | 24 | % center normal 25 | n = pix2dir(Views.georef,Views.center); 26 | visible = true; 27 | for i=1:numel(Views.camera) 28 | z = repmat(Views.center,1,4)+Views.radiusPatch(1)*[1 1 -1 -1; 1 -1 1 -1]; 29 | e = pix2dir(Views.georef,z); 30 | s = (v'*n)./(v'*e); 31 | es = e*diag(s); 32 | r = Views.radiusMoon+Views.rangeLarge; 33 | u = Views.camera{i}*[es*r(1) es*r(2); ones(1,8)]; 34 | b = u(1:2,:)./[u(3,:); u(3,:)]; 35 | 36 | maxb = ceil(max(b,[],2)); 37 | minb = floor(min(b,[],2)); 38 | 39 | if minb > 0 & maxb < size(Views.image{i})' 40 | Views.visible{i} = true; 41 | else 42 | Views.visible{i} = false; 43 | visible = false; 44 | end 45 | end -------------------------------------------------------------------------------- /old/matlab/geom_patch/MultiViewCorr.m: -------------------------------------------------------------------------------- 1 | % read multiple-view data 2 | % Mviews=mvread(); 3 | 4 | Patch.center=[600; 400]; 5 | Patch.width=[30 3]; % correlation and smoothing window size 6 | Patch.height=-2605; 7 | Patch.range=[-2605 -2605]; % crop the region of interest 8 | Patch.plane=[pix2dir(Mviews.georef,Patch.center); ... 9 | Mviews.radius+Patch.height]; 10 | 11 | Patch=mvcrop(Mviews,Patch); 12 | Patch=mvorthoproj(Patch); 13 | 14 | p = Patch.plane; 15 | mvGeoPatchGaus(p,Patch); 16 | 17 | options = optimset('LargeScale','on','Display','iter'); 18 | options = optimset(options,'GradObj','on','GradConstr','on'); 19 | options = optimset(options,'TolFun',1e-7,'TolX',1e-7); 20 | options = optimset(options,'MaxFunEvals',120000,'MaxIter',300); 21 | 22 | before = now; 23 | datestr(before) 24 | 25 | [p,fval,exitflag,output] = fmincon(@(p)mvGeoPatchGaus(p,Patch),p,[],[],[],[], ... 26 | [],[],@(p)UnitNorm(p),options); 27 | 28 | after = now; 29 | datestr(before) 30 | datestr(after) 31 | (after-before)*24*3600 32 | 33 | for i=1:numel(Patch.ortho) 34 | figure(1), subplot(2,2,i), imshow(Patch.image{i}); 35 | figure(2), subplot(2,2,i), imshow(Patch.ortho{i}); 36 | end -------------------------------------------------------------------------------- /old/matlab/geom_patch/UnitNorm.m: -------------------------------------------------------------------------------- 1 | function [c,ceq,DC,DCeq] = UnitNorm(p) 2 | % No nonlinear inequality constraints 3 | c = []; 4 | ceq = p(1:3)'*p(1:3)-1; 5 | 6 | % Gradient of the constraints 7 | if nargout > 2 8 | DC = []; 9 | DCeq = [2*p(1:3); 0]; 10 | end -------------------------------------------------------------------------------- /old/matlab/geom_patch/mpcrop.m: -------------------------------------------------------------------------------- 1 | function Patch = mpcrop(Views,Patch) 2 | 3 | if ~isfield(Patch, 'range') 4 | Patch.range = [Patch.elevation Patch.elevation]; 5 | end 6 | 7 | if numel(Views.image) ~= numel(Views.camera) 8 | disp('error in szR(2) ~= szA(3)'); 9 | end 10 | 11 | % augment the width by radius (2) of the cubic nterpolation 12 | w = Patch.width(1)/2 + 2; 13 | Patch.georef=Views.georef; 14 | 15 | for i=1:numel(Views.camera) 16 | z = repmat(Patch.center,1,4)+w*[1 1 -1 -1; 1 -1 1 -1]; 17 | e = pix2dir(Views.georef,z); 18 | r = Views.radius+Patch.range; 19 | u = Views.camera{i}*[e*r(1) e*r(2); ones(1,8)]; 20 | b = u(1:2,:)./[u(3,:); u(3,:)]; 21 | 22 | maxb = ceil(max(b,[],2)); 23 | minb = floor(min(b,[],2)); 24 | 25 | Patch.image{i}=imcrop(Views.image{i},[minb maxb-minb-1]); 26 | 27 | % homography to rebase the index 28 | H=[eye(2) 1-minb; zeros(1,2) 1]; 29 | Patch.camera{i}=H*Views.camera{i}; 30 | end 31 | 32 | end %mvcrop -------------------------------------------------------------------------------- /old/matlab/geom_patch/mporthoproj.m: -------------------------------------------------------------------------------- 1 | function Patch = mporthoproj(Patch) 2 | % Patch.plane: plane parmeters Patch.plane(1:3) normal vector Patch.plane(4) distance from the origin 3 | % I: Orbital images 4 | % P: Projection matrices 5 | % H: Homgraphy transformation 6 | % Patch.center: center point [x; y] 7 | 8 | % normalized plane 9 | p = Patch.plane/norm(Patch.plane(1:3)); 10 | v = p(1:3); % normal vector 11 | d = p(4); % distance from the origin 12 | 13 | % direction vector and its Jacobian 14 | [e, de] = pix2dir(Patch.georef,Patch.center); 15 | 16 | n=numel(Patch.camera); 17 | for i=1:n 18 | Q = d*Patch.camera{i}(:,1:3)+Patch.camera{i}(:,4)*v'; 19 | Patch.sight{i} = Q*e; % line of sight at center 20 | S = Q*de*Patch.georef(1:2,1:2); 21 | 22 | % homography 23 | Patch.homo{i} = [S Patch.sight{i}-S*Patch.center]; 24 | Patch.ihomo{i} = inv(Patch.homo{i}); 25 | 26 | tform = maketform('projective',Patch.ihomo{i}'); 27 | Patch.ortho{i} = imtransform(Patch.image{i},tform,'bicubic',... 28 | 'xdata',Patch.center(1)+Patch.width(1)*[-1 1]/2,... 29 | 'ydata',Patch.center(2)+Patch.width(1)*[-1 1]/2,... 30 | 'FillValues',Patch.fill*i); 31 | end -------------------------------------------------------------------------------- /old/matlab/geom_patch/mvGeoPatchGaus.m: -------------------------------------------------------------------------------- 1 | function [f,g]=mvgeopatchGaus(p,Patch) 2 | % p: plane parmeters p(1:3) normal vector p(4) distance from the origin 3 | % I: Orbital images 4 | % P: Projection matrices 5 | % Patch.georef: Homgraphy transformation 6 | % Patch.center: center point 7 | 8 | p = p/norm(p(1:3)); % normalized plane 9 | v = p(1:3); % normal vector 10 | d = p(4); % distance from the origin 11 | 12 | % correlation and smoothing windows 13 | gc = diff(normcdf([-Patch.width(1)/2-0.5:Patch.width(1)/2+0.5],0,Patch.width(1)/6)); 14 | gc = gc/sum(gc); 15 | gs = diff(normcdf([-Patch.width(2)/2-0.5:Patch.width(2)/2+0.5],0,Patch.width(2)/6)); 16 | gs = gs/sum(gs); 17 | 18 | % direction vector and its Jacobian 19 | [e, de] = pix2dir(Patch.georef,Patch.center); 20 | 21 | Patch=mvorthoproj(Patch); 22 | Im = conv2(gs,gs,Patch.ortho{1},'same'); 23 | f = gc*Im.^2*gc'; 24 | n = numel(Patch.ortho); 25 | for i=2:n 26 | Is = conv2(gs,gs,Patch.ortho{i},'same'); 27 | f = f + gc*Is.^2*gc'; 28 | Im = Im + Is; 29 | end 30 | f = f - gc*Im.^2*gc' / n; 31 | 32 | % Gradient of the objective function 33 | if nargout > 1 34 | g=mpgrad(p, Patch); 35 | end 36 | 37 | 38 | -------------------------------------------------------------------------------- /old/matlab/geom_patch/mvJacP4.m: -------------------------------------------------------------------------------- 1 | function [J, Patch] = mvJacP4(d, Patch) 2 | % p: distance from the origin 3 | % Patch.camera: Projection matrix 4 | % S: Similar transformation 5 | % Patch.center: center point 6 | % t: translation 7 | 8 | if ~isfield(Patch,'point') 9 | Patch.point = Patch.center; 10 | end 11 | v=Patch.plane(1:3); 12 | e=pix2dir(Patch.georef,Patch.center); 13 | x=d*e/(v'*e); 14 | 15 | [e,de]=pix2dir(Patch.georef,Patch.point); 16 | J = []; 17 | for i=1:numel(Patch.camera) 18 | % correponding point in the orbital image 19 | u=(d*Patch.camera{i}(:,1:3)+Patch.camera{i}(:,4)*v')*e; 20 | 21 | if nargout > 1 22 | Patch.sight{i} = u; 23 | end 24 | 25 | % intermediate matrices 26 | Q(:,:,1)=x*Patch.camera{i}(1,1:3)+Patch.camera{i}(1,4)*eye(3); 27 | Q(:,:,2)=x*Patch.camera{i}(2,1:3)+Patch.camera{i}(2,4)*eye(3); 28 | Q(:,:,3)=x*Patch.camera{i}(3,1:3)+Patch.camera{i}(3,4)*eye(3); 29 | 30 | Q1=u(3)*Q(:,:,1)-u(1)*Q(:,:,3); 31 | Q2=u(3)*Q(:,:,2)-u(2)*Q(:,:,3); 32 | B1=[u(3)*Patch.camera{i}(1,1:3)-u(1)*Patch.camera{i}(3,1:3)]'; 33 | B2=[u(3)*Patch.camera{i}(2,1:3)-u(2)*Patch.camera{i}(3,1:3)]'; 34 | 35 | % coefficient matrix and its inverse 36 | C=[v'*Q1; v'*Q2]*de; 37 | 38 | % Jacobian with respect to the terrain plane 39 | J=[J -Patch.georef(1:2,1:2)\(C\[e'*B1; e'*B2])]; 40 | end -------------------------------------------------------------------------------- /old/matlab/geom_patch/mv_sym_separable_jacobian.m: -------------------------------------------------------------------------------- 1 | clear all 2 | 3 | syms sx sy cx cy real 4 | syms v1 v2 v3 d real 5 | v = [v1 v2 v3]' 6 | e = [cx*cy sx*cy sy]'; 7 | de = [-sx*cy cx*cy 0; -cx*sy -sx*sy cy]'; 8 | 9 | for i=1:3 10 | for j=1:3 11 | for k=1:3 12 | str = sprintf('syms q%d%d%d real;', i,j,k); 13 | eval(str); 14 | str = sprintf('Q%d(%d,%d)=q%d%d%d;', i,j,k,i,j,k); 15 | eval(str); 16 | end 17 | end 18 | end 19 | 20 | for i=1:3 21 | for j=1:4 22 | str = sprintf('syms p%d%d real;',i,j); 23 | eval(str); 24 | str = sprintf('P(%d,%d)=p%d%d;',i,j,i,j); 25 | eval(str); 26 | end 27 | str = sprintf('p%d=transpose(P(%d,1:3));',i,i); 28 | eval(str); 29 | end 30 | 31 | u = d*P(:,1:3)*e+P(:,4)*v'*e 32 | 33 | Q13 = u(3)*Q1-u(1)*Q3; 34 | Q23 = u(3)*Q2-u(2)*Q3; 35 | C = simple([v'*(u(3)*Q1-u(1)*Q3); v'*(u(3)*Q2-u(2)*Q3)]*de); 36 | D = det(C); 37 | 38 | B13 = [Q13 u(3)*p1-u(1)*p3]; 39 | B23 = [Q23 u(3)*p2-u(2)*p3]; 40 | B = [e'*B13; e'*B23]; -------------------------------------------------------------------------------- /old/matlab/geom_patch/mvcCombine2DEM.m: -------------------------------------------------------------------------------- 1 | close all 2 | 3 | max_abs = 5; 4 | range = [50 -50; 80 -80; 50 -50; 50 -50]; 5 | 6 | gDEM = imread('../../ground-DEM.tif'); 7 | tDEM=load('../../rDEM'); 8 | bDEM=load('F:/MultiviewTK/rDEM'); 9 | 10 | idx=find(bDEM.rDEM); 11 | tDEM.rDEM(idx)=bDEM.rDEM(idx); 12 | 13 | rDEM = tDEM.rDEM; 14 | 15 | minDEM = min(gDEM(:)); 16 | maxDEM = max(gDEM(:)); 17 | 18 | idx=find(rDEM); 19 | dDEM = zeros(size(rDEM)); 20 | dDEM(idx) = rDEM(idx)-gDEM(idx); 21 | idx = find(rDEM ~= 0 & dDEM < range(1,1) & dDEM > range(1,2)); 22 | mDEM = mean(dDEM(idx)); 23 | sDEM = std(dDEM(idx)); 24 | [mDEM sDEM] 25 | % dDEM(find(dDEM>range(1,1)))=range(1,1); 26 | % dDEM(find(dDEMmaxDEM))=maxDEM; 31 | rDEM(find(rDEM 1 9 | g = pv.grad_p/pv.p; 10 | end -------------------------------------------------------------------------------- /old/matlab/mvp_patch/mvGrad.m: -------------------------------------------------------------------------------- 1 | function g = mvGrad(w,varargin) 2 | % objective and gradient of objective function, 3 | % for the problem defined in driver1.c for ASA v2.2 4 | pv = varargin{1}.pv; 5 | pv.W = reshape(w,size(pv.Ws)); 6 | pv.proj; 7 | f=reallog(pv.corelate+PatchViews.eps_p); 8 | if nargin > 1 9 | g = pv.grad_p/pv.p; 10 | end -------------------------------------------------------------------------------- /old/matlab/mvp_patch/symDet.m: -------------------------------------------------------------------------------- 1 | n = 3; 2 | str_a = ['syms ']; 3 | str_b = str_a; 4 | vec_a = ['a = [']; 5 | vec_b = ['b = [']; 6 | for k = 1:n 7 | str_a = [str_a ' a' num2str(k)]; 8 | str_b = [str_b ' b' num2str(k)]; 9 | vec_a = [vec_a ' a' num2str(k)]; 10 | vec_b = [vec_b ' b' num2str(k)]; 11 | end 12 | vec_a = [vec_a ']']; 13 | vec_b = [vec_b ']']; 14 | eval([str_a ' real']) 15 | eval([str_b ' real']) 16 | eval(vec_a) 17 | eval(vec_b) 18 | -------------------------------------------------------------------------------- /old/matlab/mvp_patch/symSloppy.m: -------------------------------------------------------------------------------- 1 | syms a x y xz yz tx ty real 2 | 3 | t = [tx ty]' 4 | R = [cos(a) -sin(a); sin(a) cos(a)] 5 | z = [x y]' 6 | tz = [xz yz]' 7 | 8 | E = z-R*(z+tz)-t 9 | simple(expand(E'*E)) 10 | 11 | syms x y a b real 12 | c = x*a+y*b; 13 | s = x*b-y*a; 14 | R = [c -s; s c]; 15 | D = [x y]*R*[a b]'; 16 | simple(D) 17 | 18 | + 2*x^2 + 2*y^2 19 | + tx^2 + ty^2 20 | + xz^2 + yz^2 21 | + 2*x*xz 22 | - 2*ty*y 23 | - 2*tx*x 24 | + 2*y*yz + 25 | - 2*x^2*cos(a) - 2*y^2*cos(a) 26 | + 2*tx*x*cos(a) + 2*tx*xz*cos(a) 27 | + 2*ty*y*cos(a) + 2*ty*yz*cos(a) 28 | - 2*x*xz*cos(a) - 2*y*yz*cos(a) 29 | + 2*ty*x*sin(a) + 2*ty*xz*sin(a) 30 | - 2*tx*y*sin(a) - 2*tx*yz*sin(a) 31 | + 2*x*yz*sin(a) - 2*xz*y*sin(a) 32 | -------------------------------------------------------------------------------- /old/matlab/photo_patch/DrPlaneHomography.m: -------------------------------------------------------------------------------- 1 | function J = ortho_proj(I,P,p,H,c) 2 | % p: plane parmeters p(1:3) normal vector p(4) distance from the origin 3 | % I: Orbital images 4 | % P: Projection matrices 5 | % H: Homgraphy transformation 6 | % c: center point 7 | 8 | p = p/norm(p(1:3)); % normalized plane 9 | v = p(1:3); % normal vector 10 | d = p(4); % distance from the origin 11 | 12 | % direction vector and its Jacobian 13 | [e, de] = pix2dir(H,c); 14 | 15 | sz=size(P); 16 | 17 | for i=1:sz(3) 18 | Q = d*P(:,1:3,i)+P(:,4,i)*v'; 19 | u = Q*e; 20 | S = Q*de*H(1:2,1:2); 21 | 22 | % homography 23 | Hp = [S u-S*z]; 24 | 25 | tform = maketform('projective',Hp); 26 | J = imtransform(I,tform,'bicubic','size',[10 10]); 27 | end -------------------------------------------------------------------------------- /old/matlab/photo_patch/GaussPhoto.m: -------------------------------------------------------------------------------- 1 | function [a, b, c] = GaussPhoto(P); 2 | sz=size(P); 3 | idx0 = find(P==0); 4 | b = zeros(3,1); 5 | c = ones(3,1); 6 | a_old = zeros(sz(1),1); 7 | for i = 1:10 8 | a = ((P-repmat(b',sz(1),1))*c)/(c'*c); 9 | P(idx0) = a(idx0)*c(1)+b(1); 10 | d = [ones(sz(1),1) a]\P; 11 | b = d(1,:)'; 12 | c = d(2,:)'; 13 | norm(a-a_old) 14 | a_old = a; 15 | end -------------------------------------------------------------------------------- /old/matlab/photo_patch/NormalJacobian.m: -------------------------------------------------------------------------------- 1 | function [J] = NormalJacobian(p, P, S, t, z) 2 | % p: plane parmeters p(1:3) normal vector p(4) distance from the origin 3 | % P: Projection matrix 4 | % S: Similar transformation 5 | % t: translation 6 | % z: center point 7 | p = p/norm(p(1:3)); % normalized plane 8 | v = p(1:3); % normal vector 9 | d = p(4); % distance from the origin 10 | 11 | % spherical angles from pixel coordinates in a orthographic image 12 | a = S*z+t; % spherical angles (longitude and latitude) 13 | ca = cos(a); % cosine of spherical angles 14 | sa = sin(a); % sine of spherical angles 15 | 16 | % direction vector and its Jacobian 17 | e = [ca(1)*ca(2); sa(1)*ca(2); sa(2)]; 18 | de = [-sa(1)*ca(2) -ca(1)*sa(2); ca(1)*ca(2) -sa(1)*sa(2); 0 ca(2)]; 19 | x = d*e/(v'*e); 20 | H = v'*x*P(:,1:3)+P(:,4)*v'; 21 | u = H*e; 22 | Q1=x*P(1,1:3)+P(1,4)*eye(3); 23 | Q2=x*P(2,1:3)+P(2,4)*eye(3); 24 | Q3=x*P(3,1:3)+P(3,4)*eye(3); 25 | A1=u(3)*Q1-u(1)*Q3; 26 | A2=u(3)*Q2-u(2)*Q3; 27 | b=[e'*(A1'*v*v'+A1); e'*(A2'*v*v'+A2)]; 28 | C=[v'*A1; v'*A2]*de; 29 | dv=-S\C\b; 30 | dr=-S\C\[u(3)*P(1,1:3)-u(1)*P(3,1:3); u(3)*P(2,1:3)-u(2)*P(3,1:3)]*e*v'*e; 31 | J=[dv dr]'; -------------------------------------------------------------------------------- /old/matlab/photo_patch/PlaneHomography.m: -------------------------------------------------------------------------------- 1 | function H = PlaneHomography(p, P, H, z) 2 | % p: plane parmeters p(1:3) normal vector p(4) distance from the origin 3 | % P: Projection matrix 4 | % H: Homgraphy transformation 5 | % t: translation 6 | % z: center point 7 | 8 | p = p/norm(p(1:3)); % normalized plane 9 | v = p(1:3); % normal vector 10 | d = p(4); % distance from the origin 11 | 12 | % spherical angles from pixel coordinates in a orthographic image 13 | a = H*[z;1]; % spherical angles (longitude and latitude) 14 | a = a(1:2)/a(3); % inhomonizing the coordinates 15 | ca = cos(a); % cosine of spherical angles 16 | sa = sin(a); % sine of spherical angles 17 | 18 | % direction vector and its Jacobian 19 | e = [ca(1)*ca(2); sa(1)*ca(2); sa(2)]; 20 | de = [-sa(1)*ca(2) -ca(1)*sa(2); ca(1)*ca(2) -sa(1)*sa(2); 0 ca(2)]; 21 | 22 | Q = d*P(:,1:3)+P(:,4)*v'; 23 | u = Q*e; 24 | S = Q*de*H(1:2,1:2); 25 | 26 | % homography 27 | H = [S u-S*z]; -------------------------------------------------------------------------------- /old/matlab/photo_patch/PoissBias.m: -------------------------------------------------------------------------------- 1 | function [f, g] = PoissBias(b,a,c,P); 2 | sz=size(P); 3 | D = P+repmat(b',sz(1),1); 4 | La = log(a*c'); 5 | Ld = log(D); 6 | f = D.*Ld-D.*La-D; 7 | f = sum(f(:)); 8 | 9 | if nargout > 1 10 | g = sum(Ld-La)'; 11 | end -------------------------------------------------------------------------------- /old/matlab/photo_patch/PoissPhoto.m: -------------------------------------------------------------------------------- 1 | function [a, b, c] = PoissPhoto(P) 2 | sz=size(P); 3 | idx0 = find(P==0); 4 | b = zeros(3,1); 5 | c = ones(3,1); 6 | a_old = zeros(sz(1),1); 7 | options = optimset('GradObj','on'); 8 | for i = 1:10 9 | D = P+repmat(b',sz(1),1); 10 | a = sum(D,2)/sum(c); 11 | c = sum(D,1)'/sum(a); 12 | P(idx0) = a(idx0)*c(1)-b(1); 13 | b = fminunc(@PoissBias,b,options,a,c,P); 14 | norm(a-a_old) 15 | a_old = a; 16 | end -------------------------------------------------------------------------------- /old/matlab/photo_patch/PseudoJacobian.m: -------------------------------------------------------------------------------- 1 | function [J] = PseudoJacobian(p, P, S, t, z) 2 | % p: plane parmeters p(1:3) normal vector p(4) distance from the origin 3 | % P: Projection matrix 4 | % S: Similar transformation 5 | % t: translation 6 | % z: center point 7 | 8 | v = p(1:3); % normal vector 9 | d = p(4); % distance from the origin 10 | 11 | % spherical angles from pixel coordinates in a orthographic image 12 | a = S*z+t; % spherical angles (longitude and latitude) 13 | ca = cos(a); % cosine of spherical angles 14 | sa = sin(a); % sine of spherical angles 15 | 16 | % direction vector and its Jacobian 17 | e = [ca(1)*ca(2); sa(1)*ca(2); sa(2)]; 18 | de = [-sa(1)*ca(2) -ca(1)*sa(2); ca(1)*ca(2) -sa(1)*sa(2); 0 ca(2)]; 19 | x = d*e/(v'*e); 20 | H = v'*x*P(:,1:3)+P(:,4)*v'; 21 | u = H*e; 22 | Q1=x*P(1,1:3)+P(1,4)*eye(3); 23 | Q2=x*P(2,1:3)+P(2,4)*eye(3); 24 | Q3=x*P(3,1:3)+P(3,4)*eye(3); 25 | C=[v'*Q1; v'*Q2; v'*Q3]*de; 26 | CS=C*S; 27 | dx=-S\(C\[Q1(:,1) Q2(:,1) Q3(:,1)]'*e); 28 | dy=-S\(C\[Q1(:,2) Q2(:,2) Q3(:,2)]'*e); 29 | dz=-S\(C\[Q1(:,3) Q2(:,3) Q3(:,3)]'*e); 30 | dr=-S\(C\P(:,1:3)*e*v'*e); 31 | J=[dx dy dz dr]'; -------------------------------------------------------------------------------- /old/matlab/photo_patch/quat2rot.m: -------------------------------------------------------------------------------- 1 | function R = quat2rot(q) 2 | w2 = q(1)*q(1), x2 = q(2)*q(2), y2 = q(3)*q(3), z2 = q(4)*q(4); 3 | wx = q(1)*q(2), wy = q(1)*q(3), wz = q(1)*q(4); 4 | xy = q(2)*q(3), yz = q(3)*q(4), zx = q(4)*q(2); 5 | R(1,1) = w2 + x2 - y2 - z2; 6 | R(2,2) = w2 - x2 + y2 - z2; 7 | R(3,3) = w2 - x2 - y2 + z2; 8 | R(1,2) = 2 * (xy - wz); 9 | R(1,3) = 2 * (zx + wy); 10 | R(2,3) = 2 * (yz - wx); 11 | R(2,1) = 2 * (xy + wz); 12 | R(3,1) = 2 * (zx - wy); 13 | R(3,2) = 2 * (yz + wx); 14 | end -------------------------------------------------------------------------------- /old/mvp/Config.h.in: -------------------------------------------------------------------------------- 1 | /// \file Config.h 2 | /// 3 | /// Holds configurations used when built 4 | /// 5 | 6 | #ifndef __MVP_CONFIG_H__ 7 | #define __MVP_CONFIG_H__ 8 | 9 | #define CMAKE_OPTION_ON 1 10 | #define CMAKE_OPTION_OFF 0 11 | 12 | #define MVP_ENABLE_OCTAVE_SUPPORT CMAKE_OPTION_@ENABLE_OCTAVE_SUPPORT@ 13 | 14 | #if MVP_ENABLE_OCTAVE_SUPPORT 15 | #define MVP_MFILE_INSTALL_DIR "@MFILE_INSTALL_DIR@" 16 | #define MVP_OCTFILE_INSTALL_DIR "@OCTFILE_INSTALL_DIR@" 17 | #define MVP_OCTAVE_ALGORITHM_FCN "mvpalgorithm" 18 | #define MVP_OCTAVE_FOOTPRINT_FCN "mvpfootprint" 19 | #endif 20 | 21 | #define MVP_COMMAND_PORT "6677" 22 | #define MVP_STATUS_PORT "6678" 23 | #define MVP_BROADCAST_PORT "6679" 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /old/mvp/ConvexPolygon.h: -------------------------------------------------------------------------------- 1 | /// \file ConvexPolygon.h 2 | /// 3 | /// Convex Polygon Class 4 | /// 5 | /// TODO: Write me! 6 | 7 | #ifndef __MVP_CONVEXPOLYGON_H__ 8 | #define __MVP_CONVEXPOLYGON_H__ 9 | 10 | #include 11 | #include 12 | 13 | namespace mvp { 14 | 15 | struct ConvexPolygon { 16 | typedef std::vector VertexList; 17 | 18 | private: 19 | VertexList m_vertices; 20 | 21 | public: 22 | ConvexPolygon() : m_vertices() {} 23 | 24 | ConvexPolygon(VertexList pts); 25 | 26 | VertexList vertices() const {return m_vertices;} 27 | 28 | vw::BBox2 bounding_box() const; 29 | 30 | /// Return the circulation direction of three points. Negative if clockwise, 31 | /// positive if anticlockwise, zero if colinear. For Y pointing up, X pointing right 32 | static double circulation_direction(vw::Vector2 const& v0, vw::Vector2 const& v1, vw::Vector2 const& v) { 33 | return (v.y() - v0.y()) * (v1.x() - v0.x()) - (v.x() - v0.x()) * (v1.y() - v0.y()); 34 | } 35 | 36 | bool contains(vw::Vector2 const& pt) const; 37 | 38 | bool intersects(ConvexPolygon const& other) const; 39 | 40 | bool intersects(vw::BBox2 const& bbox) const; 41 | 42 | }; 43 | 44 | } // namespace mvp 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /old/mvp/MVPAlgorithmOptions.proto: -------------------------------------------------------------------------------- 1 | package mvp; 2 | 3 | message MVPAlgorithmOptions { 4 | required double alt_range = 1; 5 | optional bool fix_orientation = 2 [default=true]; 6 | optional bool fix_windows = 3 [default=true]; 7 | optional int32 max_iterations = 4 [default=80]; 8 | optional double gauss_divisor = 5 [default=6]; 9 | optional bool fast_reflectance = 6 [default=true]; 10 | } 11 | -------------------------------------------------------------------------------- /old/mvp/MVPJob.h: -------------------------------------------------------------------------------- 1 | /// \file MVPJob.h 2 | /// 3 | /// MVP Job class 4 | /// 5 | /// TODO: Write something here 6 | /// 7 | 8 | #ifndef __MVP_MVPJOB_H__ 9 | #define __MVP_MVPJOB_H__ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace mvp { 16 | 17 | class MVPJob { 18 | MVPJobRequest m_job_request; 19 | OrbitalImageCropCollection m_crops; 20 | 21 | public: 22 | MVPJob(MVPJobRequest const& job_request); 23 | 24 | MVPTileResult process_tile(vw::ProgressCallback const& progress = vw::ProgressCallback::dummy_instance()) const; 25 | 26 | void write_tile(MVPTileResult const& result) const; 27 | 28 | MVPTileResult process_and_write_tile(vw::ProgressCallback const& progress = vw::ProgressCallback::dummy_instance()) const; 29 | 30 | static MVPJobRequest load_job_file(std::string const& filename); 31 | 32 | std::string save_job_file(std::string const& out_dir = ".") const; 33 | }; 34 | 35 | } // namespace mvp 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /old/mvp/MVPJobQueue.h: -------------------------------------------------------------------------------- 1 | /// \file MVPJobQueue.h 2 | /// 3 | /// MVP Job Queue 4 | /// 5 | /// TODO: Write something here 6 | /// 7 | 8 | #include 9 | #include 10 | 11 | #ifndef __MVP_MVPJOBQUEUE_H__ 12 | #define __MVP_MVPJOBQUEUE_H__ 13 | 14 | namespace mvp { 15 | 16 | class MVPJobQueue { 17 | boost::shared_ptr m_work; 18 | vw::BBox2i m_render_bbox; 19 | int m_render_level; 20 | 21 | public: 22 | MVPJobQueue() : m_render_level(0) {} 23 | 24 | void reset(std::string const& mvp_conf) { 25 | std::cout << "Launching: " << mvp_conf << std::endl; 26 | } 27 | 28 | bool has_next() { 29 | return false; 30 | } 31 | 32 | MVPJobRequest next() { 33 | return MVPJobRequest(); 34 | } 35 | 36 | void update_status(MVPStatusUpdate const& update) { 37 | std::cout << "Received status update: " << update.status() << std::endl; 38 | } 39 | 40 | MVPStatusReport status() const { 41 | return MVPStatusReport(); 42 | } 43 | }; 44 | 45 | } // namespace mvp 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /old/mvp/MVPJobRequest.proto: -------------------------------------------------------------------------------- 1 | package mvp; 2 | 3 | import "mvp/OrbitalImageFileDescriptor.proto"; 4 | import "mvp/MVPUserSettings.proto"; 5 | import "vw/Cartography/GeoReferenceDesc.proto"; 6 | 7 | message MVPJobRequest { 8 | required int32 col = 1; 9 | required int32 row = 2; 10 | required int32 level = 3; 11 | required int32 tile_size = 4; 12 | 13 | required string result_platefile = 5; 14 | required string internal_result_platefile = 6; 15 | required vw.cartography.GeoReferenceDesc georef = 7; 16 | required MVPUserSettings user_settings = 8; 17 | repeated OrbitalImageFileDescriptor orbital_images = 9; 18 | optional bool use_octave = 10 [default=false]; 19 | optional bool draw_footprints = 11 [default=false]; 20 | } 21 | -------------------------------------------------------------------------------- /old/mvp/MVPMessages.proto: -------------------------------------------------------------------------------- 1 | package mvp; 2 | 3 | import "mvp/MVPJobRequest.proto"; 4 | 5 | message MVPCommand { 6 | enum CommandType { 7 | LAUNCH = 0; 8 | STATUS = 1; 9 | INFO = 2; 10 | ABORT = 3; 11 | KILL = 4; 12 | JOB = 5; 13 | } 14 | 15 | required CommandType cmd = 1; 16 | optional string conf_file = 2; 17 | } 18 | 19 | message MVPCommandReply { 20 | required MVPCommand.CommandType cmd = 1; 21 | optional MVPJobRequest job_request = 2; 22 | optional MVPStatusReport status_report = 3; 23 | } 24 | 25 | message MVPStatusReport { 26 | 27 | } 28 | 29 | message MVPStatusUpdate { 30 | required double status = 1; 31 | } 32 | 33 | message MVPWorkerBroadcast { 34 | enum BroadcastType { 35 | WAKE = 0; 36 | ABORT = 1; 37 | KILL = 2; 38 | } 39 | required BroadcastType cmd = 1; 40 | } 41 | -------------------------------------------------------------------------------- /old/mvp/MVPTileProcessor.h: -------------------------------------------------------------------------------- 1 | /// \file MVPTileProcessor.h 2 | /// 3 | /// MVP Tile Processor 4 | /// 5 | /// TODO: Write something here 6 | /// 7 | 8 | #ifndef __MVP_MVPTILEPROCESSOR_H__ 9 | #define __MVP_MVPTILEPROCESSOR_H__ 10 | 11 | #include 12 | 13 | #include 14 | 15 | namespace mvp { 16 | 17 | class MVPTileSeeder; 18 | 19 | class MVPTileProcessor { 20 | protected: 21 | MVPTileSeeder *m_seeder; 22 | public: 23 | MVPTileProcessor(MVPTileSeeder *seeder) : m_seeder(seeder) {} 24 | virtual MVPTileResult operator()(vw::ProgressCallback const& progress = vw::ProgressCallback::dummy_instance()) const = 0; 25 | }; 26 | 27 | struct MVPTileProcessorDumb : public MVPTileProcessor { 28 | MVPTileProcessorDumb(MVPTileSeeder *seeder) : MVPTileProcessor(seeder) {} 29 | virtual MVPTileResult operator()(vw::ProgressCallback const& progress = vw::ProgressCallback::dummy_instance()) const; 30 | }; 31 | 32 | struct MVPTileProcessorSquare : public MVPTileProcessor { 33 | MVPTileProcessorSquare(MVPTileSeeder *seeder) : MVPTileProcessor(seeder) {} 34 | virtual MVPTileResult operator()(vw::ProgressCallback const& progress = vw::ProgressCallback::dummy_instance()) const; 35 | }; 36 | 37 | } // namespace mvp 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /old/mvp/MVPUserSettings.proto: -------------------------------------------------------------------------------- 1 | package mvp; 2 | 3 | message MVPUserSettings { 4 | required double alt_min = 1; 5 | required double alt_max = 2; 6 | required double alt_search_range = 3; 7 | required double seed_window_smooth_size = 4; 8 | required double window_size = 5; 9 | required double window_smooth_size = 6; 10 | optional double gauss_divisor = 7 [default=6]; 11 | optional int32 max_iterations = 8 [default=80]; 12 | } 13 | -------------------------------------------------------------------------------- /old/mvp/MVPWorkspaceRequest.proto: -------------------------------------------------------------------------------- 1 | package mvp; 2 | 3 | import "mvp/OrbitalImageFileDescriptor.proto"; 4 | import "mvp/MVPUserSettings.proto"; 5 | import "vw/Plate/PlateGeoReferenceDesc.proto"; 6 | 7 | message MVPWorkspaceRequest { 8 | required string result_platefile = 1; 9 | required string internal_result_platefile = 2; 10 | required vw.platefile.PlateGeoReferenceDesc plate_georef = 3; 11 | required MVPUserSettings user_settings = 4; 12 | repeated OrbitalImageFileDescriptor orbital_images = 5; 13 | repeated int32 render_bbox = 6; 14 | optional int32 render_level = 7 [default=-1]; 15 | optional bool use_octave = 8 [default=false]; 16 | optional bool draw_footprints = 9 [default=false]; 17 | } 18 | -------------------------------------------------------------------------------- /old/mvp/OrbitalImageFileDescriptor.proto: -------------------------------------------------------------------------------- 1 | package mvp; 2 | 3 | message OrbitalImageFileDescriptor { 4 | required string camera_path = 1; 5 | required string image_path = 2; 6 | } 7 | -------------------------------------------------------------------------------- /old/mvp/octave/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(MFILES _mvprefl_findH.m 2 | _mvprefl_testhelpers.m 3 | _porthoproj_impl.m 4 | _porthoproj_impl_ref.m 5 | gausskernel.m 6 | geotrans.m 7 | loadjobfile.cc 8 | lonlat2normal.m 9 | lonlatalt2xyz.m 10 | mvpalgorithm.m 11 | mvpfootprint.m 12 | mvpobj.m 13 | mvpoptimset.m 14 | mvppatches.m 15 | mvpproj.m 16 | mvprefl.m 17 | mvprefl_fast.m 18 | offsetgeoref.m 19 | porthoproj.m) 20 | 21 | add_octfile(loadjobfile loadjobfile.cc) 22 | target_link_libraries(loadjobfile mvpcommon 23 | ${PROTOBUF_LIBRARIES} 24 | ${VW_LIBRARIES} 25 | ${Boost_LIBRARIES}) 26 | 27 | install(TARGETS loadjobfile 28 | DESTINATION ${OCTFILE_INSTALL_DIR}) 29 | install(FILES ${MFILES} DESTINATION ${MFILE_INSTALL_DIR}) 30 | 31 | add_subdirectory(tests) 32 | -------------------------------------------------------------------------------- /old/mvp/octave/_mvprefl_findH.m: -------------------------------------------------------------------------------- 1 | function [Haa Hab Hbb] = _mvprefl_findH(patches, weights) 2 | % TODO: replace these calculations with Taemin's fancy 3 | % indexed versions 4 | 5 | sz = size(patches); 6 | Haa = scat(patches, patches, weights); 7 | Hab = scat(patches, ones(sz), weights); 8 | Hbb = scat(ones(sz), ones(sz), weights); 9 | endfunction 10 | 11 | function H = scat(f, g, w) 12 | sz = size(f); 13 | dim = sz(1:2); 14 | numPatches = sz(3); 15 | 16 | H1 = H2 = zeros(numPatches); 17 | for row = 1:sz(1) 18 | for col = 1:sz(2) 19 | F = diag(f(row, col, :)(:)); 20 | G = diag(g(row, col, :)(:)); 21 | W = diag(w(row, col, :)(:)); 22 | H1 += sum(w(row, col, :)) * F * G * W; 23 | H2 += W * f(row, col, :)(:) * g(row, col, :)(:)' * W; 24 | endfor 25 | endfor 26 | H1 /= numPatches; 27 | H2 /= numPatches; 28 | 29 | H = H1 - H2; 30 | endfunction 31 | 32 | % 33 | % The following test tests the calculations of Haa, Hab, and Hbb 34 | % by using them to calculate the objective function (objscat), and then 35 | % comparing it to a reference calculation (objref) 36 | % 37 | 38 | %!test 39 | %! _mvprefl_testhelpers 40 | %! [patches weights a b] = genpatches(); 41 | %! assert(objref(patches, weights, a, b), 0, 1e-8); 42 | %! assert(objscat(patches, weights, a, b), objref(patches, weights, a, b), 1e-8); 43 | %! a = rand(size(a)); 44 | %! b = rand(size(b)); 45 | %! assert(objscat(patches, weights, a, b), objref(patches, weights, a, b), 1e-8); 46 | 47 | % vim:set syntax=octave: 48 | -------------------------------------------------------------------------------- /old/mvp/octave/gausskernel.m: -------------------------------------------------------------------------------- 1 | function [kern dkern] = gausskernel(sigma, sz) 2 | x = (0:sz) - (sz / 2); 3 | kern = diff(normcdf(x, 0, sigma)); 4 | kern /= sum(kern); 5 | 6 | if (nargout > 1) 7 | dkern = diff(normpdf(x, 0, sigma)); 8 | dkern /= sum(kern); 9 | endif 10 | endfunction 11 | 12 | %!test 13 | %! sz = 8; 14 | %! sigma = 3; 15 | %! h = sz - 1; 16 | %! x = (0:h) - h / 2; 17 | %! gauss = exp(-(x.^2) / (2*sigma^2)); 18 | %! kernref = gauss / sum(gauss(:)); 19 | %! kern = gausskernel(sigma, sz); 20 | %! assert(kernref, kern, 1e-3) 21 | 22 | % vim:set syntax=octave: 23 | -------------------------------------------------------------------------------- /old/mvp/octave/geotrans.m: -------------------------------------------------------------------------------- 1 | function result = geotrans(image, from_georef, to_georef, sz) 2 | %% Draw DEM on tile 3 | P = inv(from_georef.transform) * to_georef.transform; 4 | [X Y] = meshgrid(1:sz(1), 1:sz(2)); 5 | D = [X(:) Y(:) ones(prod(sz), 1)]'; 6 | PD = P * D; 7 | 8 | xw = reshape(PD(1,:) ./ PD(3,:), sz(2), sz(1)); 9 | yw = reshape(PD(2,:) ./ PD(3,:), sz(2), sz(1)); 10 | 11 | result = imremap(image, xw, yw, "bilinear"); 12 | endfunction 13 | 14 | %% TODO: test me 15 | 16 | % vim:set syntax=octave: 17 | -------------------------------------------------------------------------------- /old/mvp/octave/lonlat2normal.m: -------------------------------------------------------------------------------- 1 | function [n dn_dlonlat] = lonlat2normal(lonlat) 2 | clo = cos(lonlat(1)); 3 | slo = sin(lonlat(1)); 4 | cla = cos(lonlat(2)); 5 | sla = sin(lonlat(2)); 6 | 7 | n = [cla * clo; cla * slo; sla]; 8 | 9 | dn_dlonlat = [-cla*slo, cla*clo, 0; -sla*clo, -sla*slo, cla]'; 10 | endfunction 11 | 12 | % Verify grad calculation is correct 13 | %!test 14 | %! lonlat = [0.56; 0.23]; 15 | %! dlonlat = [1e-4; 1e-4]; 16 | %! [n1 grad] = lonlat2normal(lonlat); 17 | %! n2 = lonlat2normal(lonlat + dlonlat); 18 | %! dn = grad * dlonlat; 19 | %! dn_actual = n2 - n1; 20 | %! assert(dn, dn_actual, 1e-8); 21 | 22 | % vim:set syntax=octave: 23 | -------------------------------------------------------------------------------- /old/mvp/octave/lonlatalt2xyz.m: -------------------------------------------------------------------------------- 1 | function xyz = lonlatalt2xyz(datum, lonlat, alt) 2 | if (datum.semi_major_axis != datum.semi_minor_axis) 3 | error("Spheroid datums not supported"); 4 | endif 5 | 6 | xyz = (datum.semi_major_axis + alt) * lonlat2normal(lonlat); 7 | 8 | endfunction 9 | 10 | % vim:set syntax=octave: 11 | -------------------------------------------------------------------------------- /old/mvp/octave/mvpfootprint.m: -------------------------------------------------------------------------------- 1 | function [result, variance, converged, num_iterations] = mvpfootprint(seed, georef, images, settings) 2 | lonlat_h = georef.transform * [1; 1; 1]; 3 | lonlat = lonlat_h(1:2) / lonlat_h(3); 4 | 5 | xyz = lonlatalt2xyz(georef.datum, lonlat, 0); 6 | xyz_h = [xyz; 1]; 7 | 8 | overlap = 0; 9 | 10 | for img = images 11 | px_h = img.camera * xyz_h; 12 | px = px_h(1:2) / px_h(3); 13 | 14 | % Note that VW labels the upper left hand corner of the upper left hand pixel 15 | % (0, 0) So the lower right hand corner of the that same pixel is (0.999.., 0.999...). 16 | % Thus, a coordinate is "contained" in that pixel if (0, 0) <= (x, y) < (1, 1). 17 | % 18 | % For Octave, the upper left hand corner of the upper left hand pixel is (1, 1) 19 | % The lower right hand of that same pixel is (1.999...,1.999...). Thus, a 20 | % coordinate "contained" in that pixel will be (1, 1) <= (x, y) < (2, 2). 21 | % 22 | % This is why we must add [1; 1] to the image size before comparing it. 23 | if (px >= [1; 1] && px < (flipdim(size(img.data))' + [1; 1])) 24 | overlap++; 25 | endif 26 | endfor 27 | 28 | result.alt = overlap; 29 | result.orientation = [overlap; overlap; overlap]; 30 | result.windows = [overlap; overlap; overlap]; 31 | variance = overlap; 32 | converged = overlap > 0; 33 | num_iterations = overlap; 34 | endfunction 35 | 36 | % vim:set syntax=octave: 37 | -------------------------------------------------------------------------------- /old/mvp/octave/mvpobj.m: -------------------------------------------------------------------------------- 1 | function obj = mvpobj(alt, orientation, windows, georef, images, mvpoptions) 2 | projs = mvpproj(alt, orientation, windows, georef, images, mvpoptions); 3 | 4 | if (numel(projs) < 2) 5 | obj = NA; 6 | return; 7 | endif 8 | 9 | [patches weights] = mvppatches(projs, windows, mvpoptions); 10 | 11 | if (size(patches)(3) < 2) 12 | obj = NA; 13 | return; 14 | endif 15 | 16 | if (mvpoptions.fast_reflectance) 17 | obj = mvprefl_fast(patches, weights); 18 | else 19 | obj = mvprefl(patches, weights); 20 | endif 21 | endfunction 22 | 23 | % vim:set syntax=octave: 24 | -------------------------------------------------------------------------------- /old/mvp/octave/mvpoptimset.m: -------------------------------------------------------------------------------- 1 | function options = mvpoptimset(alt_range) 2 | options.alt_range = alt_range; 3 | options.fix_orientation = true; 4 | options.fix_windows = true; 5 | options.max_iterations = 80; 6 | options.gauss_divisor = 6; 7 | options.fast_reflectance = true; 8 | endfunction 9 | 10 | 11 | % vim:set syntax=octave: 12 | -------------------------------------------------------------------------------- /old/mvp/octave/mvppatches.m: -------------------------------------------------------------------------------- 1 | function [patches weights] = mvppatches(projs, windows, mvpoptions) 2 | % Given projections, smooth them, create weight images 3 | 4 | dim = size(projs{1}); 5 | numProjs = numel(projs); 6 | windows_px = round(windows * mvpoptions.gauss_divisor); 7 | 8 | smoothKernel = gausskernel(windows(3), windows_px(3)); 9 | 10 | numPatches = 0; 11 | patches = zeros(0, 0, 0); 12 | for i = 1:numProjs 13 | if (all(isnan(projs{i}))) 14 | continue; 15 | endif 16 | 17 | projs{i} = convn(projs{i}, smoothKernel, "valid"); 18 | projs{i} = convn(projs{i}, smoothKernel', "valid"); 19 | 20 | if (all(isnan(projs{i}))) 21 | continue; 22 | endif 23 | 24 | numPatches += 1; 25 | patches(:, :, numPatches) = projs{i}; 26 | endfor 27 | 28 | weightWin = gausskernel(windows(1), windows_px(1))' * gausskernel(windows(2), windows_px(2)); 29 | weights = repmat(weightWin, [1 1 numPatches]); 30 | 31 | idx = find(isnan(patches)); 32 | patches(idx) = 0; 33 | weights(idx) = 0; 34 | 35 | endfunction 36 | 37 | %% TODO: test me! 38 | 39 | % vim:set syntax=octave: 40 | -------------------------------------------------------------------------------- /old/mvp/octave/mvpproj.m: -------------------------------------------------------------------------------- 1 | function projs = mvpproj(alt, orientation, windows, georef, images, mvpoptions) 2 | windows_px = round(windows * mvpoptions.gauss_divisor); 3 | projSize = windows_px(1:2) + (windows_px(3) - 1); 4 | 5 | lonlat_h = georef.transform * ones(3, 1); 6 | lonlat = lonlat_h(1:2) / lonlat_h(3); 7 | xyz = lonlatalt2xyz(georef.datum, lonlat, alt); 8 | 9 | planeNormal = orientation; 10 | planeD = dot(xyz, planeNormal); 11 | 12 | projs = arrayfun(@(i) porthoproj(i, planeNormal, planeD, georef, projSize), images, "UniformOutput", false); 13 | endfunction 14 | 15 | % vim:set syntax=octave: 16 | -------------------------------------------------------------------------------- /old/mvp/octave/mvprefl.m: -------------------------------------------------------------------------------- 1 | function [e a b] = mvprefl(patches, weights) 2 | sz = size(patches); 3 | dim = sz(1:2); 4 | numPatches = sz(3); 5 | 6 | [Haa Hab Hbb] = _mvprefl_findH(patches, weights); 7 | 8 | w = sum(sum(weights))(:) / dim(1) / dim(2); 9 | 10 | T = (Hbb * Hbb + w * w') \ Hbb; 11 | E = Haa + Hab * (T * Hbb * T - 2 * T) * Hab'; 12 | 13 | [a e flag] = eigs(E, 1, "sm"); 14 | if (flag != 0) 15 | e = NA; 16 | a = NA; 17 | b = NA; 18 | return; 19 | endif 20 | 21 | if (sum(a) < 0) 22 | a = -a; 23 | endif 24 | 25 | if (any(find(a <= 0))) 26 | e = NA; 27 | a = NA; 28 | b = NA; 29 | return; 30 | endif 31 | 32 | if (nargout > 2) 33 | b = -T * Hab' * a; 34 | endif 35 | 36 | endfunction 37 | 38 | %!test 39 | %! _mvprefl_testhelpers 40 | %! [patches weights a b] = genpatches(); 41 | %! [e a b] = mvprefl(patches, weights); 42 | %! assert(e, 0, 1e-8); 43 | %! e2 = objref(patches, weights, a, b); 44 | %! assert(e, e2, 1e-8); 45 | 46 | % vim:set syntax=octave: 47 | -------------------------------------------------------------------------------- /old/mvp/octave/offsetgeoref.m: -------------------------------------------------------------------------------- 1 | function result = offsetgeoref(georef, offset) 2 | offmat = eye(3); 3 | offmat(1:2, 3) = offset' - 1; 4 | 5 | result = georef; 6 | result.transform = result.transform * offmat; 7 | endfunction 8 | 9 | %!test 10 | %! georef.transform = [0.00002, 0.00000, 0.98145; 11 | %! 0.00000, -0.00002, 0.16900; 12 | %! 0.00000, 0.00000, 1.00000]; 13 | %! offgeo = offsetgeoref(georef, [100 200]); 14 | %! pt = georef.transform * [100; 200; 1]; 15 | %! offpt = offgeo.transform * [1; 1; 1]; 16 | %! assert(pt, offpt, 1e-4) 17 | 18 | %!test 19 | %! georef.transform = [0.00002, 0.00000, 0.98145; 20 | %! 0.00000, -0.00002, 0.16900; 21 | %! 0.00000, 0.00000, 1.00000]; 22 | %! offgeo = offsetgeoref(georef, [100 200]); 23 | %! pt = georef.transform * [200; 300; 1]; 24 | %! offpt = offgeo.transform * [100; 100; 1]; 25 | %! assert(pt, offpt, 1e-4) 26 | 27 | % vim:set syntax=octave: 28 | -------------------------------------------------------------------------------- /old/mvp/octave/porthoproj.m: -------------------------------------------------------------------------------- 1 | function patch = porthoproj(image, planeNormal, planeD, georef, projSize) 2 | [xw yw] = _porthoproj_impl(image.camera, planeNormal, planeD, georef, projSize); 3 | patch = imremap(image.data, xw, yw, "bilinear"); 4 | endfunction 5 | 6 | % vim:set syntax=octave: 7 | -------------------------------------------------------------------------------- /old/mvp/octave/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | configure_file(ts_loadrealjob.m.in ts_loadrealjob.m) 2 | configure_file(ts_loadsynthjob.m.in ts_loadsynthjob.m) 3 | -------------------------------------------------------------------------------- /old/mvp/octave/tests/README: -------------------------------------------------------------------------------- 1 | ts_loadsynthjob 2 | [seed patch_georef] = ts_gengseed([25 25], tile_georef, tile_dem); 3 | 4 | ts_plotobj(seed, patch_georef, images) 5 | ts_showpatches(seed, patch_georef, images) 6 | ts_showpatchprints(seed, patch_georef, images) 7 | 8 | 9 | Interesting feature in 2682_1937_12.real.job: 10 | 11 | [seed georef] = ts_genseed([32 32], tile_georef, -1091, "tangent", [10 10 1]); 12 | options = mvpoptimset(2000); 13 | 14 | Vary seed from [7 50] to [14 50] to see the discontinuity: 15 | 16 | [trash georef] = ts_genseed([7 50], tile_georef, -1091, "tangent", [10 10 1]); 17 | ts_plotobj(seed, georef, images, options) 18 | [trash georef] = ts_genseed([8 50], tile_georef, -1091, "tangent", [10 10 1]); 19 | ts_plotobj(seed, georef, images, options) 20 | ... and so on 21 | 22 | This feature becomes invisible at window size 13 or so. 23 | 24 | ------------ 25 | 26 | Weak convergance point: 27 | 28 | [seed georef] = ts_genseed([24 24], tile_georef, -1085, "tangent", [16 16 8] / 6); 29 | opts = mvpoptimset(-1); 30 | 31 | ------------- 32 | 33 | Smoothing kernel bad: 34 | [seed georef] = ts_genseed([8.5 65-8.5], tile_georef, -691.18, "tangent", [16 16 0] / 6); 35 | [seed georef] = ts_genseed([8.5 65-8.5], tile_georef, -691.18, "tangent", [16 16 4] / 6); 36 | -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2682_1937_12.real.job/camera0.pinhole: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2682_1937_12.real.job/camera0.pinhole -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2682_1937_12.real.job/camera1.pinhole: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2682_1937_12.real.job/camera1.pinhole -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2682_1937_12.real.job/camera2.pinhole: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2682_1937_12.real.job/camera2.pinhole -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2682_1937_12.real.job/camera3.pinhole: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2682_1937_12.real.job/camera3.pinhole -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2682_1937_12.real.job/image0.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2682_1937_12.real.job/image0.tif -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2682_1937_12.real.job/image1.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2682_1937_12.real.job/image1.tif -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2682_1937_12.real.job/image2.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2682_1937_12.real.job/image2.tif -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2682_1937_12.real.job/image3.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2682_1937_12.real.job/image3.tif -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2682_1937_12.real.job/job: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2682_1937_12.real.job/job -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2688_1938_12.synth.job/camera0.pinhole: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2688_1938_12.synth.job/camera0.pinhole -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2688_1938_12.synth.job/camera1.pinhole: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2688_1938_12.synth.job/camera1.pinhole -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2688_1938_12.synth.job/camera2.pinhole: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2688_1938_12.synth.job/camera2.pinhole -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2688_1938_12.synth.job/camera3.pinhole: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2688_1938_12.synth.job/camera3.pinhole -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2688_1938_12.synth.job/image0.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2688_1938_12.synth.job/image0.tif -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2688_1938_12.synth.job/image1.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2688_1938_12.synth.job/image1.tif -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2688_1938_12.synth.job/image2.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2688_1938_12.synth.job/image2.tif -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2688_1938_12.synth.job/image3.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2688_1938_12.synth.job/image3.tif -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/2688_1938_12.synth.job/job: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/2688_1938_12.synth.job/job -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/synth-ground-DEM.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/synth-ground-DEM.tif -------------------------------------------------------------------------------- /old/mvp/octave/tests/data/synth-ground-DRG.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/mvp/octave/tests/data/synth-ground-DRG.tif -------------------------------------------------------------------------------- /old/mvp/octave/tests/ts_gengseed.m: -------------------------------------------------------------------------------- 1 | function [seed patch_georef] = ts_gengseed(pt, tile_georef, tile_dem, alt = "ground", orientation = "tangent", windows = [15 15 1]) 2 | 3 | if (strcmp(alt, "ground")) 4 | alt = tile_dem(pt(2), pt(1)); 5 | endif 6 | 7 | if (strcmp(orientation, "ground")) 8 | error("Ground orientation calculation not implemented"); 9 | endif 10 | 11 | [seed patch_georef] = ts_genseed(pt, tile_georef, alt, orientation, windows); 12 | 13 | endfunction 14 | 15 | % vim:set syntax=octave: 16 | -------------------------------------------------------------------------------- /old/mvp/octave/tests/ts_genseed.m: -------------------------------------------------------------------------------- 1 | function [seed patch_georef] = ts_genseed(pt, tile_georef, alt = 0, orientation = "tangent", windows = [15 15 1]) 2 | 3 | patch_georef = offsetgeoref(tile_georef, pt); 4 | 5 | if (strcmp(orientation, "tangent")) 6 | lonlatPt_H = patch_georef.transform * ones(3, 1); 7 | lonlatPt = lonlatPt_H(1:2) ./ lonlatPt_H(3); 8 | orientation = lonlat2normal(lonlatPt); 9 | endif 10 | 11 | seed.alt = alt; 12 | seed.orientation = orientation; 13 | seed.windows = windows; 14 | 15 | endfunction 16 | 17 | % vim:set syntax=octave: 18 | -------------------------------------------------------------------------------- /old/mvp/octave/tests/ts_loadrealjob.m.in: -------------------------------------------------------------------------------- 1 | source("@CMAKE_BINARY_DIR@/src/test/loadtestenv.m"); 2 | 3 | testjob = "@CMAKE_CURRENT_SOURCE_DIR@/data/2682_1937_12.real.job"; 4 | 5 | [tile_georef images settings tile_size] = loadjobfile(testjob); 6 | 7 | load "@CMAKE_CURRENT_SOURCE_DIR@/data/real-ground-DEM.mat"; 8 | 9 | ground_georef = tile_georef; 10 | 11 | % real-ground-DEM was created using geotrans like in loadsynthjob 12 | 13 | % vim:set syntax=octave: 14 | -------------------------------------------------------------------------------- /old/mvp/octave/tests/ts_loadsynthjob.m.in: -------------------------------------------------------------------------------- 1 | source("@CMAKE_BINARY_DIR@/src/test/loadtestenv.m"); 2 | 3 | testjob = "@CMAKE_CURRENT_SOURCE_DIR@/data/2688_1938_12.synth.job"; 4 | ground_dem_file = "@CMAKE_CURRENT_SOURCE_DIR@/data/synth-ground-DEM.tif"; 5 | ground_drg_file = "@CMAKE_CURRENT_SOURCE_DIR@/data/synth-ground-DRG.tif"; 6 | 7 | [tile_georef images settings tile_size] = loadjobfile(testjob); 8 | 9 | [ground_dem ground_georef] = imread_vw(ground_dem_file); 10 | [ground_drg] = imread_vw(ground_drg_file); 11 | 12 | tile_dem = geotrans(ground_dem, ground_georef, tile_georef, [tile_size tile_size]); 13 | tile_drg = geotrans(ground_drg, ground_georef, tile_georef, [tile_size tile_size]); 14 | 15 | % vim:set syntax=octave: 16 | -------------------------------------------------------------------------------- /old/mvp/octave/tests/ts_plotobj.m: -------------------------------------------------------------------------------- 1 | function [alts_out objs_out] = ts_plotobj(seed, patch_georef, images, mvpoptions, num_pts = 20) 2 | 3 | alts = linspace(seed.alt - mvpoptions.alt_range, seed.alt + mvpoptions.alt_range, num_pts); 4 | objs = arrayfun(@(a) mvpobj(a, seed.orientation, seed.windows, patch_georef, images, mvpoptions), alts); 5 | 6 | if (nargout < 2) 7 | plot(alts, objs); 8 | axis("tight"); 9 | % TODO: bug?: for some reason, the +/- 1 is needed for the line to show... 10 | line([seed.alt, seed.alt], [min(objs)-1, max(objs)+1]); 11 | 12 | if (nargout == 1) 13 | printf("\nClick to select a new seed alt (right click to cancel)\n\n"); 14 | fflush(stdout); 15 | [locX locY btn] = ginput(1); 16 | if (btn == 1) 17 | seed.alt = locX; 18 | else 19 | alts_out = seed; 20 | printf("Cancelled\n"); 21 | return 22 | endif 23 | alts_out = seed; 24 | endif 25 | else 26 | alts_out = alts; 27 | objs_out = objs; 28 | endif 29 | 30 | endfunction 31 | 32 | % vim:set syntax=octave: 33 | -------------------------------------------------------------------------------- /old/mvp/octave/tests/ts_showpatches.m: -------------------------------------------------------------------------------- 1 | function ts_showpatches(seed, georef, images, mvpoptions) 2 | patches = mvpproj(seed.alt, seed.orientation, seed.windows, georef, images, mvpoptions); 3 | 4 | numPatches = numel(patches); 5 | 6 | gridWidth = ceil(sqrt(numPatches)); 7 | gridHeight = ceil(numPatches / gridWidth); 8 | 9 | for currPatch = 1:numPatches 10 | subplot(gridHeight, gridWidth, currPatch); 11 | imagesc(patches{currPatch}); 12 | title(["Patch " num2str(currPatch)]); 13 | axis("square"); 14 | currPatch++; 15 | endfor 16 | endfunction 17 | 18 | % vim:set syntax=octave: 19 | -------------------------------------------------------------------------------- /old/mvp/octave/tests/ts_showpatchprints.m: -------------------------------------------------------------------------------- 1 | function ts_showpatchprints(seed, patch_georef, images, mvpoptions) 2 | windows_px = round(seed.windows * mvpoptions.gauss_divisor); 3 | projSize = windows_px(1:2) + (windows_px(3) - 1); 4 | 5 | lonlat_H = patch_georef.transform * ones(3, 1); 6 | lonlat = lonlat_H(1:2) / lonlat_H(3); 7 | xyz = lonlatalt2xyz(patch_georef.datum, lonlat, seed.alt); 8 | 9 | planeNormal = seed.orientation; 10 | planeD = dot(xyz, planeNormal); 11 | 12 | numImages = numel(images); 13 | 14 | gridWidth = ceil(sqrt(numImages)); 15 | gridHeight = ceil(numImages / gridWidth); 16 | 17 | for currImage = 1:numImages 18 | subplot(gridHeight, gridWidth, currImage); 19 | imagesc(images(currImage).data); 20 | hold on; 21 | [xw yw] = _porthoproj_impl(images(currImage).camera, planeNormal, planeD, patch_georef, projSize); 22 | hullIdx = convhull(xw(:), yw(:), "Pp"); 23 | fill(xw(hullIdx), yw(hullIdx), 'w'); 24 | hold off; 25 | currImage++; 26 | endfor 27 | endfunction 28 | 29 | % vim:set syntax=octave: 30 | -------------------------------------------------------------------------------- /old/mvp/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-DTEST_SRCDIR=\"${CMAKE_CURRENT_SOURCE_DIR}\") 2 | add_definitions(-DTEST_OBJDIR=\"${CMAKE_CURRENT_BINARY_DIR}\") 3 | 4 | macro(add_mvp_test test_name) 5 | add_executable(${test_name} ${test_name}.cxx) 6 | 7 | target_link_libraries(${test_name} mvpcommon 8 | gtest_main 9 | ${GTEST_LIBRARIES} 10 | ${VW_LIBRARIES} 11 | ${PROTOBUF_LIBRARIES} 12 | ${Boost_LIBRARIES}) 13 | 14 | if (ENABLE_OCTAVE_SUPPORT) 15 | target_link_libraries(${test_name} ${OCTAVE_LIBRARIES}) 16 | endif() 17 | 18 | add_test(mvp/${test_name} ${test_name}) 19 | endmacro() 20 | 21 | add_mvp_test(TestMVPWorkspace) 22 | add_mvp_test(TestOrbitalImageFootprint) 23 | add_mvp_test(TestOrbitalImageCrop) 24 | add_mvp_test(TestMVPJob) 25 | add_mvp_test(TestConvexPolygon) 26 | add_mvp_test(TestMVPAlgorithm) 27 | add_mvp_test(TestMVPTileSeeder) 28 | add_mvp_test(TestMVPTileProcessor) 29 | -------------------------------------------------------------------------------- /old/mvp/tests/TestMVPTileSeeder.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | using namespace vw; 9 | using namespace vw::test; 10 | using namespace vw::cartography; 11 | using namespace mvp; 12 | 13 | // TODO: Write proper tests here 14 | 15 | struct MVPAlgoTest : public MVPAlgorithm { 16 | virtual MVPPixelResult operator()(MVPAlgorithmVar const& seed, vw::cartography::GeoReference const& georef, MVPAlgorithmOptions const& options) const { 17 | return MVPPixelResult(seed); 18 | } 19 | }; 20 | 21 | TEST(MVPTileSeederDumbTest, init) { 22 | MVPAlgoTest algorithm; 23 | MVPTileSeederDumb seeder(&algorithm, GeoReference(Datum("D_MOON")), 256, MVPUserSettings()); 24 | 25 | EXPECT_TRUE(seeder.init()); 26 | } 27 | 28 | TEST(MVPTileSeederSquareTest, seed) { 29 | MVPAlgoTest algorithm; 30 | MVPTileSeederSquare seeder(&algorithm, GeoReference(Datum("D_MOON")), 256, MVPUserSettings()); 31 | 32 | seeder.update(0, 0, MVPAlgorithmVar(3)); 33 | seeder.update(0, 1, MVPAlgorithmVar(4)); 34 | seeder.update(0, 2, MVPAlgorithmVar(5)); 35 | 36 | EXPECT_NEAR(seeder.seed(0, 0).alt, 4, 1e-3); 37 | } 38 | -------------------------------------------------------------------------------- /old/mvp/tests/mvp.conf: -------------------------------------------------------------------------------- 1 | # Dataset info 2 | orbital-image-pattern = synth.%d.tif 3 | camera-pattern = synth.%d.pinhole 4 | pattern-index-start = 0 5 | pattern-index-end = 1 6 | 7 | # Platefile settings 8 | datum = D_MOON 9 | map-projection = equi 10 | tile-size = 256 11 | 12 | # Output paths 13 | result-platefile = result.plate 14 | internal-result-platefile = internal-result.plate 15 | 16 | # Algorithm settings 17 | post-height-limit-min = 0 18 | post-height-limit-max = 0 19 | 20 | use-octave = false 21 | test-algorithm = false 22 | -------------------------------------------------------------------------------- /old/mvpgui/README: -------------------------------------------------------------------------------- 1 | ginput bug: 2 | 3 | http://octave.1599824.n4.nabble.com/Ginput-doesn-t-work-in-3-2-3-td1674164.html 4 | -------------------------------------------------------------------------------- /old/mvpgui/mvpgui: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MVP_ROOT=$(readlink -f $(dirname $0)/..) 4 | OCTAVE_PATHS=$MVP_ROOT/build/src:$MVP_ROOT/octave:$MVP_ROOT/mvpgui 5 | #OCTAVE_PATHS=$OCTAVE_PATHS:/usr/share/octave/packages/3.2/image-1.0.12 6 | 7 | octave -q --path $OCTAVE_PATHS $MVP_ROOT/mvpgui/mvpgui.m $@ 8 | -------------------------------------------------------------------------------- /old/mvpgui/mvpgui_cmd_cp.m: -------------------------------------------------------------------------------- 1 | function rws = mvpgui_cmd_cp(ws, args) 2 | switch (numel(args)) 3 | case 0 4 | printf("\ncp = %f %f %f\n\n", ws.cp(1), ws.cp(2), ws.cp(3)); 5 | case 1 6 | if (strcmp(args{1}, "init")) 7 | lonlatH = ws.georef * [ws.poi(1); ws.poi(2); 1]; 8 | lonlat = lonlatH(1:2) / lonlatH(3); 9 | rad = ws.dem(ws.poi(1), ws.poi(2)); 10 | ws.cp = [lonlat' rad]; 11 | else 12 | error(["cp: unrecognized option " args{1}]); 13 | endif 14 | case 3 15 | for k = 1:3 16 | if (!strcmp(args{k}, ".")) 17 | ws.cp(k) = str2num(args{k}); 18 | endif 19 | endfor 20 | otherwise 21 | error("cp: invalid number of arguments"); 22 | endswitch 23 | rws = ws; 24 | endfunction 25 | 26 | % vim:set syntax=octave: 27 | -------------------------------------------------------------------------------- /old/mvpgui/mvpgui_cmd_cpi.m: -------------------------------------------------------------------------------- 1 | function rws = mvpgui_cmd_cpi(ws, args) 2 | if (numel(args) != 0) 3 | error("cpi: invalid number of arguments"); 4 | endif 5 | if (strcmp(ws.plot, "none")) 6 | error("cpi: no current plot"); 7 | endif 8 | 9 | oldcp = ws.cp; 10 | 11 | printf("\nSelect a point (right click to cancel)\n\n"); 12 | ws = mvpgui_cmd_replot(ws, {}); 13 | [locX locY btn] = ginput(1); 14 | if (btn == 1) 15 | switch(ws.plot) 16 | case "radplot" 17 | ws.cp(3) = locX; 18 | case "lonlatplot" 19 | ws.cp(1) = locX; 20 | ws.cp(2) = locY; 21 | otherwise 22 | error("cpi: logic error"); 23 | endswitch 24 | else 25 | error("cpi: cancelled by user"); 26 | endif 27 | 28 | printf("cp = %f %f %f ->\n", oldcp(1), oldcp(2), oldcp(3)); 29 | printf(" %f %f %f\n\n", ws.cp(1), ws.cp(2), ws.cp(3)); 30 | 31 | rws = ws; 32 | endfunction 33 | 34 | % vim:set syntax=octave: 35 | -------------------------------------------------------------------------------- /old/mvpgui/mvpgui_cmd_exit.m: -------------------------------------------------------------------------------- 1 | function rws = mvpgui_cmd_exit(ws, args) 2 | exit(0); 3 | endfunction 4 | 5 | % vim:set syntax=octave: 6 | -------------------------------------------------------------------------------- /old/mvpgui/mvpgui_cmd_help.m: -------------------------------------------------------------------------------- 1 | function rws = mvpgui_cmd_help(ws, args) 2 | switch (numel(args)) 3 | case 0 4 | printf("\nUsage: help [command]\n\n"); 5 | printf("Available commands: \n"); 6 | 7 | cmdlist = fieldnames(ws.cmddb); 8 | for i = 1:numel(cmdlist) 9 | printf(" %s\n", cmdlist{i}); 10 | endfor 11 | 12 | printf("\n\n"); 13 | case 1 14 | try 15 | cmd = getfield(ws.cmddb, args{1}); 16 | catch 17 | error("help: unrecognized command"); 18 | end_try_catch 19 | 20 | printf("\nUsage: %s\n\n", cmd.usage); 21 | disp(cmd.desc); 22 | printf("\n\n"); 23 | otherwise 24 | error("help: invalid number of arguments"); 25 | endswitch 26 | rws = ws; 27 | endfunction 28 | 29 | % vim:set syntax=octave: 30 | -------------------------------------------------------------------------------- /old/mvpgui/mvpgui_cmd_hwin.m: -------------------------------------------------------------------------------- 1 | function rws = mvpgui_cmd_hwin(ws, args) 2 | switch (numel(args)) 3 | case 0 4 | printf("\nhwin = %d\n\n", ws.hwin); 5 | case 1 6 | ws.hwin = floor(str2num(args{1})); 7 | otherwise 8 | error("hwin: invalid number of arguments"); 9 | endswitch 10 | rws = ws; 11 | endfunction 12 | 13 | % vim:set syntax=octave: 14 | -------------------------------------------------------------------------------- /old/mvpgui/mvpgui_cmd_poi.m: -------------------------------------------------------------------------------- 1 | function rws = mvpgui_cmd_poi(ws, args) 2 | switch (numel(args)) 3 | case 0 4 | printf("\npoi = (%d %d)\n\n", ws.poi(1), ws.poi(2)); 5 | case 2 6 | ws.poi = floor([str2num(args{1}) str2num(args{2})]); 7 | otherwise 8 | error("poi: invalid number of arguments"); 9 | endswitch 10 | rws = ws; 11 | endfunction 12 | 13 | % vim:set syntax=octave: 14 | -------------------------------------------------------------------------------- /old/mvpgui/mvpgui_cmd_replot.m: -------------------------------------------------------------------------------- 1 | function rws = mvpgui_cmd_replot(ws, args) 2 | if (numel(args) != 0) 3 | error("replot: invalid number of arguments"); 4 | endif 5 | 6 | switch (ws.plot) 7 | case "radplot" 8 | axis("auto"); 9 | replot; 10 | case "lonlatplot" 11 | axis("auto", "image"); 12 | replot; 13 | otherwise 14 | error("replot: no current plot!"); 15 | endswitch 16 | 17 | rws = ws; 18 | endfunction 19 | 20 | % vim:set syntax=octave: 21 | -------------------------------------------------------------------------------- /old/mvpgui/mvpgui_cmd_rplot.m: -------------------------------------------------------------------------------- 1 | function rws = mvpgui_cmd_rplot(ws, args) 2 | radbegin = -1; 3 | radend = -1; 4 | npts = -1; 5 | 6 | switch (numel(args)) 7 | case 1 8 | radbegin = ws.cp(3) - str2num(args{1}); 9 | radend = ws.cp(3) + str2num(args{1}); 10 | npts = 10; 11 | case 2 12 | radbegin = ws.cp(3) - str2num(args{1}); 13 | radend = ws.cp(3) + str2num(args{1}); 14 | npts = floor(str2num(args{2})); 15 | otherwise 16 | error("rplot: invalid number of arguments"); 17 | endswitch 18 | 19 | ws.radplot.poi = ws.poi; 20 | ws.radplot.georef = ws.georef; 21 | ws.radplot.cp = ws.cp; 22 | ws.radplot.rads = linspace(radbegin, radend, npts); 23 | 24 | printf("\n"); 25 | 26 | ws.radplot.obj = zeros(npts, 1); 27 | for k = 1:npts 28 | ws.radplot.obj(k) = mvpobj([ws.radplot.cp(1:2) ws.radplot.rads(k)], ws.poi, ws.georef, ws.orbs, ws.hwin, -1); 29 | printf("%d / %d\r", k, npts); 30 | endfor 31 | printf("\n\n"); 32 | 33 | ws.fig = plot(ws.radplot.rads, ws.radplot.obj, "*-"); 34 | ws.plot = "radplot"; 35 | pause(0); 36 | 37 | rws = ws; 38 | endfunction 39 | 40 | % vim:set syntax=octave: 41 | -------------------------------------------------------------------------------- /old/mvpgui/mvpgui_cmd_save.m: -------------------------------------------------------------------------------- 1 | function rws = mvpgui_cmd_save(ws, args) 2 | if (numel(args) != 1) 3 | error("save: invalid number of arguments"); 4 | endif 5 | 6 | switch(ws.plot) 7 | case "radplot" 8 | radplot = ws.radplot; 9 | save(args{1}, "radplot"); 10 | case "lonlatplot" 11 | lonlatplot = ws.lonlatplot; 12 | save(args{1}, "lonlatplot"); 13 | otherwise 14 | error("save: nothing to save"); 15 | endswitch 16 | 17 | rws = ws; 18 | endfunction 19 | 20 | % vim:set syntax=octave: 21 | -------------------------------------------------------------------------------- /old/mvpgui/mvpgui_parseArgs.m: -------------------------------------------------------------------------------- 1 | function [args err] = mvpgui_parseArgs(pargv, pnargin) 2 | args = {}; 3 | err = ""; 4 | 5 | if pnargin < 5 6 | error("Too few arguments"); 7 | endif 8 | 9 | args.demFile = pargv{1}; 10 | 11 | args.numOrbs = (numel(pargv) - 1) / 2; 12 | 13 | if floor(args.numOrbs) != args.numOrbs 14 | error("Supply a camera model for each orbital image!"); 15 | endif 16 | 17 | for k = 1:args.numOrbs 18 | args.imgFiles{k} = pargv{2 * k}; 19 | args.camFiles{k} = pargv{2 * k + 1}; 20 | endfor 21 | 22 | endfunction 23 | 24 | % vim:set syntax=octave: 25 | -------------------------------------------------------------------------------- /old/octave/README: -------------------------------------------------------------------------------- 1 | First run loadmvp to init all the variables 2 | 3 | Then run plotlonlatmvpobj to plot the obj function over various lon lats 4 | Then run plotradmvpobj to plot the obj function over various rads 5 | -------------------------------------------------------------------------------- /old/octave/_orthoproj_impl.m: -------------------------------------------------------------------------------- 1 | % mesh is a mesh where a typical vertex is (X(r,c), Y(r,c), Z(r,c)) 2 | % orbits has a img and cam 3 | function [xw yw] = _orthoproj_impl(xx, yy, zz, orbit) 4 | dim = size(xx); 5 | 6 | D = [xx(:), yy(:), zz(:), ones(dim(1) * dim(2), 1)]'; 7 | PD = orbit.cam * D; 8 | xw = reshape(PD(1,:) ./ PD(3,:), dim); 9 | yw = reshape(PD(2,:) ./ PD(3,:), dim); 10 | 11 | endfunction 12 | 13 | % vim:set syntax=octave: 14 | -------------------------------------------------------------------------------- /old/octave/_porthoproj_impl_ref.m: -------------------------------------------------------------------------------- 1 | function [xw yw] = _porthoproj_impl_ref(planeNormal, planeD, demPt, georef, orbit, hWin) 2 | 3 | dim = 2 * hWin + 1; 4 | 5 | [patchLon patchLat] = lonlatgrid(georef, dim, demPt - hWin); 6 | 7 | patchRad = planedem(planeNormal, planeD, patchLon, patchLat); 8 | 9 | [xx yy zz] = lonlatrad2xyz(patchLon, patchLat, patchRad); 10 | 11 | [xw yw] = _orthoproj_impl(xx, yy, zz, orbit); 12 | 13 | endfunction 14 | 15 | % vim:set syntax=octave: 16 | -------------------------------------------------------------------------------- /old/octave/ccrop.m: -------------------------------------------------------------------------------- 1 | % cntrPt is in x,y (not r,c) 2 | function r = ccrop(im, cntrPt, halfKern) 3 | r = im(cntrPt(2)-halfKern:cntrPt(2)+halfKern, cntrPt(1)-halfKern:cntrPt(1)+halfKern); 4 | endfunction 5 | 6 | % vim:set syntax=octave: 7 | -------------------------------------------------------------------------------- /old/octave/loadmvp.m: -------------------------------------------------------------------------------- 1 | synthSceneDir = "/home/khusmann/projects/MultipleViewPipeline/synth_scene/"; 2 | 3 | DATUM_RADIUS = 1737400; % Moon 4 | 5 | % Load DEMs 6 | [demGround georef] = imread_vw([synthSceneDir "ground-DEM.tif"]); 7 | demInitial = imread_vw([synthSceneDir "initial-DEM.tif"]); 8 | drgGround = imread_vw([synthSceneDir "ground-DRG.tif"]); 9 | 10 | % Add radius into DEMs 11 | demGround += DATUM_RADIUS; 12 | demInitial += DATUM_RADIUS; 13 | 14 | % Load orbits 15 | for n = 0:3 16 | orbits{n+1}.img = imread_vw([synthSceneDir num2str(n) ".tif"]); 17 | orbits{n+1}.cam = loadcam_vw([synthSceneDir num2str(n) ".pinhole"]); 18 | end 19 | 20 | % vim:set syntax=octave: 21 | -------------------------------------------------------------------------------- /old/octave/lonlat2normal.m: -------------------------------------------------------------------------------- 1 | function [n dn_dlonlat] = lonlat2normal(lonlat) 2 | clo = cos(lonlat(1)); 3 | slo = sin(lonlat(1)); 4 | cla = cos(lonlat(2)); 5 | sla = sin(lonlat(2)); 6 | 7 | n = [cla * clo; cla * slo; sla]; 8 | 9 | dn_dlonlat = [-cla*slo, cla*clo, 0; -sla*clo, -sla*slo, cla]'; 10 | endfunction 11 | 12 | % Verify grad calculation is correct 13 | %!test 14 | %! lonlat = [0.56; 0.23]; 15 | %! dlonlat = [1e-4; 1e-4]; 16 | %! [n1 grad] = lonlat2normal(lonlat); 17 | %! n2 = lonlat2normal(lonlat + dlonlat); 18 | %! dn = grad * dlonlat; 19 | %! dn_actual = n2 - n1; 20 | %! pct_diff = norm((dn - dn_actual) ./ dn_actual); 21 | %! assert(pct_diff, 0, 1e-3); 22 | 23 | % vim:set syntax=octave: 24 | -------------------------------------------------------------------------------- /old/octave/lonlatgrid.m: -------------------------------------------------------------------------------- 1 | function [lon lat] = lonlatgrid(georef, sz, off = [1 1]) 2 | if (isscalar(sz)) 3 | sz = [sz sz]; 4 | endif 5 | 6 | [X, Y] = meshgrid((0:sz(2) - 1) + off(1), (0:sz(1) - 1) + off(2)); 7 | D = [X(:), Y(:), ones(sz(1) * sz(2), 1)]'; 8 | PD = georef * D; 9 | 10 | lon = reshape(PD(1,:) ./ PD(3,:), sz); 11 | lat = reshape(PD(2,:) ./ PD(3,:), sz); 12 | endfunction 13 | 14 | %!test 15 | %! sz = [4, 3]; 16 | %! off = [5, 3]; 17 | %! georef = [0.00002, 0.00000, 0.98145; 18 | %! 0.00000, -0.00002, 0.16900; 19 | %! 0.00030, 0.00200, 1.00000]; 20 | %! [lon_imp lat_imp] = lonlatgrid(georef, sz, off); 21 | %! for r = 1:sz(1) 22 | %! for c = 1:sz(2) 23 | %! % px -> lonlat 24 | %! ll = georef * [c + off(1) - 1;r + off(2) - 1;1]; 25 | %! 26 | %! % store in result (and normalize homog coords) 27 | %! lon(r, c) = ll(1) / ll(3); 28 | %! lat(r, c) = ll(2) / ll(3); 29 | %! endfor 30 | %! endfor 31 | %! errLon = norm(lon_imp(:) - lon(:)); 32 | %! errLat = norm(lat_imp(:) - lat(:)); 33 | %! assert(errLon, 0, 1e-6); 34 | %! assert(errLat, 0, 1e-6); 35 | 36 | % vim:set syntax=octave: 37 | -------------------------------------------------------------------------------- /old/octave/lonlatrad2xyz.m: -------------------------------------------------------------------------------- 1 | function [xx yy zz] = lonlatrad2xyz(lon, lat, rad) 2 | if ((any(size(lon) != size(lat))) || (any(size(lat) != size(rad)))) 3 | error("lon, lat and rad must have same dim"); 4 | endif 5 | 6 | dim = size(lon); 7 | 8 | for r = 1:dim(1) 9 | for c = 1:dim(2) 10 | xyz = rad(r,c) * lonlat2normal([lon(r,c); lat(r,c)]); 11 | 12 | xx(r,c) = xyz(1); 13 | yy(r,c) = xyz(2); 14 | zz(r,c) = xyz(3); 15 | endfor 16 | endfor 17 | 18 | endfunction 19 | 20 | % vim:set syntax=octave: 21 | -------------------------------------------------------------------------------- /old/octave/mvperr.m: -------------------------------------------------------------------------------- 1 | function err = mvperr(patches, hKern, errfun) 2 | n = numel(patches); 3 | dim = size(patches{1}); 4 | 5 | % TODO: dispatch _mvperr_impl_gauss 6 | 7 | % Normalize patches 8 | for k = 1:n 9 | patches{k} = (patches{k} - mean(patches{k}(:))) / std(patches{k}(:)); 10 | endfor 11 | 12 | % Find the albedo 13 | meanpatch = zeros(dim); 14 | for k = 1:n 15 | meanpatch += patches{k}; 16 | endfor 17 | meanpatch /= n; 18 | 19 | % Find the sum of square error, in a gaussian window 20 | % TODO: (This should persist somehow) 21 | gaussrow = normpdf(1:dim(1), dim(1) / 2, dim(1) / 6); 22 | gausscol = normpdf(1:dim(2), dim(2) / 2, dim(2) / 6)'; 23 | gausswin = gausscol*gaussrow; 24 | 25 | err = 0; 26 | for k = 1:n 27 | err += sum((((meanpatch - patches{k}).^2)*gausswin)(:)); 28 | endfor 29 | 30 | endfunction 31 | 32 | % vim:set syntax=octave: 33 | -------------------------------------------------------------------------------- /old/octave/mvpobj.m: -------------------------------------------------------------------------------- 1 | function result = mvpobj(plane, demPt, georef, orbits, hWin, hKern, errfun = "gaussian") 2 | patches = mvpproj(plane, demPt, georef, orbits, hWin); 3 | result = mvperr(patches, hKern, errfun); 4 | endfunction 5 | 6 | % vim:set syntax=octave: 7 | -------------------------------------------------------------------------------- /old/octave/mvpproj.m: -------------------------------------------------------------------------------- 1 | function patches = mvpproj(plane, demPt, georef, orbits, hWin) 2 | [planeNormal planeD] = plane2normd(plane, demPt, georef); 3 | 4 | patches = cellfun(@(orbit) porthoproj(planeNormal, planeD, demPt, georef, orbit, hWin), 5 | orbits, "UniformOutput", false); 6 | endfunction 7 | 8 | % vim:set syntax=octave: 9 | -------------------------------------------------------------------------------- /old/octave/mvptest.m: -------------------------------------------------------------------------------- 1 | test lonlat2normal 2 | test lonlatgrid 3 | test _porthoproj_impl 4 | test _porthoproj_impl_affine 5 | 6 | % vim:set syntax=octave: 7 | -------------------------------------------------------------------------------- /old/octave/notes: -------------------------------------------------------------------------------- 1 | [xx yy zz] = lonlatrad2xyz(lon, lat, rad) 2 | 3 | [lon lat] = lonlatgrid(georef, size) 4 | rad = planedem(plane, lon, lat) 5 | 6 | p = ccrop(im, cntrPt, halfKern); 7 | 8 | im = orthoproj(xx, yy, zz, orbit) 9 | 10 | --------------------------------------------------------------- 11 | 12 | orthoproject whole DEM: 13 | given d = DEM, g = georef, o = orbit 14 | 15 | [lon lat] = lonlatgrid(g, size(d)); 16 | [xx yy zz] = lonlatrad2xyz(lon, lat, d); 17 | im = orthoproj(xx, yy, zz, o); 18 | 19 | 20 | orthoproject patch of DEM: 21 | given d = DEM, g = georef, o = orbit, cntrPt, halfKern 22 | 23 | [lon lat] = lonlatgrid(g, size(d)); 24 | plon = ccrop(lon, cntrPt, halfKern); 25 | plat = ccrop(lat, cntrPt, halfKern); 26 | prad = ccrop(d, cntrPt, halfKern); 27 | [xx yy zz] = lonlatrad2xyz(plon, plat, prad); 28 | im = orthoproject(xx, yy, zz, o); 29 | 30 | orthoproject plane dem: 31 | 32 | [lon lat] = lonlatgrid(g, size(d)); 33 | rad = planedem(plane, lon, lat); 34 | [xx yy zz] = lonlatrad2xyz(lon lat rad); 35 | im = orthoproject(xx, yy, zz, o); 36 | 37 | orthoproject plane dem patch: 38 | [lon lat] = lonlatgrid(g, size(d)); 39 | 40 | plon = ccrop(lon, cntrPt, halfKern); 41 | plat = ccrop(lat, cntrPt, halfKern); 42 | prad = planedem(plane, lon, lat); 43 | 44 | [xx yy zz] = lonlatrad2xyz(lon, lat, rad); 45 | im = orthoproject(xx, yy, zz, o) 46 | 47 | -------------------------------------------------------------------------------- /old/octave/orthoproj.m: -------------------------------------------------------------------------------- 1 | % mesh is a mesh where a typical vertex is (X(r,c), Y(r,c), Z(r,c)) 2 | % orbits has a img and cam 3 | function patch = orthoproj(xx, yy, zz, orbit) 4 | if ((any(size(xx) != size(yy))) || (any(size(yy) != size(zz)))) 5 | error("xx yy and zz must have same dim"); 6 | endif 7 | 8 | [xw yw] = _orthoproj_impl(xx, yy, zz, orbit); 9 | 10 | patch = imremap(orbit.img, xw, yw, "bilinear"); 11 | 12 | endfunction 13 | 14 | % vim:set syntax=octave: 15 | -------------------------------------------------------------------------------- /old/octave/plane2normd.m: -------------------------------------------------------------------------------- 1 | function [planeNormal planeD] = plane2normd(plane, demPt, georef) 2 | cntrPtLonLatH = georef * [demPt(1); demPt(2); 1]; 3 | cntrPtXYZ = plane(3) * lonlat2normal(cntrPtLonLatH(1:2) / cntrPtLonLatH(3)); 4 | planeNormal = lonlat2normal(plane(1:2)); 5 | planeD = dot(planeNormal, cntrPtXYZ); 6 | endfunction 7 | 8 | % vim:set syntax=octave: 9 | -------------------------------------------------------------------------------- /old/octave/planedem.m: -------------------------------------------------------------------------------- 1 | function rad = planedem(normal, d, lon, lat) 2 | if (any(size(lon) != size(lat))) 3 | error("lon and lat dims must be the same"); 4 | endif 5 | 6 | dim = size(lon); 7 | 8 | rad = zeros(dim); 9 | 10 | for r = 1:dim(1) 11 | for c = 1:dim(2) 12 | rad(r, c) = d / dot(normal, lonlat2normal([lon(r, c) lat(r, c)])); 13 | endfor 14 | endfor 15 | endfunction 16 | 17 | % vim:set syntax=octave: 18 | -------------------------------------------------------------------------------- /old/octave/porthoproj.m: -------------------------------------------------------------------------------- 1 | function patch = porthoproj(planeNormal, planeD, demPt, georef, orbit, hWin) 2 | [xw yw] = _porthoproj_impl(planeNormal, planeD, demPt, georef, orbit, hWin); 3 | patch = imremap(orbit.img, xw, yw, "bilinear"); 4 | endfunction 5 | 6 | % vim:set syntax=octave: 7 | -------------------------------------------------------------------------------- /old/papers/brainstorm/High-level Flowchart for MVC.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/brainstorm/High-level Flowchart for MVC.pdf -------------------------------------------------------------------------------- /old/papers/eccv2012/eccv2012-eso-pic.sty: -------------------------------------------------------------------------------- 1 | eccv2012kit/eccv2012-eso-pic.sty -------------------------------------------------------------------------------- /old/papers/eccv2012/eccv2012-everyshi.sty: -------------------------------------------------------------------------------- 1 | eccv2012kit/eccv2012-everyshi.sty -------------------------------------------------------------------------------- /old/papers/eccv2012/eccv2012-ruler.sty: -------------------------------------------------------------------------------- 1 | eccv2012kit/eccv2012-ruler.sty -------------------------------------------------------------------------------- /old/papers/eccv2012/eccv2012.bst: -------------------------------------------------------------------------------- 1 | eccv2012kit/eccv2012.bst -------------------------------------------------------------------------------- /old/papers/eccv2012/eccv2012.cls: -------------------------------------------------------------------------------- 1 | eccv2012kit/eccv2012.cls -------------------------------------------------------------------------------- /old/papers/eccv2012/eccv2012.layout: -------------------------------------------------------------------------------- 1 | eccv2012kit/eccv2012.layout -------------------------------------------------------------------------------- /old/papers/eccv2012/eccv2012kit/README.txt: -------------------------------------------------------------------------------- 1 | 2 | To make a sample ECCV paper, copy the contents of this directory 3 | somewhere, and type 4 | 5 | latex eccv2012submission 6 | bibtex eccv2012submission 7 | latex eccv2012submission 8 | latex eccv2012submission 9 | 10 | or 11 | 12 | pdflatex eccv2012submission 13 | bibtex eccv2012submission 14 | pdflatex eccv2012submission 15 | pdflatex eccv2012submission 16 | -------------------------------------------------------------------------------- /old/papers/eccv2012/eccv2012kit/eccv2012submission.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/eccv2012/eccv2012kit/eccv2012submission.pdf -------------------------------------------------------------------------------- /old/papers/eccv2012/eccv2012kit/egbib.bib: -------------------------------------------------------------------------------- 1 | 2 | @misc{Authors12, 3 | author = {Authors}, 4 | title = {The frobnicatable foo filter}, 5 | note = {BMVC12 submission ID 324. Supplied as additional material {\tt bmvc12.pdf}}, 6 | year = 2012 7 | } 8 | 9 | @misc{Authors12b, 10 | author = {Authors}, 11 | title = {Frobnication tutorial}, 12 | note = {Supplied as additional material {\tt tr.pdf}}, 13 | year = 2012 14 | } 15 | 16 | @article{Alpher02, 17 | author = {A. Alpher}, 18 | title = {Frobnication}, 19 | journal = {Journal of Foo}, 20 | volume = 12, 21 | number = 1, 22 | pages = {234--778}, 23 | year = 2002 24 | } 25 | 26 | @article{Alpher03, 27 | author = {A. Alpher and and J.~P.~N. Fotheringham-Smythe}, 28 | title = {Frobnication revisited}, 29 | journal = {Journal of Foo}, 30 | volume = 13, 31 | number = 1, 32 | pages = {234--778}, 33 | year = 2003 34 | } 35 | 36 | @article{Alpher04, 37 | author = {A. Alpher and and J.~P.~N. Fotheringham-Smythe and G. Gamow}, 38 | title = {Can a machine frobnicate?}, 39 | journal = {Journal of Foo}, 40 | volume = 14, 41 | number = 1, 42 | pages = {234--778}, 43 | year = 2004 44 | } 45 | -------------------------------------------------------------------------------- /old/papers/eccv2012/eccv2012kit/eijkel2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/eccv2012/eccv2012kit/eijkel2.pdf -------------------------------------------------------------------------------- /old/papers/eccv2012/eccv2012kit/sidebyside.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/eccv2012/eccv2012kit/sidebyside.pdf -------------------------------------------------------------------------------- /old/papers/kdh_srproj/Kelsh_stereoplotter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/Kelsh_stereoplotter.jpg -------------------------------------------------------------------------------- /old/papers/kdh_srproj/amvp_flowchart.dia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/amvp_flowchart.dia -------------------------------------------------------------------------------- /old/papers/kdh_srproj/asp_flowchart.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/asp_flowchart.tiff -------------------------------------------------------------------------------- /old/papers/kdh_srproj/colorized_dem.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/colorized_dem.tiff -------------------------------------------------------------------------------- /old/papers/kdh_srproj/coverpage_snrproj.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/coverpage_snrproj.doc -------------------------------------------------------------------------------- /old/papers/kdh_srproj/dem_bundle_adjust.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/dem_bundle_adjust.tiff -------------------------------------------------------------------------------- /old/papers/kdh_srproj/dem_no_bundle_adjust.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/dem_no_bundle_adjust.tiff -------------------------------------------------------------------------------- /old/papers/kdh_srproj/kdh_srproj.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/kdh_srproj.pdf -------------------------------------------------------------------------------- /old/papers/kdh_srproj/orbit0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/orbit0.png -------------------------------------------------------------------------------- /old/papers/kdh_srproj/orbit1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/orbit1.png -------------------------------------------------------------------------------- /old/papers/kdh_srproj/orbit2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/orbit2.png -------------------------------------------------------------------------------- /old/papers/kdh_srproj/orbit3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/orbit3.png -------------------------------------------------------------------------------- /old/papers/kdh_srproj/subpixel_mode_bottom.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/subpixel_mode_bottom.tiff -------------------------------------------------------------------------------- /old/papers/kdh_srproj/subpixel_mode_top.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/subpixel_mode_top.tiff -------------------------------------------------------------------------------- /old/papers/kdh_srproj/synthDEM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/synthDEM.png -------------------------------------------------------------------------------- /old/papers/kdh_srproj/synthDRG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/synthDRG.png -------------------------------------------------------------------------------- /old/papers/kdh_srproj/synthorbit0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/synthorbit0.png -------------------------------------------------------------------------------- /old/papers/kdh_srproj/synthorbit1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/synthorbit1.png -------------------------------------------------------------------------------- /old/papers/kdh_srproj/synthorbit2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/synthorbit2.png -------------------------------------------------------------------------------- /old/papers/kdh_srproj/synthorbit3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/synthorbit3.png -------------------------------------------------------------------------------- /old/papers/kdh_srproj/template_matching.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/kdh_srproj/template_matching.tiff -------------------------------------------------------------------------------- /old/papers/lyx_notes: -------------------------------------------------------------------------------- 1 | To get urls, used the plainurl.bst style found online. 2 | It uses the url package for \url. To enable it, in the preamble of the doc, write \usepackage{url} 3 | 4 | if you try to insert a url in a caption it errors. you need to add \protect: \protect\url{http://} 5 | -------------------------------------------------------------------------------- /old/papers/misc/mvp_flow.dia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/misc/mvp_flow.dia -------------------------------------------------------------------------------- /old/papers/misc/mvp_flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/misc/mvp_flow.png -------------------------------------------------------------------------------- /old/papers/misc/mvp_fullsystem.dia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/misc/mvp_fullsystem.dia -------------------------------------------------------------------------------- /old/papers/misc/mvp_fullsystem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/misc/mvp_fullsystem.png -------------------------------------------------------------------------------- /old/papers/proposal/amvp_flowchart.dia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/proposal/amvp_flowchart.dia -------------------------------------------------------------------------------- /old/papers/proposal/amvp_flowchart.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/proposal/amvp_flowchart.pdf -------------------------------------------------------------------------------- /old/papers/proposal/asp_flowchart.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/proposal/asp_flowchart.tiff -------------------------------------------------------------------------------- /old/papers/proposal/colorized_dem.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/proposal/colorized_dem.tiff -------------------------------------------------------------------------------- /old/papers/proposal/dem_bundle_adjust.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/proposal/dem_bundle_adjust.tiff -------------------------------------------------------------------------------- /old/papers/proposal/dem_no_bundle_adjust.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/proposal/dem_no_bundle_adjust.tiff -------------------------------------------------------------------------------- /old/papers/proposal/subpixel_mode_bottom.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/proposal/subpixel_mode_bottom.tiff -------------------------------------------------------------------------------- /old/papers/proposal/subpixel_mode_top.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/proposal/subpixel_mode_top.tiff -------------------------------------------------------------------------------- /old/papers/proposal/template_matching.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/old/papers/proposal/template_matching.tiff -------------------------------------------------------------------------------- /python/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include (PythonHelpers) 2 | 3 | pyinstall_bin(mvpadmin.py) 4 | 5 | # Make / Install protobuf python modules 6 | build_pyproto_tree(PROTO_TREE ${CMAKE_SOURCE_DIR}/src) 7 | build_pyproto_tree(PROTO_TREE ${CMAKE_SOURCE_DIR}/thirdparty/vw_protobuf) 8 | 9 | PROTOBUF_GENERATE(PYOUT PROTO_PYS 10 | IPATHS ${CMAKE_BINARY_DIR}/python 11 | OUTPUT ${CMAKE_BINARY_DIR}/python 12 | PROTOS ${PROTO_TREE}) 13 | 14 | add_custom_target(pyProto ALL DEPENDS ${PROTO_TREE} ${PROTO_PYS}) 15 | 16 | pyinstall(FILES ${PROTO_PYS} 17 | BASEPATH ${CMAKE_BINARY_DIR}/python 18 | DESTINATION ${PYTHON_INSTALL_DIR}) 19 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(mvp) 2 | add_subdirectory(tools) 3 | 4 | if (BUILD_TESTS) 5 | add_subdirectory(test) 6 | endif() 7 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/AlbedoBox.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | EMIT_ALGORITHM_OBJECT_CPP(AlbedoBox) 4 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/AlbedoBox.h: -------------------------------------------------------------------------------- 1 | #ifndef __MVP_ALGORITHM_ALBEDOBOX_H__ 2 | #define __MVP_ALGORITHM_ALBEDOBOX_H__ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | ALGORITHM_SETTINGS_GLOBAL_DEFAULTER(AlbedoBoxSettings, albedo_box_settings) 10 | 11 | #define ALGORITHM_OBJECT_AlbedoBox(T) \ 12 | BEGIN_##T(AlbedoBox, mvp::algorithm::AlbedoBox, \ 13 | (mvp::algorithm::PatchBox const&)(vw::Vector const&)(vw::Vector const&) \ 14 | (mvp::core::GlobalSettings::AlbedoBoxSettings const&)) \ 15 | T##_C(albedo, (vw::ImageView)) \ 16 | T##_C(weight, (vw::ImageView)) \ 17 | T##_C(global_albedo, (vw::ImageView)) \ 18 | T##_C(a, (vw::Vector)) \ 19 | T##_C(b, (vw::Vector)) \ 20 | T##_C(weight_sum, (vw::ImageView)) \ 21 | T##_C(weight_sum2, (vw::ImageView)) \ 22 | T##_C(rows, (int)) \ 23 | T##_C(cols, (int)) \ 24 | T##_C(planes, (int)) \ 25 | END_##T() 26 | 27 | EMIT_ALGORITHM_OBJECT(AlbedoBox) 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/AlbedoBox/DefaultAlbedoBox.m: -------------------------------------------------------------------------------- 1 | function self = DefaultAlbedoBox(_patch_box, _a, _b) 2 | self = mvpclass(); 3 | 4 | dim = [_patch_box.rows() _patch_box.cols()]; 5 | num_patches = _patch_box.planes(); 6 | 7 | arep = repmat(reshape(_a, [1 1 num_patches]), [dim 1]); 8 | brep = repmat(reshape(_b, [1 1 num_patches]), [dim 1]); 9 | 10 | self._albedo = _patch_box.intensity() .* arep + brep; 11 | self._weight = _patch_box.weight(); 12 | 13 | % self._xgrad_albedo = _patch_box.xgrad_intensity() .* arep; 14 | % self._ygrad_albedo = _patch_box.ygrad_intensity() .* arep; 15 | % self._xgrad_weight = _patch_box.xgrad_weight(); 16 | % self._ygrad_weight = _patch_box.ygrad_weight(); 17 | 18 | self._weight_sum = _patch_box.weight_sum(); 19 | self._weight_sum2 = _patch_box.weight_sum2(); 20 | 21 | self._global_albedo = sum(self._albedo, 3) ./ self._weight_sum; 22 | 23 | self._a = _a; 24 | self._b = _b; 25 | 26 | self.albedo = @(self) self._albedo; 27 | self.weight = @(self) self._weight; 28 | 29 | self.global_albedo = @(self) self._global_albedo; 30 | self.a = @(self) self._a; 31 | self.b = @(self) self._b; 32 | 33 | self.weight_sum = @(self) self._weight_sum; 34 | self.weight_sum2 = @(self) self._weight_sum2; 35 | 36 | self.rows = @(self) dim(1); 37 | self.cols = @(self) dim(2); 38 | self.planes = @(self) num_patches; 39 | endfunction 40 | 41 | % vim:set syntax=octave: 42 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/AlgorithmVar.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | EMIT_ALGORITHM_OBJECT_CPP(AlgorithmVar) 4 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/AlgorithmVar.h: -------------------------------------------------------------------------------- 1 | #ifndef __MVP_ALGORITHM_ALGORITHMVAR_H__ 2 | #define __MVP_ALGORITHM_ALGORITHMVAR_H__ 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | namespace mvp { 12 | namespace algorithm { 13 | typedef vw::Vector AlgorithmVarVector; 14 | }} 15 | 16 | ALGORITHM_SETTINGS_GLOBAL_DEFAULTER(AlgorithmVarSettings, algorithm_var_settings) 17 | 18 | #define ALGORITHM_OBJECT_AlgorithmVar(T) \ 19 | BEGIN_##T(AlgorithmVar, mvp::algorithm::AlgorithmVar, \ 20 | (mvp::algorithm::AlgorithmVarVector const&)(mvp::core::GlobalSettings::AlgorithmVarSettings const&)) \ 21 | T##_C(radius, (double)) \ 22 | T##_C(orientation, (vw::Quat)) \ 23 | T##_C(window, (vw::Vector2)) \ 24 | T##_C(gwindow, (vw::Vector2)) \ 25 | T##_C(smooth, (double)) \ 26 | T##_C(gsmooth, (double)) \ 27 | T##_C(scale, (double)) \ 28 | T##_C(vectorize, (mvp::algorithm::AlgorithmVarVector)) \ 29 | END_##T() 30 | 31 | EMIT_ALGORITHM_OBJECT(AlgorithmVar) 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/AlgorithmVar/DefaultAlgorithmVar.m: -------------------------------------------------------------------------------- 1 | function self = DefaultAlgorithmVar(_v) 2 | self = mvpclass(); 3 | 4 | self._v = _v(:); 5 | 6 | self.radius = @(self) self._v(globals().RADIUS_IDX); 7 | self.orientation = @(self) self._v(globals().ORIENTATION_IDX); 8 | self.window = @(self) self._v(globals().WINDOW_IDX); 9 | self.gwindow = @(self) self._v(globals().GWINDOW_IDX); 10 | self.smooth = @(self) self._v(globals().SMOOTH_IDX); 11 | self.gsmooth = @(self) self._v(globals().GSMOOTH_IDX); 12 | self.scale = @(self) self._v(globals().SCALE_IDX); 13 | self.vectorize = @(self) self._v; 14 | endfunction 15 | 16 | % vim:set syntax=octave: 17 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | mvp_module(NAME Algorithm 2 | DEPS mvpCore 3 | mvpImage 4 | HDRS Dummy.h 5 | SRCS Dummy.cc 6 | Dummy/DerivedDummy.cc 7 | AlgorithmVar.cc 8 | PixelResult.cc 9 | Seed.cc 10 | TileResult.cc 11 | PatchBox.cc 12 | AlbedoBox.cc 13 | Lighter.cc 14 | Objective.cc 15 | Stepper.cc 16 | Seeder.cc 17 | Correlator.cc 18 | ObjectiveHelper.cc 19 | PROTOS DummySettings.proto 20 | LighterSettings.proto 21 | ObjectiveSettings.proto 22 | StepperSettings.proto 23 | SeederSettings.proto 24 | CorrelatorSettings.proto 25 | ) 26 | 27 | #if (BUILD_TESTS) 28 | # add_subdirectory(tests) 29 | #endif() 30 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Correlator.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | EMIT_ALGORITHM_OBJECT_CPP(Correlator) 4 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Correlator.h: -------------------------------------------------------------------------------- 1 | #ifndef __MVP_ALGORITHM_CORRELATOR_H__ 2 | #define __MVP_ALGORITHM_CORRELATOR_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | #define ALGORITHM_OBJECT_Correlator(T) \ 13 | BEGIN_##T(Correlator, mvp::algorithm::Correlator, (mvp::image::OrbitalImageCollection const&) \ 14 | (mvp::algorithm::Lighter const&)(mvp::algorithm::Objective const&) \ 15 | (mvp::algorithm::CorrelatorSettings const&)) \ 16 | T##_C(correlate, (mvp::algorithm::PixelResult)(vw::Vector3 const&)(mvp::algorithm::AlgorithmVar const&)) \ 17 | END_##T() 18 | 19 | EMIT_ALGORITHM_OBJECT(Correlator) 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/CorrelatorSettings.proto: -------------------------------------------------------------------------------- 1 | package mvp.algorithm; 2 | 3 | message CorrelatorSettings { 4 | optional string impl_name = 1 [default="FminbndCorrelator"]; 5 | optional bool use_octave = 2 [default=true]; 6 | 7 | optional int32 max_iter = 3 [default=80]; 8 | optional double tol = 4 [default=1e-2]; 9 | optional double alt_min = 5; 10 | optional double alt_max = 6; 11 | optional double alt_search_range = 7; 12 | } 13 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Dummy.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | EMIT_ALGORITHM_OBJECT_CPP(Dummy) 4 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Dummy.h: -------------------------------------------------------------------------------- 1 | #ifndef __MVP_ALGORITHM_DUMMY_H__ 2 | #define __MVP_ALGORITHM_DUMMY_H__ 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | 10 | #define ALGORITHM_OBJECT_Dummy(T) \ 11 | BEGIN_##T(Dummy, mvp::algorithm::Dummy, (int)(int)(mvp::algorithm::DummySettings const&)) \ 12 | T(void0, (void)) \ 13 | T(void1, (void)(int)) \ 14 | T(void2, (void)(int)(int)) \ 15 | T(function0, (int)) \ 16 | T(function1, (int)(int)) \ 17 | T(function2, (int)(int)(int)) \ 18 | T##_C(x, (int)) \ 19 | T##_C(y, (int)) \ 20 | T(do_vector, (vw::Vector2)(vw::Vector3 const&)) \ 21 | T(do_vector, (vw::Vector2)(vw::Vector2 const&)) \ 22 | END_##T() 23 | 24 | EMIT_ALGORITHM_OBJECT(Dummy) 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Dummy/DerivedDummy.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace mvp { 4 | namespace algorithm { 5 | 6 | struct DerivedDummy : public Dummy { 7 | int m_x; 8 | int m_y; 9 | 10 | DerivedDummy(int x, int y, DummySettings const& settings) : Dummy(NO_OBJECT_IMPL()), m_x(x), m_y(y) {} 11 | 12 | void void0() {} 13 | 14 | void void1(int a) {} 15 | 16 | void void2(int a, int b) {} 17 | 18 | int function0() { return 0; } 19 | 20 | int function1(int a) { return a; } 21 | 22 | int function2(int a, int b) { return a + b; } 23 | 24 | int x() const { return m_x; } 25 | 26 | int y() const { return m_y; } 27 | 28 | vw::Vector2 do_vector(vw::Vector3 const& a) { return vw::math::subvector(a, 0, 2); } 29 | 30 | vw::Vector2 do_vector(vw::Vector2 const& a) { return a; } 31 | }; 32 | 33 | REGISTER_ALGORITHM_OBJECT(DerivedDummy); 34 | 35 | }} // namespace algorithm,mvp 36 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Dummy/DerivedDummy.m: -------------------------------------------------------------------------------- 1 | function self = DerivedDummy(x, y) 2 | self = mvpclass(); 3 | 4 | self.m_x = 0; 5 | self.m_y = 0; 6 | 7 | if (nargin > 0) 8 | self.m_x = x; 9 | endif 10 | 11 | if (nargin > 1) 12 | self.m_y = y; 13 | endif 14 | 15 | self.void0 = @void0; 16 | self.void1 = @void1; 17 | self.void2 = @void2; 18 | self.function0 = @function0; 19 | self.function1 = @function1; 20 | self.function2 = @function2; 21 | self.x = @x; 22 | self.y = @y; 23 | endfunction 24 | 25 | function void0(self) 26 | disp("ASDFASDF"); 27 | endfunction 28 | 29 | function void1(self) 30 | endfunction 31 | 32 | function void2(self) 33 | endfunction 34 | 35 | function rtn = function0(self) 36 | rtn = 0; 37 | endfunction 38 | 39 | function rtn = function1(self, a) 40 | rtn = a; 41 | endfunction 42 | 43 | function rtn = function2(self, a, b) 44 | rtn = a + b; 45 | endfunction 46 | 47 | function rtn = x(self) 48 | rtn = self.m_x; 49 | endfunction 50 | 51 | function rtn = y(self) 52 | rtn = self.m_y; 53 | endfunction 54 | 55 | % vim:set syntax=octave: 56 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/DummySettings.proto: -------------------------------------------------------------------------------- 1 | package mvp.algorithm; 2 | 3 | message DummySettings { 4 | optional string impl_name = 1 [default="DerivedDummy"]; 5 | optional bool use_octave = 2; 6 | } 7 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Lighter.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | EMIT_ALGORITHM_OBJECT_CPP(Lighter) 4 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Lighter.h: -------------------------------------------------------------------------------- 1 | #ifndef __MVP_ALGORITHM_LIGHTER_H__ 2 | #define __MVP_ALGORITHM_LIGHTER_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #define ALGORITHM_OBJECT_Lighter(T) \ 11 | BEGIN_##T(Lighter, mvp::algorithm::Lighter, (mvp::algorithm::LighterSettings const&)) \ 12 | T##_C(light, (mvp::algorithm::AlbedoBox)(mvp::algorithm::PatchBox const&)) \ 13 | END_##T() 14 | 15 | EMIT_ALGORITHM_OBJECT(Lighter) 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Lighter/NormalizingLighter.m: -------------------------------------------------------------------------------- 1 | function self = NormalizingLighter() 2 | self = mvpclass(); 3 | self.light = @light; 4 | endfunction 5 | 6 | function albedo_box = light(self, patch_box) 7 | dim = [patch_box.rows() patch_box.cols()]; 8 | num_patches = patch_box.planes(); 9 | 10 | si = sum(sum(patch_box.intensity()))(:); 11 | si2 = sum(sum(patch_box.intensity2()))(:); 12 | sw = sum(sum(patch_box.weight()))(:); 13 | 14 | patch_mean = si ./ sw; 15 | patch_stddev = (si2 .* sw - si .* si) ./ sw ./ sw; 16 | 17 | prevWarnState = warning("query", "Octave:divide-by-zero"); 18 | warning("off", "Octave:divide-by-zero"); 19 | 20 | a = 1 ./ patch_stddev; 21 | a(isnan(a)) = 0; 22 | 23 | warning(prevWarnState.state, prevWarnState.identifier); 24 | 25 | b = -patch_mean .* a; 26 | 27 | albedo_box = AlbedoBox(patch_box, a, b); 28 | endfunction 29 | 30 | %!test 31 | %! 32 | %! 33 | %! 34 | %! 35 | %! 36 | 37 | % vim:set syntax=octave: 38 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/LighterSettings.proto: -------------------------------------------------------------------------------- 1 | package mvp.algorithm; 2 | 3 | message LighterSettings { 4 | optional string impl_name = 1 [default="NormalizingLighter"]; 5 | optional bool use_octave = 2 [default=true]; 6 | } 7 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Objective.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | EMIT_ALGORITHM_OBJECT_CPP(Objective) 4 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Objective.h: -------------------------------------------------------------------------------- 1 | #ifndef __MVP_ALGORITHM_OBJECTIVE_H__ 2 | #define __MVP_ALGORITHM_OBJECTIVE_H__ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #define ALGORITHM_OBJECT_Objective(T) \ 10 | BEGIN_##T(Objective, mvp::algorithm::Objective, (mvp::algorithm::ObjectiveSettings const&)) \ 11 | T##_C(func, (double)(mvp::algorithm::AlbedoBox const&)) \ 12 | T##_C(grad, (vw::Matrix)(mvp::algorithm::AlbedoBox const&)) \ 13 | END_##T() 14 | 15 | EMIT_ALGORITHM_OBJECT(Objective) 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Objective/AbsDiffObjective.m: -------------------------------------------------------------------------------- 1 | function self = AbsDiffObjective() 2 | self = mvpclass(); 3 | 4 | self.func = @func; 5 | self.grad = @grad; 6 | endfunction 7 | 8 | function f = func(self, albedo_box) 9 | dim = [albedo_box.rows() albedo_box.cols()]; 10 | num_patches = albedo_box.planes(); 11 | 12 | absdiffs = abs(albedo_box.albedo() - repmat(albedo_box.global_albedo(), [1 1 num_patches])); 13 | 14 | f = sum(absdiffs(:)) / sum(albedo_box.weight_sum()(:)); 15 | endfunction 16 | 17 | function grad(self) 18 | error("AbsDiffObjective does not support a gradient"); 19 | endfunction 20 | 21 | % vim:set syntax=octave: 22 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/ObjectiveHelper.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | EMIT_ALGORITHM_OBJECT_CPP(ObjectiveHelper) 4 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/ObjectiveHelper.h: -------------------------------------------------------------------------------- 1 | #ifndef __MVP_ALGORITHM_OBJECTIVEHELPER_H__ 2 | #define __MVP_ALGORITHM_OBJECTIVEHELPER_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | ALGORITHM_SETTINGS_GLOBAL_DEFAULTER(ObjectiveHelperSettings, objective_helper_settings) 12 | 13 | #define ALGORITHM_OBJECT_ObjectiveHelper(T) \ 14 | BEGIN_##T(ObjectiveHelper, mvp::algorithm::ObjectiveHelper, (mvp::image::OrbitalImageCollection const&) \ 15 | (mvp::algorithm::Lighter const&)(mvp::algorithm::Objective const&)(vw::Vector3 const&) \ 16 | (mvp::core::GlobalSettings::ObjectiveHelperSettings const&)) \ 17 | T##_C(func, (double)(mvp::algorithm::AlgorithmVar const&)) \ 18 | T##_C(grad, (vw::Matrix)(mvp::algorithm::AlgorithmVar const&)) \ 19 | END_##T() 20 | 21 | EMIT_ALGORITHM_OBJECT(ObjectiveHelper) 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/ObjectiveSettings.proto: -------------------------------------------------------------------------------- 1 | package mvp.algorithm; 2 | 3 | message ObjectiveSettings { 4 | optional string impl_name = 1 [default="AbsDiffObjective"]; 5 | optional bool use_octave = 2 [default=true]; 6 | } 7 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/PatchBox.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | EMIT_ALGORITHM_OBJECT_CPP(PatchBox) 4 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/PatchBox.h: -------------------------------------------------------------------------------- 1 | #ifndef __MVP_ALGORITHM_PATCHBOX_H__ 2 | #define __MVP_ALGORITHM_PATCHBOX_H__ 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | 10 | ALGORITHM_SETTINGS_GLOBAL_DEFAULTER(PatchBoxSettings, patch_box_settings) 11 | 12 | #define ALGORITHM_OBJECT_PatchBox(T) \ 13 | BEGIN_##T(PatchBox, mvp::algorithm::PatchBox, \ 14 | (std::vector > const&)(vw::Vector2 const&)(double)(double) \ 15 | (mvp::core::GlobalSettings::PatchBoxSettings const&)) \ 16 | T##_C(window, (vw::ImageView)) \ 17 | T##_C(intensity, (vw::ImageView)) \ 18 | T##_C(intensity2, (vw::ImageView)) \ 19 | T##_C(weight, (vw::ImageView)) \ 20 | T##_C(weight_sum, (vw::ImageView)) \ 21 | T##_C(weight_sum2, (vw::ImageView)) \ 22 | T##_C(rows, (int)) \ 23 | T##_C(cols, (int)) \ 24 | T##_C(planes, (int)) \ 25 | END_##T() 26 | 27 | EMIT_ALGORITHM_OBJECT(PatchBox) 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/PatchBox/DefaultPatchBox.m: -------------------------------------------------------------------------------- 1 | function self = DefaultPatchBox(_patches, _gwindow, _smooth, _gsmooth) 2 | self = mvpclass(); 3 | 4 | dim = size(_patches{1})(1:2); 5 | num_patches = numel(_patches); 6 | 7 | self._intensity = zeros(dim(1), dim(2), num_patches); 8 | self._weight = zeros(dim(1), dim(2), num_patches); 9 | 10 | for i = 1:num_patches 11 | self._intensity(:, :, i) = _patches{i}(:, :, 1); 12 | self._weight(:, :, i) = _patches{i}(:, :, 2); 13 | endfor 14 | 15 | self._intensity2 = self._intensity .* self._intensity; 16 | 17 | % TODO: Smooth weight+intensity+intensity2 with gsmooth+smooth 18 | 19 | % TODO: Create gaussian window 20 | self._window = ones(dim); 21 | 22 | % Calculate weight sums 23 | self._weight_sum = sum(self._weight, 3); 24 | self._weight_sum2 = sum(self._weight .* self._weight, 3); 25 | 26 | self.window = @(self) self._window; 27 | self.intensity = @(self) self._intensity; 28 | self.intensity2 = @(self) self._intensity2; 29 | self.weight = @(self) self._weight; 30 | self.weight_sum = @(self) self._weight_sum; 31 | self.weight_sum2 = @(self) self._weight_sum2; 32 | 33 | self.rows = @(self) dim(1); 34 | self.cols = @(self) dim(2); 35 | self.planes = @(self) num_patches; 36 | endfunction 37 | 38 | % vim:set syntax=octave: 39 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/PixelResult.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | EMIT_ALGORITHM_OBJECT_CPP(PixelResult) 4 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/PixelResult.h: -------------------------------------------------------------------------------- 1 | #ifndef __MVP_ALGORITHM_PIXELRESULT_H__ 2 | #define __MVP_ALGORITHM_PIXELRESULT_H__ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | namespace mvp { 10 | namespace algorithm { 11 | typedef vw::Vector PixelResultVector; 12 | }} 13 | 14 | ALGORITHM_SETTINGS_GLOBAL_DEFAULTER(PixelResultSettings, pixel_result_settings) 15 | 16 | #define ALGORITHM_OBJECT_PixelResult(T) \ 17 | BEGIN_##T(PixelResult, mvp::algorithm::PixelResult, \ 18 | (mvp::algorithm::PixelResultVector const&)(mvp::core::GlobalSettings::PixelResultSettings const&)) \ 19 | T##_C(algorithm_var, (mvp::algorithm::AlgorithmVar)) \ 20 | T##_C(confidence, (double)) \ 21 | T##_C(converged, (bool)) \ 22 | T##_C(num_iterations, (int)) \ 23 | T##_C(vectorize, (mvp::algorithm::PixelResultVector)) \ 24 | END_##T() 25 | 26 | EMIT_ALGORITHM_OBJECT(PixelResult) 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/PixelResult/DefaultPixelResult.m: -------------------------------------------------------------------------------- 1 | function self = DefaultPixelResult(v) 2 | self = mvpclass(); 3 | 4 | self._v = v; 5 | 6 | self.algorithm_var = @(self) AlgorithmVar(self._v(1:globals().ALGORITHMVAR_LENGTH)); 7 | self.confidence = @(self) self._v(globals().CONFIDENCE_IDX); 8 | self.converged = @(self) self._v(globals().CONVERGED_IDX); 9 | self.num_iterations = @(self) self._v(globals().NUM_ITERATIONS_IDX); 10 | self.vectorize = @(self) self._v; 11 | endfunction 12 | 13 | % vim:set syntax=octave: 14 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Seed.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | EMIT_ALGORITHM_OBJECT_CPP(Seed) 4 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Seed.h: -------------------------------------------------------------------------------- 1 | #ifndef __MVP_ALGORITHM_SEED_H__ 2 | #define __MVP_ALGORITHM_SEED_H__ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | ALGORITHM_SETTINGS_GLOBAL_DEFAULTER(SeedSettings, seed_settings) 10 | 11 | #define ALGORITHM_OBJECT_Seed(T) \ 12 | BEGIN_##T(Seed, mvp::algorithm::Seed, (vw::Vector2 const&)(mvp::algorithm::PixelResult const&) \ 13 | (mvp::core::GlobalSettings::SeedSettings const&)) \ 14 | T##_C(lonlat, (vw::Vector2)) \ 15 | T##_C(value, (mvp::algorithm::PixelResult)) \ 16 | END_##T() 17 | 18 | EMIT_ALGORITHM_OBJECT(Seed) 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Seed/DefaultSeed.m: -------------------------------------------------------------------------------- 1 | function self = DefaultSeed(_lonlat, _value) 2 | self = mvpclass(); 3 | 4 | self._lonlat = _lonlat; 5 | self._value = _value; 6 | 7 | self.lonlat = @(self) self._lonlat; 8 | self.value = @(self) self._value; 9 | endfunction 10 | 11 | % vim:set syntax=octave: 12 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Seeder.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | EMIT_ALGORITHM_OBJECT_CPP(Seeder) 4 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Seeder.h: -------------------------------------------------------------------------------- 1 | #ifndef __MVP_ALGORITHM_SEEDER_H__ 2 | #define __MVP_ALGORITHM_SEEDER_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #include 11 | 12 | #define ALGORITHM_OBJECT_Seeder(T) \ 13 | BEGIN_##T(Seeder, mvp::algorithm::Seeder, (vw::cartography::GeoReference const&)(vw::Vector2i) \ 14 | (mvp::algorithm::SeederSettings const&)) \ 15 | T##_C(curr_post, (vw::Vector3)) \ 16 | T##_C(curr_seed, (mvp::algorithm::AlgorithmVar)) \ 17 | T##_C(done, (bool)) \ 18 | T##_C(result, (std::vector)) \ 19 | T(update, (void)(mvp::algorithm::PixelResult)) \ 20 | END_##T() 21 | 22 | EMIT_ALGORITHM_OBJECT(Seeder) 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/SeederSettings.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/src/mvp/Algorithm/SeederSettings.h -------------------------------------------------------------------------------- /src/mvp/Algorithm/SeederSettings.proto: -------------------------------------------------------------------------------- 1 | package mvp.algorithm; 2 | 3 | message SeederSettings { 4 | optional string impl_name = 1 [default="SimpleSeeder"]; 5 | optional bool use_octave = 2 [default=true]; 6 | 7 | optional double alt = 3; 8 | 9 | optional double window_x = 4; 10 | optional double window_y = 5; 11 | optional double gwindow_x = 6; 12 | optional double gwindow_y = 7; 13 | optional double smooth = 8; 14 | optional double gsmooth = 9; 15 | optional double scale = 10; 16 | 17 | optional double out_window_x = 11; 18 | optional double out_window_y = 12; 19 | optional double out_gwindow_x = 13; 20 | optional double out_gwindow_y = 14; 21 | optional double out_smooth = 15; 22 | optional double out_gsmooth = 16; 23 | optional double out_scale = 17; 24 | } 25 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Stepper.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | EMIT_ALGORITHM_OBJECT_CPP(Stepper) 4 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Stepper.h: -------------------------------------------------------------------------------- 1 | #ifndef __MVP_ALGORITHM_STEPPER_H__ 2 | #define __MVP_ALGORITHM_STEPPER_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #define ALGORITHM_OBJECT_Stepper(T) \ 11 | BEGIN_##T(Stepper, mvp::algorithm::Stepper, (vw::cartography::GeoReference const&)(vw::Vector2i) \ 12 | (std::vector const&) (mvp::algorithm::StepperSettings const&)) \ 13 | T##_C(curr_pixel, (vw::Vector2i)) \ 14 | T##_C(curr_post, (vw::Vector3)) \ 15 | T##_C(curr_seed, (mvp::algorithm::AlgorithmVar)) \ 16 | T##_C(done, (bool)) \ 17 | T##_C(result, (mvp::algorithm::TileResult)) \ 18 | T(update, (void)(mvp::algorithm::PixelResult const&)) \ 19 | END_##T() 20 | 21 | EMIT_ALGORITHM_OBJECT(Stepper) 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/StepperSettings.proto: -------------------------------------------------------------------------------- 1 | package mvp.algorithm; 2 | 3 | message StepperSettings { 4 | optional string impl_name = 1 [default="SimpleStepper"]; 5 | optional bool use_octave = 2 [default=true]; 6 | } 7 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Support/globals.m: -------------------------------------------------------------------------------- 1 | function self = globals() 2 | self.RADIUS_IDX = 1; 3 | self.ORIENTATION_IDX = 2:5; 4 | self.WINDOW_IDX = 6:7; 5 | self.GWINDOW_IDX = 8:9; 6 | self.SMOOTH_IDX = 10; 7 | self.GSMOOTH_IDX = 11; 8 | self.SCALE_IDX = 12; 9 | self.CONFIDENCE_IDX = 13; 10 | self.CONVERGED_IDX = 14; 11 | self.NUM_ITERATIONS_IDX = 15; 12 | 13 | self.ALGORITHMVAR_LENGTH = 12; 14 | self.PIXELRESULT_LENGTH = 15; 15 | endfunction 16 | 17 | % vim:set syntax=octave: 18 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Support/pixel2post.m: -------------------------------------------------------------------------------- 1 | function post = pixel2post(georef, pixel) 2 | lonlat = georef.pixel_to_lonlat(pixel); 3 | post = georef.datum().geodetic_to_cartesian([lonlat;0]); 4 | post /= norm(post); 5 | endfunction 6 | 7 | % vim:set syntax=octave: 8 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Support/quat2rot.m: -------------------------------------------------------------------------------- 1 | function rot = quat2rot(quat) 2 | w = quat(1); 3 | x = quat(2); 4 | y = quat(3); 5 | z = quat(4); 6 | w2 = w*w; 7 | x2 = x*x; 8 | y2 = y*y; 9 | z2 = z*z; 10 | wx = w*x; 11 | wy = w*y; 12 | wz = w*z; 13 | xy = x*y; 14 | yz = y*z; 15 | zx = z*x; 16 | 17 | rot(1,1) = w2 + x2 - y2 - z2; 18 | rot(2,2) = w2 - x2 + y2 - z2; 19 | rot(3,3) = w2 - x2 - y2 + z2; 20 | rot(1,2) = 2 * (xy - wz); 21 | rot(1,3) = 2 * (zx + wy); 22 | rot(2,3) = 2 * (yz - wx); 23 | rot(2,1) = 2 * (xy + wz); 24 | rot(3,1) = 2 * (zx - wy); 25 | rot(3,2) = 2 * (yz + wx); 26 | 27 | endfunction 28 | 29 | %!test 30 | %! quat = [5 6 8 10]' / 15; 31 | %! rotref = [-0.457778 -0.017778 0.888889; 0.871111 -0.208889 0.444444; 0.177778 0.977778 0.111111]; 32 | %! assert(quat2rot(quat), rotref, 1e-6); 33 | 34 | % vim:set syntax=octave: 35 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/Support/tanplane.m: -------------------------------------------------------------------------------- 1 | function q = tanplane(e) 2 | e /= norm(e); 3 | ex = [-e(2) e(1) 0]'; 4 | ex /= norm(ex); 5 | ey = -cross(e, ex); 6 | R = [ex ey -e]; 7 | q = rot2quat(R); 8 | endfunction 9 | 10 | % vim:set syntax=octave: 11 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/TileResult.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | EMIT_ALGORITHM_OBJECT_CPP(TileResult) 4 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/TileResult.h: -------------------------------------------------------------------------------- 1 | #ifndef __MVP_ALGORITHM_TILERESULT_H__ 2 | #define __MVP_ALGORITHM_TILERESULT_H__ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | ALGORITHM_SETTINGS_GLOBAL_DEFAULTER(TileResultSettings, tile_result_settings) 13 | 14 | #define ALGORITHM_OBJECT_TileResult(T) \ 15 | BEGIN_##T(TileResult, mvp::algorithm::TileResult, (vw::cartography::GeoReference const&)(vw::Vector2i const&) \ 16 | (mvp::core::GlobalSettings::TileResultSettings const&)) \ 17 | T(set, (void)(vw::Vector2i const&)(mvp::algorithm::PixelResult const&)) \ 18 | T##_C(get, (mvp::algorithm::PixelResult)(vw::Vector2i const&)) \ 19 | T##_C(plate_layer, (vw::ImageView)(double)) \ 20 | T##_C(alt, (vw::ImageView)) \ 21 | T##_C(converged, (vw::ImageView)) \ 22 | END_##T() 23 | 24 | EMIT_ALGORITHM_OBJECT(TileResult) 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/mvp/Algorithm/TileResult/DefaultTileResult.m: -------------------------------------------------------------------------------- 1 | function self = DefaultTileResult(_georef, _size) 2 | self = mvpclass(); 3 | 4 | self._georef = _georef; 5 | self._size = _size; 6 | 7 | self._data = zeros(_size(2), _size(1), globals().PIXELRESULT_LENGTH); 8 | 9 | self.set = @(self, pixel, value) self._data(pixel(2)+1, pixel(1)+1,:) = value.vectorize(); 10 | self.get = @(self, pixel) PixelResult(self._data(pixel(2)+1,pixel(1)+1,:)); 11 | self.plate_layer = @(self, num) self._data(:,:,num); 12 | 13 | self.alt = @(self) self._data(:,:,globals().RADIUS_IDX) - self._georef.datum().semi_major_axis(); 14 | self.orientation = @(self) self._data(:,:,globals().ORIENTATION_IDX); 15 | self.window = @(self) self._data(:,:,globals().WINDOW_IDX); 16 | self.gwindow = @(self) self._data(:,:,globals().GWINDOW_IDX); 17 | self.smooth = @(self) self._data(:,:,globals().SMOOTH_IDX); 18 | self.gsmooth = @(self) self._data(:,:,globals().GSMOOTH_IDX); 19 | self.scale = @(self) self._data(:,:,globals().SCALE_IDX); 20 | self.confidence = @(self) self._data(:,:,globals().CONFIDENCE_IDX); 21 | self.converged = @(self) self._data(:,:,globals().CONVERGED_IDX); 22 | self.num_iterations = @(self) self._data(:,:,globals().NUM_ITERATIONS_IDX); 23 | endfunction 24 | 25 | % vim:set syntax=octave: 26 | -------------------------------------------------------------------------------- /src/mvp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(Core) 2 | add_subdirectory(Pipeline) 3 | add_subdirectory(Frontend) 4 | add_subdirectory(Image) 5 | add_subdirectory(Octave) 6 | add_subdirectory(Algorithm) 7 | #add_subdirectory(Wrapper) 8 | 9 | configure_file(Config.h.in Config.h) 10 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Config.h DESTINATION include/mvp) 11 | -------------------------------------------------------------------------------- /src/mvp/Config.h.in: -------------------------------------------------------------------------------- 1 | /// \file Config.h 2 | /// 3 | /// Holds configurations used when built 4 | /// 5 | 6 | #ifndef __MVP_CONFIG_H__ 7 | #define __MVP_CONFIG_H__ 8 | 9 | #define CMAKE_OPTION_ON 1 10 | #define CMAKE_OPTION_OFF 0 11 | 12 | #define MVP_ENABLE_OCTAVE_SUPPORT CMAKE_OPTION_@ENABLE_OCTAVE_SUPPORT@ 13 | 14 | #if MVP_ENABLE_OCTAVE_SUPPORT 15 | #define MVP_MFILE_INSTALL_DIR "@MFILE_INSTALL_DIR@" 16 | #define MVP_OCTFILE_INSTALL_DIR "@OCTFILE_INSTALL_DIR@" 17 | #endif 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/mvp/Core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | mvp_module(NAME Core 2 | DEPS ${VW_LIBRARIES} 3 | ${PROTOBUF_LIBRARIES} 4 | ${Boost_LIBRARIES} 5 | ${ZEROMQ_LIBRARIES} 6 | HDRS Settings.h 7 | ConvexPolygon.h 8 | SRCS Settings.cc 9 | ConvexPolygon.cc 10 | PROTOS GlobalSettings.proto) 11 | 12 | if (BUILD_TESTS) 13 | add_subdirectory(tests) 14 | endif() 15 | -------------------------------------------------------------------------------- /src/mvp/Core/ConvexPolygon.h: -------------------------------------------------------------------------------- 1 | /// \file ConvexPolygon.h 2 | /// 3 | /// Convex Polygon Class 4 | /// 5 | /// TODO: Write me! 6 | 7 | #ifndef __MVP_CORE_CONVEXPOLYGON_H__ 8 | #define __MVP_CORE_CONVEXPOLYGON_H__ 9 | 10 | #include 11 | #include 12 | 13 | namespace mvp { 14 | namespace core { 15 | 16 | struct ConvexPolygon { 17 | typedef std::vector VertexList; 18 | 19 | private: 20 | VertexList m_vertices; 21 | 22 | public: 23 | ConvexPolygon() : m_vertices() {} 24 | 25 | ConvexPolygon(VertexList pts); 26 | 27 | ConvexPolygon(vw::BBox2 const& bbox); 28 | 29 | VertexList vertices() const {return m_vertices;} 30 | 31 | vw::BBox2 bounding_box() const; 32 | 33 | /// Return the circulation direction of three points. Negative if clockwise, 34 | /// positive if anticlockwise, zero if colinear. For Y pointing up, X pointing right 35 | static double circulation_direction(vw::Vector2 const& v0, vw::Vector2 const& v1, vw::Vector2 const& v) { 36 | return (v.y() - v0.y()) * (v1.x() - v0.x()) - (v.x() - v0.x()) * (v1.y() - v0.y()); 37 | } 38 | 39 | bool contains(vw::Vector2 const& pt) const; 40 | 41 | bool intersects(ConvexPolygon const& other) const; 42 | }; 43 | 44 | }} // namespace core,mvp 45 | 46 | namespace mvp { 47 | using core::ConvexPolygon; 48 | } // namespace mvp 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/mvp/Core/Settings.h: -------------------------------------------------------------------------------- 1 | /// \file Settings.h 2 | /// 3 | /// Defines mvp_settings() 4 | /// 5 | /// TODO: Write something here 6 | /// 7 | 8 | #ifndef __MVP_CORE_SETTINGS__ 9 | #define __MVP_CORE_SETTINGS__ 10 | 11 | #include 12 | 13 | #include 14 | 15 | namespace mvp { 16 | namespace core { 17 | 18 | GlobalSettings& mvp_settings(std::string const& loadfrom = ""); 19 | 20 | void load_settings(google::protobuf::Message *message, std::string const& filename); 21 | 22 | vw::BBox2 parse_bbox_string(std::string const& bbox_string); 23 | 24 | }} // namespace core, mvp 25 | 26 | namespace mvp { 27 | using core::mvp_settings; 28 | } // namespace core 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/mvp/Core/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | mvp_test(TestSettings) 2 | mvp_test(TestConvexPolygon) 3 | -------------------------------------------------------------------------------- /src/mvp/Core/tests/TestSettings.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | using namespace std; 7 | using namespace mvp; 8 | using namespace vw::test; 9 | 10 | TEST(Settings, mvp_settings) { 11 | mvp_settings(SrcName("mvprc")); 12 | 13 | EXPECT_EQ(mvp_settings().ports().command(), "23"); 14 | EXPECT_EQ(mvp_settings().ports().status(), "6678"); 15 | } 16 | -------------------------------------------------------------------------------- /src/mvp/Core/tests/mvprc: -------------------------------------------------------------------------------- 1 | ports { 2 | command: "23" 3 | } 4 | -------------------------------------------------------------------------------- /src/mvp/Frontend/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | mvp_module(NAME Frontend 2 | DEPS mvpCore 3 | mvpPipeline 4 | mvpImage 5 | HDRS StatusTable.h 6 | ZmqHelpers.h 7 | ZmqWorkerHelper.h 8 | ZmqServerHelper.h 9 | SRCS StatusTable.cc 10 | ZmqHelpers.cc 11 | ZmqWorkerHelper.cc 12 | ZmqServerHelper.cc 13 | PROTOS Messages.proto) 14 | 15 | #TODO: This can be removed when it is removed from mvpworker.cc 16 | add_definitions(-DLOADTESTENV_M=\"${CMAKE_BINARY_DIR}/src/test/loadtestenv.m\") 17 | ###### end 18 | 19 | mvp_executable(mvpd mvpd.cc) 20 | mvp_executable(mvpworker mvpworker.cc) 21 | mvp_executable(mvpdumpjob mvpdumpjob.cc) 22 | 23 | add_octfile(loadjobfile loadjobfile.cc) 24 | target_link_libraries(loadjobfile mvpOctave mvpAlgorithm mvpPipeline) 25 | 26 | install(TARGETS mvpd mvpworker DESTINATION bin) 27 | 28 | if (BUILD_TESTS) 29 | add_subdirectory(tests) 30 | endif() 31 | -------------------------------------------------------------------------------- /src/mvp/Frontend/Messages.proto: -------------------------------------------------------------------------------- 1 | package mvp.frontend; 2 | 3 | import "mvp/Pipeline/SessionDesc.proto"; 4 | import "mvp/Pipeline/JobDesc.proto"; 5 | 6 | message CommandMsg { 7 | enum CommandType { 8 | LAUNCH = 0; 9 | JOB = 1; 10 | STATUS = 2; 11 | INFO = 3; 12 | KILL = 4; 13 | } 14 | 15 | required CommandType cmd = 1; 16 | optional pipeline.SessionDesc session = 2; 17 | } 18 | 19 | message CommandReplyMsg { 20 | required CommandMsg.CommandType cmd = 1; 21 | optional pipeline.JobDesc job = 2; 22 | optional StatusReport status_report = 3; 23 | } 24 | 25 | message StatusReport { 26 | message Entry { 27 | required pipeline.JobDesc job = 1; 28 | required double status = 2; 29 | required int64 last_seen = 3; 30 | } 31 | required int32 jobs_completed = 1; 32 | required int32 total_jobs = 2; 33 | repeated Entry actives = 3; 34 | repeated pipeline.JobDesc orphans = 4; 35 | } 36 | 37 | message StatusUpdateMsg { 38 | required int32 job_id = 1; 39 | required double status = 2; 40 | } 41 | 42 | message WorkerCommandMsg { 43 | enum CommandType { 44 | WAKE = 0; 45 | KILL = 1; 46 | } 47 | required CommandType cmd = 1; 48 | } 49 | -------------------------------------------------------------------------------- /src/mvp/Frontend/StatusTable.h: -------------------------------------------------------------------------------- 1 | /// \file StatusTable.h 2 | /// 3 | /// StatusTable class 4 | /// 5 | 6 | #ifndef __MVP_FRONTEND_STATUSTABLE_H__ 7 | #define __MVP_FRONTEND_STATUSTABLE_H__ 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | 15 | namespace mvp { 16 | namespace frontend { 17 | 18 | class StatusTable { 19 | typedef std::map EntryMap; 20 | EntryMap m_entries; 21 | 22 | public: 23 | StatusTable() : m_entries() {} 24 | 25 | void reset() { m_entries.clear(); } 26 | 27 | void add_entry(pipeline::JobDesc const& job_desc); 28 | 29 | void update_status(StatusUpdateMsg const& status_update); 30 | 31 | std::vector entries() const; 32 | 33 | std::vector prune_completed_entries(); 34 | 35 | std::vector prune_orphaned_entries(); 36 | }; 37 | 38 | }} // namespace frontend, mvp 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/mvp/Frontend/ZmqHelpers.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace mvp { 4 | namespace frontend { 5 | 6 | std::string sock_recv(zmq::socket_t& sock) { 7 | zmq::message_t message; 8 | sock.recv(&message); 9 | return std::string(static_cast(message.data()), message.size()); 10 | } 11 | 12 | void sock_send(zmq::socket_t& sock, std::string const& str_message) { 13 | zmq::message_t reply(str_message.size()); 14 | memcpy(reply.data(), str_message.c_str(), str_message.size()); 15 | sock.send(reply); 16 | } 17 | 18 | void sock_send(zmq::socket_t& sock, google::protobuf::Message const& message) { 19 | std::string str_message; 20 | message.SerializeToString(&str_message); 21 | sock_send(sock, str_message); 22 | } 23 | 24 | bool sock_poll(zmq::socket_t& sock, int timeout) { 25 | zmq::pollitem_t poller[] = {{sock, 0, ZMQ_POLLIN, 0}}; 26 | zmq::poll(poller, 1, timeout); 27 | 28 | if (poller[0].revents & ZMQ_POLLIN) { 29 | return true; 30 | } else { 31 | return false; 32 | } 33 | } 34 | 35 | }} // namespace frontend, mvp 36 | -------------------------------------------------------------------------------- /src/mvp/Frontend/ZmqHelpers.h: -------------------------------------------------------------------------------- 1 | /// \file ZmqHelpers.h 2 | /// 3 | /// Zmq Helper Classes 4 | /// 5 | /// TODO: Write something here 6 | /// 7 | 8 | #ifndef __MVP_FRONTEND_ZMQHELPERS_H__ 9 | #define __MVP_FRONTEND_ZMQHELPERS_H__ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace mvp { 16 | namespace frontend { 17 | 18 | std::string sock_recv(zmq::socket_t& sock); 19 | 20 | void sock_send(zmq::socket_t& sock, std::string const& str_message); 21 | 22 | void sock_send(zmq::socket_t& sock, google::protobuf::Message const& message); 23 | 24 | bool sock_poll(zmq::socket_t& sock, int timeout = -1); 25 | 26 | }} // namespace frontend, mvp 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/mvp/Frontend/ZmqServerHelper.h: -------------------------------------------------------------------------------- 1 | /// \file ZmqServerHelper.h 2 | /// 3 | /// Zmq Helper Classes 4 | /// 5 | /// TODO: Write something here 6 | /// 7 | 8 | #ifndef __MVP_FRONTEND_ZMQSERVERHELPER_H__ 9 | #define __MVP_FRONTEND_ZMQSERVERHELPER_H__ 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | namespace mvp { 17 | namespace frontend { 18 | 19 | class ZmqServerHelper { 20 | mutable zmq::socket_t m_cmd_sock; 21 | mutable zmq::socket_t m_bcast_sock; 22 | mutable zmq::socket_t m_status_sock; 23 | 24 | public: 25 | enum PollEvent { 26 | STATUS_EVENT, 27 | COMMAND_EVENT, 28 | }; 29 | typedef std::set PollEventSet; 30 | 31 | ZmqServerHelper(zmq::context_t& context); 32 | 33 | PollEventSet poll() const; 34 | 35 | StatusUpdateMsg recv_status() const; 36 | 37 | CommandMsg recv_cmd() const; 38 | 39 | void send_cmd_reply(CommandReplyMsg const& cmd_reply) const; 40 | 41 | void send_bcast(WorkerCommandMsg::CommandType cmd_enum) const; 42 | }; 43 | 44 | }} // namespace frontend, mvp 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /src/mvp/Frontend/ZmqWorkerHelper.h: -------------------------------------------------------------------------------- 1 | /// \file ZmqWorkerHelper.h 2 | /// 3 | /// Zmq Worker Helper Class 4 | /// 5 | /// TODO: Write something here 6 | /// 7 | 8 | #ifndef __MVP_FRONTEND_ZMQWORKERHELPER_H__ 9 | #define __MVP_FRONTEND_ZMQWORKERHELPER_H__ 10 | 11 | #include 12 | 13 | #include 14 | 15 | #include 16 | 17 | namespace mvp { 18 | namespace frontend { 19 | 20 | class ZmqWorkerHelper { 21 | 22 | mutable zmq::socket_t m_cmd_sock; 23 | mutable zmq::socket_t m_bcast_sock; 24 | mutable zmq::socket_t m_status_sock; 25 | 26 | mutable bool m_startup; 27 | 28 | public: 29 | class ProgressCallback : public vw::ProgressCallback { 30 | ZmqWorkerHelper const& m_helper; 31 | int m_job_id; 32 | public: 33 | ProgressCallback(ZmqWorkerHelper const& helper, int job_id) : m_helper(helper), m_job_id(job_id) {} 34 | virtual void report_progress(double progress) const; 35 | virtual void report_finished() const; 36 | }; 37 | 38 | ZmqWorkerHelper(zmq::context_t& context, std::string const& hostname); 39 | 40 | WorkerCommandMsg recv_bcast() const; 41 | 42 | CommandReplyMsg get_next_job() const; 43 | 44 | void send_status(int job_id, double status) const; 45 | 46 | bool bcast_waiting() const; 47 | }; 48 | 49 | }} // namespace frontend, mvp 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/mvp/Frontend/loadjobfile.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | DEFUN_DLD(loadjobfile, args, nargout, "Load mvp functions/objects") { 9 | static bool mvp_registered = false; 10 | 11 | if (!mvp_registered) { 12 | mvp::octave::register_octave_mvp(); 13 | mvp_registered = true; 14 | } 15 | 16 | if (args.length() != 1) { 17 | error("Usaged job = loadjobfile([path])"); 18 | return octave_value(); 19 | } 20 | 21 | mvp::pipeline::Job job(args(0).string_value()); 22 | 23 | octave_map result; 24 | 25 | result.setfield("orbital_images", mvp::octave::to_octave(job.orbital_images())); 26 | result.setfield("algorithm_settings", mvp::octave::to_octave(job.algorithm_settings())); 27 | result.setfield("georef", mvp::octave::to_octave(job.georef())); 28 | result.setfield("tile_size", mvp::octave::to_octave(job.tile_size())); 29 | 30 | return octave_value(result); 31 | } 32 | -------------------------------------------------------------------------------- /src/mvp/Frontend/mvpdumpjob.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #if MVP_ENABLE_OCTAVE_SUPPORT 6 | #include 7 | #endif 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | using namespace std; 17 | using namespace mvp; 18 | 19 | int main(int argc, char *argv[]) { 20 | 21 | if (argc != 5) { 22 | cout << "Usage: mvpdumpjob jobfile col row level" << endl; 23 | return 1; 24 | } 25 | 26 | pipeline::SessionDesc session_desc; 27 | 28 | core::load_settings(&session_desc, argv[1]); 29 | 30 | pipeline::Session session(session_desc); 31 | 32 | int col = boost::lexical_cast(argv[2]); 33 | int row = boost::lexical_cast(argv[3]); 34 | int level = boost::lexical_cast(argv[4]); 35 | 36 | pipeline::Job job(session.job(col, row, level)); 37 | 38 | job.save_job_file(); 39 | 40 | #if MVP_ENABLE_OCTAVE_SUPPORT 41 | octave::start_octave_interpreter(LOADTESTENV_M); 42 | // TODO: instead 43 | //octave::start_octave_interpreter(); 44 | 45 | job.save_job_file_octave(); 46 | 47 | octave::stop_octave_interpreter(); 48 | #endif 49 | 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /src/mvp/Frontend/tests/CMakeLists.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/src/mvp/Frontend/tests/CMakeLists.txt -------------------------------------------------------------------------------- /src/mvp/Image/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | mvp_module(NAME Image 2 | DEPS mvpCore 3 | HDRS OrbitalImage.h 4 | OrbitalImageCollection.h 5 | OrbitalImageCatalog.h 6 | SRCS OrbitalImage.cc 7 | OrbitalImageCollection.cc 8 | OrbitalImageCatalog.cc 9 | PROTOS OrbitalImageDesc.proto) 10 | 11 | if (BUILD_TESTS) 12 | add_subdirectory(tests) 13 | endif() 14 | -------------------------------------------------------------------------------- /src/mvp/Image/OrbitalImageCollection.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace mvp { 6 | namespace image { 7 | 8 | std::vector > OrbitalImageCollection::back_project(vw::Vector3 const& xyz, 9 | vw::Quat const& orientation, 10 | vw::Vector2 const& scale, 11 | vw::Vector2i const& size) const 12 | { 13 | std::vector > result; 14 | 15 | BOOST_FOREACH(OrbitalImage const& o, *this) { 16 | vw::ImageView patch = o.back_project(xyz, orientation, scale, size); 17 | if (!vw::is_transparent(patch)) { 18 | result.push_back(patch); 19 | } 20 | } 21 | 22 | return result; 23 | } 24 | 25 | }} // namespace image,mvp 26 | -------------------------------------------------------------------------------- /src/mvp/Image/OrbitalImageCollection.h: -------------------------------------------------------------------------------- 1 | /// \file ImageCropCollection.h 2 | /// 3 | /// Image Crop Collection class 4 | /// 5 | /// TODO: Write something here 6 | /// 7 | 8 | #ifndef __MVP_IMAGE_ORBITALIMAGECOLLECTION_H__ 9 | #define __MVP_IMAGE_ORBITALIMAGECOLLECTION_H__ 10 | 11 | #include 12 | 13 | #include 14 | 15 | #include 16 | 17 | namespace mvp { 18 | namespace image { 19 | 20 | class OrbitalImageCollection : public std::vector { 21 | 22 | public: 23 | OrbitalImageCollection() {} 24 | 25 | template 26 | OrbitalImageCollection(ContainerT const& orbital_image_descs) { 27 | push_back_container(orbital_image_descs); 28 | } 29 | 30 | template 31 | void push_back_container(ContainerT const& orbital_image_descs) { 32 | BOOST_FOREACH(OrbitalImageDesc const& desc, orbital_image_descs) { 33 | push_back(OrbitalImage(desc)); 34 | } 35 | } 36 | 37 | std::vector > back_project(vw::Vector3 const& xyz, 38 | vw::Quat const& orientation, 39 | vw::Vector2 const& scale, 40 | vw::Vector2i const& size) const; 41 | 42 | }; 43 | 44 | }} // namespace image,mvp 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/mvp/Image/OrbitalImageDesc.proto: -------------------------------------------------------------------------------- 1 | package mvp.image; 2 | 3 | message OrbitalImageDesc { 4 | required string camera_path = 1; 5 | required string image_path = 2; 6 | required int32 minx = 3; 7 | required int32 miny = 4; 8 | required int32 width = 5; 9 | required int32 height = 6; 10 | } 11 | -------------------------------------------------------------------------------- /src/mvp/Image/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | mvp_test(TestOrbitalImage) 2 | mvp_test(TestOrbitalImageCollection) 3 | mvp_test(TestOrbitalImageCatalog) 4 | -------------------------------------------------------------------------------- /src/mvp/Image/tests/TestOrbitalImageCatalog.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | using namespace std; 7 | using namespace vw; 8 | using namespace vw::test; 9 | using namespace vw::camera; 10 | using namespace vw::cartography; 11 | using namespace mvp::image; 12 | 13 | TEST(OrbitalImageCatalog, add_image_pattern) { 14 | 15 | OrbitalImageCatalog catalog(Datum("D_MOON"), Vector2i()); 16 | 17 | catalog.add_image_pattern(DataName("synth\\.\\d*\\.tif"), DataName("synth\\.\\d*\\.pinhole")); 18 | 19 | EXPECT_EQ(catalog.size(), 4); 20 | } 21 | 22 | TEST(OrbitalImageCatalog, images_in_region) { 23 | 24 | // TODO: Write me 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/mvp/Image/tests/TestOrbitalImageCollection.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | using namespace std; 7 | using namespace vw; 8 | using namespace vw::test; 9 | using namespace vw::camera; 10 | using namespace mvp::image; 11 | 12 | TEST(OrbitalImageCollection, back_project) { 13 | OrbitalImageCollection orbital_images; 14 | 15 | // TODO: Write me 16 | 17 | // Make sure fully transparent patches are thrown out 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/mvp/Octave/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | mvp_module(NAME Octave 2 | DEPS mvpCore 3 | mvpAlgorithm 4 | mvpImage 5 | ${OCTAVE_LIBRARIES} 6 | HDRS Main.h 7 | oct-mvpclass.h 8 | ov-mvpclass-ref.h 9 | MvpWrapper.h 10 | OctaveWrapper.h 11 | SRCS Main.cc 12 | MvpWrapper.cc 13 | OctaveWrapper.cc 14 | ov-mvpclass-ref.cc 15 | wraps/Dummy.cc 16 | wraps/Datum.cc 17 | wraps/GeoReference.cc 18 | wraps/OrbitalImageCollection.cc 19 | wraps/AlgorithmVar.cc 20 | wraps/PixelResult.cc 21 | wraps/Seed.cc 22 | wraps/TileResult.cc 23 | wraps/PatchBox.cc 24 | wraps/AlbedoBox.cc 25 | wraps/Lighter.cc 26 | wraps/Objective.cc 27 | wraps/Stepper.cc 28 | wraps/Seeder.cc 29 | wraps/Correlator.cc 30 | wraps/ObjectiveHelper.cc 31 | ) 32 | 33 | add_octfile(init_mvp init_mvp.cc) 34 | target_link_libraries(init_mvp mvpOctave mvpAlgorithm) 35 | 36 | add_octfile(imread_vw imread_vw.cc) 37 | target_link_libraries(imread_vw mvpOctave) 38 | 39 | if (BUILD_TESTS) 40 | add_subdirectory(tests) 41 | endif() 42 | -------------------------------------------------------------------------------- /src/mvp/Octave/Main.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | namespace mvp { 12 | namespace octave { 13 | 14 | void start_octave_interpreter(std::string const& startup_script) { 15 | const char * argvv [] = {"", "--silent"}; 16 | ::octave_main (2, (char **) argvv, true); 17 | if (!startup_script.empty()) { 18 | ::source_file(startup_script); 19 | } 20 | 21 | register_octave_mvp(); 22 | } 23 | 24 | namespace { 25 | octave_value_list do_mvp_settings(octave_value_list const& args, int nargout) { 26 | if (args.length() > 0) { 27 | mvp_settings() = from_octave(args(0)); 28 | } 29 | return to_octave(mvp_settings()); 30 | } 31 | } 32 | 33 | void register_octave_mvp() { 34 | octave_mvpclass_ref::register_type(); 35 | MvpWrapperInstaller::install_wrappers(); 36 | install_builtin_function(do_mvp_settings, "mvp_settings", ""); 37 | } 38 | 39 | void stop_octave_interpreter() { 40 | do_octave_atexit(); 41 | } 42 | 43 | }} // namespace mvp, octave 44 | -------------------------------------------------------------------------------- /src/mvp/Octave/Main.h: -------------------------------------------------------------------------------- 1 | /// \file Main.h 2 | /// 3 | /// TODO: Write doc 4 | /// 5 | 6 | #ifndef __MVP_OCTAVE_MAIN_H__ 7 | #define __MVP_OCTAVE_MAIN_H__ 8 | 9 | #include 10 | 11 | namespace mvp { 12 | namespace octave { 13 | 14 | void start_octave_interpreter(std::string const& startup_script = ""); 15 | 16 | void register_octave_mvp(); 17 | 18 | void stop_octave_interpreter(); 19 | 20 | }} // namespace octave, mvp 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/mvp/Octave/MvpWrapper.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | std::vector& MvpWrapperInstaller::installer_descs() { 5 | static std::vector descs; 6 | return descs; 7 | } 8 | 9 | void MvpWrapperInstaller::install_wrappers() { 10 | BOOST_FOREACH(OctaveFcnDesc const& item, installer_descs()) { 11 | install_builtin_function(item.f, item.name, item.desc); 12 | } 13 | } 14 | 15 | void MvpWrapperInstaller::add_fcn_desc(octave_builtin::fcn f, std::string name, std::string desc) { 16 | installer_descs().push_back(OctaveFcnDesc(f, name, desc)); 17 | } 18 | 19 | template <> 20 | class MvpWrapperInstallerRegistrar { 21 | static MvpWrapperInstallerRegistrar reg; 22 | static octave_value_list construct_fcn(octave_value_list const& args, int nargout) { 23 | return octave_value(new octave_mvpclass_ref(boost::shared_ptr(new octave_mvpclass_impl()))); 24 | } 25 | public: 26 | MvpWrapperInstallerRegistrar(std::string name, std::string desc) { 27 | MvpWrapperInstaller::add_fcn_desc(construct_fcn, name, desc); 28 | } 29 | }; 30 | 31 | MvpWrapperInstallerRegistrar MvpWrapperInstallerRegistrar::reg("mvpclass", std::string()); 32 | -------------------------------------------------------------------------------- /src/mvp/Octave/OctaveWrapper.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace mvp { 11 | namespace octave { 12 | 13 | octave_value OctaveWrapperImpl::create_impl(std::string const& impl_name, octave_value_list const& args) { 14 | octave_value cnstr = symbol_table::find_function(impl_name); 15 | 16 | VW_ASSERT(cnstr.is_defined(), vw::NotFoundErr() << "Unable to find octave class " << impl_name); 17 | 18 | octave_value_list res = feval(cnstr.function_value(), args); 19 | 20 | VW_ASSERT(res.length() == 1, vw::LogicErr() << "Unable to construct octave class " << impl_name); 21 | 22 | return res(0); 23 | } 24 | 25 | octave_value OctaveWrapperImpl::wrap_function_impl(std::string const& func, octave_value_list const& args) { 26 | std::list idx; 27 | idx.push_back(octave_value(func)); 28 | idx.push_back(args); 29 | 30 | return m_impl.subsref(".(", idx); 31 | } 32 | 33 | }} // namespace octave, mvp 34 | -------------------------------------------------------------------------------- /src/mvp/Octave/imread_vw.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include 6 | 7 | DEFUN_DLD(imread_vw, args, nargout, "Load mvp functions/objects") { 8 | using namespace vw; 9 | using namespace mvp; 10 | ImageView > image; 11 | 12 | if (args.length() != 1) { 13 | error("Usage: imread_vw(filename)"); 14 | return octave_value(); 15 | } 16 | 17 | read_image(image, args(0).string_value()); 18 | 19 | return octave::to_octave(image); 20 | } 21 | -------------------------------------------------------------------------------- /src/mvp/Octave/init_mvp.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | DEFUN_DLD(init_mvp, args, nargout, "Load mvp functions/objects") { 6 | 7 | mvp::octave::register_octave_mvp(); 8 | 9 | return octave_value(); 10 | } 11 | -------------------------------------------------------------------------------- /src/mvp/Octave/mosaic.m: -------------------------------------------------------------------------------- 1 | function result = mosaic() 2 | files = ls("*.tif"); 3 | 4 | minRow = Inf; 5 | maxRow = -Inf; 6 | minCol = Inf; 7 | maxCol = -Inf; 8 | level = 0; 9 | 10 | for i = 1:size(files)(1) 11 | [col, row, level] = sscanf(files(i, :), "%d_%d_%d", "C"); 12 | minCol = min(col, minCol); 13 | maxCol = max(col, maxCol); 14 | minRow = min(row, minRow); 15 | maxRow = max(row, maxRow); 16 | endfor 17 | 18 | colOffset = minCol; 19 | numCols = maxCol - minCol + 1; 20 | rowOffset = minRow; 21 | numRows = maxRow - minRow + 1; 22 | 23 | printf("%d x %d tiles\n", numCols, numRows); 24 | 25 | tile_size = 64; 26 | 27 | result = NA(tile_size*numRows, tile_size*numCols); 28 | 29 | for c = 0:numCols - 1 30 | for r = 0:numRows - 1 31 | file = sprintf("%d_%d_%d.tif", c + colOffset, r + rowOffset, level); 32 | if (exist(file, "file")) 33 | tile_raw = imread_vw(file); 34 | tile = tile_raw(:, :, 1); 35 | tile(!tile_raw(:,:,2)) = NA; 36 | 37 | rBegin = tile_size * r; 38 | cBegin = tile_size * c; 39 | result((1:tile_size) + rBegin, (1:tile_size) + cBegin) = tile; 40 | endif 41 | endfor 42 | endfor 43 | 44 | endfunction 45 | 46 | % vim:set syntax=octave: 47 | -------------------------------------------------------------------------------- /src/mvp/Octave/oct-typetraits.h: -------------------------------------------------------------------------------- 1 | /// \file oct-typetraits.h 2 | /// 3 | /// Helpers with octave types 4 | /// 5 | 6 | #ifndef __MVP_OCTAVE_OCTTYPETRAITS_H__ 7 | #define __MVP_OCTAVE_OCTTYPETRAITS_H__ 8 | 9 | #include 10 | 11 | template 12 | struct octave_array_type { 13 | typedef intNDArray > type; 14 | typedef octave_int value_type; 15 | }; 16 | 17 | #define OCTAVE_ARRAY_TYPE(T, TYPE) \ 18 | template <> \ 19 | struct octave_array_type { \ 20 | typedef TYPE type; \ 21 | typedef T value_type; \ 22 | }; 23 | 24 | OCTAVE_ARRAY_TYPE(bool, boolNDArray) 25 | OCTAVE_ARRAY_TYPE(float, FloatNDArray) 26 | OCTAVE_ARRAY_TYPE(double, NDArray) 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/mvp/Octave/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS DummyProto.proto) 2 | 3 | mvp_test(TestConversions) 4 | 5 | add_library(mvpoctave_test ${PROTO_SRCS}) 6 | 7 | target_link_libraries(TestConversions mvpoctave_test) 8 | -------------------------------------------------------------------------------- /src/mvp/Octave/tests/DummyProto.proto: -------------------------------------------------------------------------------- 1 | message DummyProto { 2 | message InnerMessage { 3 | required int32 field = 1; 4 | } 5 | 6 | required double double_field = 1; 7 | required float float_field = 2; 8 | required int32 int32_field = 3; 9 | required bool bool_field = 4; 10 | required string string_field = 5; 11 | optional int32 empty_field = 6; 12 | required InnerMessage message_field = 7; 13 | } 14 | -------------------------------------------------------------------------------- /src/mvp/Octave/wraps/AlbedoBox.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | EMIT_ALGORITHM_MVP_WRAPPER(AlbedoBox) 7 | EMIT_ALGORITHM_OCTAVE_WRAPPER(AlbedoBox) 8 | -------------------------------------------------------------------------------- /src/mvp/Octave/wraps/AlgorithmVar.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | EMIT_ALGORITHM_MVP_WRAPPER(AlgorithmVar) 7 | EMIT_ALGORITHM_OCTAVE_WRAPPER(AlgorithmVar) 8 | -------------------------------------------------------------------------------- /src/mvp/Octave/wraps/Correlator.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | EMIT_ALGORITHM_MVP_WRAPPER(Correlator) 7 | EMIT_ALGORITHM_OCTAVE_WRAPPER(Correlator) 8 | -------------------------------------------------------------------------------- /src/mvp/Octave/wraps/Datum.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | BEGIN_MVP_WRAPPER(Datum, vw::cartography::Datum, MVP_WRAPPER_NO_ARGS) 5 | MVP_WRAPPER_CONSTRUCTOR((std::string)) 6 | MVP_WRAPPER_C(semi_major_axis, (double)) 7 | MVP_WRAPPER_C(semi_minor_axis, (double)) 8 | MVP_WRAPPER_C(geodetic_to_cartesian, (vw::Vector3)(vw::Vector3 const&)) 9 | END_MVP_WRAPPER() 10 | -------------------------------------------------------------------------------- /src/mvp/Octave/wraps/Dummy.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | EMIT_ALGORITHM_OCTAVE_WRAPPER(Dummy) 7 | EMIT_ALGORITHM_MVP_WRAPPER(Dummy) 8 | -------------------------------------------------------------------------------- /src/mvp/Octave/wraps/GeoReference.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | BEGIN_MVP_WRAPPER(GeoReference, vw::cartography::GeoReference, MVP_WRAPPER_NO_ARGS) 5 | MVP_WRAPPER_CONSTRUCTOR((vw::cartography::Datum const&)) 6 | MVP_WRAPPER_CONSTRUCTOR((vw::cartography::Datum const&)(vw::Matrix3x3 const&)) 7 | MVP_WRAPPER_CONSTRUCTOR((vw::cartography::Datum const&)(vw::Matrix3x3 const&) 8 | (vw::cartography::GeoReference::PixelInterpretation)) 9 | MVP_WRAPPER_C(lonlat_to_pixel, (vw::Vector2)(vw::Vector2)) 10 | MVP_WRAPPER_C(pixel_to_lonlat, (vw::Vector2)(vw::Vector2)) 11 | MVP_WRAPPER_C(datum, (vw::cartography::Datum const&)) 12 | END_MVP_WRAPPER() 13 | -------------------------------------------------------------------------------- /src/mvp/Octave/wraps/Lighter.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | EMIT_ALGORITHM_MVP_WRAPPER(Lighter) 7 | EMIT_ALGORITHM_OCTAVE_WRAPPER(Lighter) 8 | -------------------------------------------------------------------------------- /src/mvp/Octave/wraps/Objective.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | EMIT_ALGORITHM_MVP_WRAPPER(Objective) 7 | EMIT_ALGORITHM_OCTAVE_WRAPPER(Objective) 8 | -------------------------------------------------------------------------------- /src/mvp/Octave/wraps/ObjectiveHelper.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | EMIT_ALGORITHM_MVP_WRAPPER(ObjectiveHelper) 7 | EMIT_ALGORITHM_OCTAVE_WRAPPER(ObjectiveHelper) 8 | -------------------------------------------------------------------------------- /src/mvp/Octave/wraps/OrbitalImageCollection.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | BEGIN_MVP_WRAPPER(OrbitalImageCollection, mvp::image::OrbitalImageCollection, MVP_WRAPPER_NO_ARGS) 5 | MVP_WRAPPER(back_project, (std::vector >) 6 | (vw::Vector3 const&)(vw::Quat const&)(vw::Vector2 const&)(vw::Vector2i const&)) 7 | END_MVP_WRAPPER() 8 | -------------------------------------------------------------------------------- /src/mvp/Octave/wraps/PatchBox.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | EMIT_ALGORITHM_MVP_WRAPPER(PatchBox) 7 | EMIT_ALGORITHM_OCTAVE_WRAPPER(PatchBox) 8 | -------------------------------------------------------------------------------- /src/mvp/Octave/wraps/PixelResult.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | EMIT_ALGORITHM_OCTAVE_WRAPPER(PixelResult) 7 | EMIT_ALGORITHM_MVP_WRAPPER(PixelResult) 8 | -------------------------------------------------------------------------------- /src/mvp/Octave/wraps/Seed.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | EMIT_ALGORITHM_MVP_WRAPPER(Seed) 7 | EMIT_ALGORITHM_OCTAVE_WRAPPER(Seed) 8 | -------------------------------------------------------------------------------- /src/mvp/Octave/wraps/Seeder.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | EMIT_ALGORITHM_MVP_WRAPPER(Seeder) 7 | EMIT_ALGORITHM_OCTAVE_WRAPPER(Seeder) 8 | -------------------------------------------------------------------------------- /src/mvp/Octave/wraps/Stepper.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | EMIT_ALGORITHM_MVP_WRAPPER(Stepper) 7 | EMIT_ALGORITHM_OCTAVE_WRAPPER(Stepper) 8 | -------------------------------------------------------------------------------- /src/mvp/Octave/wraps/TileResult.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | EMIT_ALGORITHM_MVP_WRAPPER(TileResult) 7 | EMIT_ALGORITHM_OCTAVE_WRAPPER(TileResult) 8 | -------------------------------------------------------------------------------- /src/mvp/Pipeline/AlgorithmSettings.proto: -------------------------------------------------------------------------------- 1 | package mvp.pipeline; 2 | 3 | import "mvp/Algorithm/CorrelatorSettings.proto"; 4 | import "mvp/Algorithm/LighterSettings.proto"; 5 | import "mvp/Algorithm/ObjectiveSettings.proto"; 6 | import "mvp/Algorithm/SeederSettings.proto"; 7 | import "mvp/Algorithm/StepperSettings.proto"; 8 | 9 | message AlgorithmSettings { 10 | required double alt_min = 1; 11 | required double alt_max = 2; 12 | required double orbital_image_padding_x = 3; 13 | required double orbital_image_padding_y = 4; 14 | 15 | optional algorithm.CorrelatorSettings correlator0_settings = 5; 16 | optional algorithm.SeederSettings seeder_settings = 6; 17 | optional algorithm.StepperSettings stepper_settings = 7; 18 | optional algorithm.CorrelatorSettings correlator_settings = 8; 19 | optional algorithm.LighterSettings lighter_settings = 9; 20 | optional algorithm.ObjectiveSettings objective_settings = 10; 21 | } 22 | -------------------------------------------------------------------------------- /src/mvp/Pipeline/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | mvp_module(NAME Pipeline 2 | DEPS mvpCore 3 | mvpImage 4 | HDRS Session.h 5 | Job.h 6 | SRCS Session.cc 7 | Job.cc 8 | PROTOS AlgorithmSettings.proto 9 | JobDesc.proto 10 | SessionDesc.proto) 11 | 12 | if (BUILD_TESTS) 13 | add_subdirectory(tests) 14 | endif() 15 | -------------------------------------------------------------------------------- /src/mvp/Pipeline/JobDesc.proto: -------------------------------------------------------------------------------- 1 | package mvp.pipeline; 2 | 3 | import "vw/Plate/PlateGeoReferenceDesc.proto"; 4 | import "mvp/Pipeline/AlgorithmSettings.proto"; 5 | import "mvp/Image/OrbitalImageDesc.proto"; 6 | 7 | message JobDesc { 8 | message Input { 9 | repeated image.OrbitalImageDesc orbital_images = 1; 10 | // TODO: In the future, ground control points can go here 11 | } 12 | 13 | message Render { 14 | required int32 col = 1; 15 | required int32 row = 2; 16 | required int32 level = 3; 17 | } 18 | 19 | message Output { 20 | required string platefile = 1; 21 | required vw.platefile.PlateGeoReferenceDesc plate_georef = 2; 22 | } 23 | 24 | required int32 id = 1; 25 | required Input input = 2; 26 | required Render render = 3; 27 | required Output output = 4; 28 | required AlgorithmSettings algorithm_settings = 5; 29 | } 30 | -------------------------------------------------------------------------------- /src/mvp/Pipeline/Session.h: -------------------------------------------------------------------------------- 1 | /// \file Session.h 2 | /// 3 | /// Session class 4 | /// 5 | 6 | #ifndef __MVP_PIPELINE_SESSION_H__ 7 | #define __MVP_PIPELINE_SESSION_H__ 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | 15 | // Rather than including an ENTIRE PlateGeoReference, we 16 | // just hold onto its desc. 17 | #include 18 | 19 | namespace mvp { 20 | namespace image { 21 | 22 | class OrbitalImageCatalog; 23 | 24 | }} // namespace image,mvp 25 | 26 | namespace mvp { 27 | namespace pipeline { 28 | 29 | class Session { 30 | SessionDesc m_session_desc; 31 | vw::platefile::PlateGeoReferenceDesc m_plate_georef_desc; 32 | boost::shared_ptr m_catalog; 33 | vw::Vector2i m_cursor; 34 | vw::BBox2i m_render_bbox; 35 | 36 | public: 37 | Session() {} 38 | 39 | Session(SessionDesc const& session_desc) { reset(session_desc); } 40 | 41 | void reset(SessionDesc const& session_desc); 42 | 43 | JobDesc job(int col, int row, int level); 44 | 45 | JobDesc next_job(); 46 | 47 | bool has_next_job() { return m_render_bbox.contains(m_cursor); } 48 | 49 | int size() { return m_render_bbox.width() * m_render_bbox.height(); } 50 | }; 51 | 52 | }} // namespace pipeline, mvp 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/mvp/Pipeline/SessionDesc.proto: -------------------------------------------------------------------------------- 1 | package mvp.pipeline; 2 | 3 | import "mvp/Pipeline/AlgorithmSettings.proto"; 4 | 5 | message SessionDesc { 6 | message Input { 7 | required string image_pattern = 1; 8 | required string camera_pattern = 2; 9 | } 10 | 11 | message Render { 12 | required string bbox = 1; 13 | optional int32 level = 2; 14 | } 15 | 16 | message Output { 17 | required string platefile = 1; 18 | required string datum = 2; 19 | optional string map_projection = 3 [default="equi"]; 20 | optional int32 tile_size = 4 [default = 64]; 21 | } 22 | 23 | required Input input = 1; 24 | required Render render = 2; 25 | required Output output = 3; 26 | required AlgorithmSettings algorithm_settings = 4; 27 | } 28 | -------------------------------------------------------------------------------- /src/mvp/Pipeline/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | mvp_test(TestSession) 2 | -------------------------------------------------------------------------------- /src/mvp/Pipeline/tests/TestSession.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | using namespace mvp; 9 | using namespace vw::test; 10 | using namespace mvp::core; 11 | using namespace mvp::pipeline; 12 | 13 | TEST(Session, session_desc) { 14 | SessionDesc session_desc; 15 | load_settings(&session_desc, SrcName("test.mvp")); 16 | 17 | session_desc.mutable_input()->set_image_pattern(DataName("synth\\.\\d*\\.tif")); 18 | session_desc.mutable_input()->set_camera_pattern(DataName("synth\\.\\d*\\.pinhole")); 19 | 20 | Session session(session_desc); 21 | 22 | EXPECT_TRUE(session.has_next_job()); 23 | JobDesc job_desc = session.next_job(); 24 | 25 | EXPECT_EQ(job_desc.render().col(), 1); 26 | EXPECT_EQ(job_desc.render().row(), 2); 27 | 28 | while (session.has_next_job()) { 29 | job_desc = session.next_job(); 30 | } 31 | 32 | EXPECT_EQ(job_desc.render().col(), 2); 33 | EXPECT_EQ(job_desc.render().row(), 3); 34 | } 35 | -------------------------------------------------------------------------------- /src/mvp/Pipeline/tests/test.mvp: -------------------------------------------------------------------------------- 1 | input { 2 | image_pattern: "" 3 | camera_pattern: "" 4 | } 5 | 6 | render { 7 | bbox: "1,2:3,4" 8 | level: 12 9 | } 10 | 11 | output { 12 | result: "zmq://localhost:5566/result.plate" 13 | datum: "D_MOON" 14 | } 15 | 16 | algorithm { 17 | alt_min: -6000 18 | alt_max: 2000 19 | alt_search_range: 600 20 | } 21 | -------------------------------------------------------------------------------- /src/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${CMAKE_SOURCE_DIR}/thirdparty/gtest) 2 | add_library(gtest ${CMAKE_SOURCE_DIR}/thirdparty/gtest/src/gtest-all.cc) 3 | 4 | add_library(gtest_main test_main.cc) 5 | add_definitions(-DTEST_SRCDIR=\"${CMAKE_CURRENT_SOURCE_DIR}\") 6 | add_definitions(-DTEST_OBJDIR=\"${CMAKE_CURRENT_BINARY_DIR}\") 7 | add_definitions(-DTEST_DATADIR=\"${CMAKE_SOURCE_DIR}/src/test/data\") 8 | 9 | target_link_libraries(gtest_main gtest pthread) 10 | 11 | if (ENABLE_OCTAVE_SUPPORT) 12 | target_link_libraries(gtest_main mvpOctave) 13 | endif() 14 | 15 | configure_file(${CMAKE_SOURCE_DIR}/src/test/loadtestenv.m.in loadtestenv.m) 16 | 17 | -------------------------------------------------------------------------------- /src/test/README: -------------------------------------------------------------------------------- 1 | Helpers.h and test_main.cc were both taken from VW 2 | 3 | Then SrcName was added from the Helpers.h in: 4 | https://github.com/NeoGeographyToolkit/PhotometryTK 5 | -------------------------------------------------------------------------------- /src/test/data/synth-ground-DEM.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/src/test/data/synth-ground-DEM.tif -------------------------------------------------------------------------------- /src/test/data/synth-ground-DRG.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/src/test/data/synth-ground-DRG.tif -------------------------------------------------------------------------------- /src/test/data/synth.0.pinhole: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/src/test/data/synth.0.pinhole -------------------------------------------------------------------------------- /src/test/data/synth.0.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/src/test/data/synth.0.tif -------------------------------------------------------------------------------- /src/test/data/synth.1.pinhole: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/src/test/data/synth.1.pinhole -------------------------------------------------------------------------------- /src/test/data/synth.1.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/src/test/data/synth.1.tif -------------------------------------------------------------------------------- /src/test/data/synth.2.pinhole: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/src/test/data/synth.2.pinhole -------------------------------------------------------------------------------- /src/test/data/synth.2.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/src/test/data/synth.2.tif -------------------------------------------------------------------------------- /src/test/data/synth.3.pinhole: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/src/test/data/synth.3.pinhole -------------------------------------------------------------------------------- /src/test/data/synth.3.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NeoGeographyToolkit/MultipleViewPipeline/c2ad4ebb7555a1157616389466c7075e0c61292a/src/test/data/synth.3.tif -------------------------------------------------------------------------------- /src/test/loadtestenv.m.in: -------------------------------------------------------------------------------- 1 | addpath("@CMAKE_BINARY_DIR@/src/mvp/Octave"); 2 | addpath("@CMAKE_SOURCE_DIR@/src/mvp/Octave"); 3 | addpath("@CMAKE_BINARY_DIR@/src/mvp/Frontend"); 4 | addpath("@CMAKE_SOURCE_DIR@/src/mvp/Frontend"); 5 | addpath("@CMAKE_SOURCE_DIR@/src/mvp/Algorithm/AlbedoBox"); 6 | addpath("@CMAKE_SOURCE_DIR@/src/mvp/Algorithm/AlgorithmVar"); 7 | addpath("@CMAKE_SOURCE_DIR@/src/mvp/Algorithm/Correlator"); 8 | addpath("@CMAKE_SOURCE_DIR@/src/mvp/Algorithm/Dummy"); 9 | addpath("@CMAKE_SOURCE_DIR@/src/mvp/Algorithm/Lighter"); 10 | addpath("@CMAKE_SOURCE_DIR@/src/mvp/Algorithm/Objective"); 11 | addpath("@CMAKE_SOURCE_DIR@/src/mvp/Algorithm/ObjectiveHelper"); 12 | addpath("@CMAKE_SOURCE_DIR@/src/mvp/Algorithm/PatchBox"); 13 | addpath("@CMAKE_SOURCE_DIR@/src/mvp/Algorithm/PixelResult"); 14 | addpath("@CMAKE_SOURCE_DIR@/src/mvp/Algorithm/Seed"); 15 | addpath("@CMAKE_SOURCE_DIR@/src/mvp/Algorithm/Seeder"); 16 | addpath("@CMAKE_SOURCE_DIR@/src/mvp/Algorithm/Stepper"); 17 | addpath("@CMAKE_SOURCE_DIR@/src/mvp/Algorithm/TileResult"); 18 | addpath("@CMAKE_SOURCE_DIR@/src/mvp/Algorithm/Support"); 19 | -------------------------------------------------------------------------------- /src/tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (VW_CARTOGRAPHY_FOUND AND VW_CAMERA_FOUND) 2 | add_executable(gen_synth_scene gen_synth_scene.cc) 3 | target_link_libraries(gen_synth_scene ${VW_LIBRARIES} 4 | ${Boost_LIBRARIES}) 5 | endif() 6 | 7 | add_executable(vwconvert vwconvert.cc) 8 | target_link_libraries(vwconvert ${VW_LIBRARIES} 9 | ${Boost_LIBRARIES}) 10 | 11 | if (VW_CAMERA_FOUND) 12 | add_executable(print_pinhole print_pinhole.cc) 13 | target_link_libraries(print_pinhole ${VW_LIBRARIES} ${Boost_LIBRARIES}) 14 | endif() 15 | 16 | if (VW_PLATE_FOUND) 17 | add_executable(plate2image plate2image.cc) 18 | target_link_libraries(plate2image ${VW_LIBRARIES} ${Boost_LIBRARIES}) 19 | endif() 20 | 21 | install(TARGETS gen_synth_scene vwconvert print_pinhole plate2image DESTINATION bin) 22 | -------------------------------------------------------------------------------- /src/tools/vwconvert.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace vw; 6 | 7 | int main(int argc, char *argv[]) { 8 | try { 9 | VW_ASSERT(argc==3, ArgumentErr() << "Invalid command-line args."); 10 | ImageView image; 11 | read_image(image, argv[1]); 12 | write_image(argv[2], channel_cast_rescale(normalize(image))); 13 | } catch (Exception& e) { 14 | std::cerr << "Error: " << e.what() << std::endl; 15 | std::cerr << "Usage: vwconvert " << std::endl; 16 | return 1; 17 | } 18 | return 0; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /thirdparty/gtest: -------------------------------------------------------------------------------- 1 | gtest-1.6.0/ -------------------------------------------------------------------------------- /thirdparty/vw_protobuf/README: -------------------------------------------------------------------------------- 1 | VW doesn't distribute the protobuf .proto files, so for now we copy them 2 | into this dir and include them in our project. 3 | 4 | This should become obsolete when VW starts distributing their protobuf 5 | files. 6 | -------------------------------------------------------------------------------- /thirdparty/vw_protobuf/grab_protos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [[ "$#" != "1" ]]; then 4 | echo "Usage: $0 VW_SRC_DIR" 5 | exit 6 | fi 7 | 8 | SCRIPT_DIR=$(dirname $0) 9 | PROTO_DIR=$SCRIPT_DIR/proto 10 | 11 | VW_SRC_DIR="$1"/src/vw 12 | 13 | if [[ ! -d "$VW_SRC_DIR" ]]; then 14 | echo "Not a valid VW root src dir: $VW_SRC_DIR" 15 | exit 16 | fi 17 | 18 | rsync -atv --prune-empty-dirs --include "*/" --include "*.proto" --exclude '*' $VW_SRC_DIR $SCRIPT_DIR 19 | -------------------------------------------------------------------------------- /thirdparty/vw_protobuf/vw/Camera/TsaiFile.proto: -------------------------------------------------------------------------------- 1 | // __BEGIN_LICENSE__ 2 | // Copyright (C) 2006-2011 United States Government as represented by 3 | // the Administrator of the National Aeronautics and Space Administration. 4 | // All Rights Reserved. 5 | // __END_LICENSE__ 6 | 7 | 8 | package vw.camera; 9 | 10 | message TsaiFile { 11 | optional string name = 1; // Optional Description 12 | 13 | // Intrinsic Properties of the camera 14 | repeated double focal_length = 2 [packed=true]; 15 | repeated double center_point = 3 [packed=true]; 16 | repeated double u_direction = 4 [packed=true]; 17 | repeated double v_direction = 5 [packed=true]; 18 | repeated double w_direction = 6 [packed=true]; 19 | 20 | // Extrinsic Properties 21 | repeated double camera_center = 7 [packed=true]; 22 | repeated double camera_rotation = 8 [packed=true]; 23 | 24 | // Distortion 25 | required string distortion_name = 9; 26 | repeated double distortion_vector = 10 [packed=true]; 27 | 28 | required double pixel_pitch = 11; 29 | } -------------------------------------------------------------------------------- /thirdparty/vw_protobuf/vw/Cartography/DatumDesc.proto: -------------------------------------------------------------------------------- 1 | package vw.cartography; 2 | 3 | message DatumDesc { 4 | required string name = 1; 5 | required string spheroid_name = 2; 6 | required string meridian_name = 3; 7 | required double semi_major_axis = 4; 8 | required double semi_minor_axis = 5; 9 | required double meridian_offset = 6; 10 | required bool geocentric = 7; 11 | required string proj_str = 8; 12 | } 13 | -------------------------------------------------------------------------------- /thirdparty/vw_protobuf/vw/Cartography/GeoReferenceDesc.proto: -------------------------------------------------------------------------------- 1 | package vw.cartography; 2 | 3 | import "vw/Cartography/DatumDesc.proto"; 4 | 5 | message GeoReferenceDesc { 6 | enum PixelInterpretation { 7 | PixelAsArea = 0; 8 | PixelAsPoint = 1; 9 | } 10 | 11 | required DatumDesc datum = 1; 12 | required PixelInterpretation pixel_interpretation = 2; 13 | repeated double transform = 3; 14 | required bool is_projected = 4; 15 | required string proj_projection_str = 5; 16 | } 17 | -------------------------------------------------------------------------------- /thirdparty/vw_protobuf/vw/Plate/PlateGeoReferenceDesc.proto: -------------------------------------------------------------------------------- 1 | package vw.platefile; 2 | 3 | import "vw/Cartography/DatumDesc.proto"; 4 | import "vw/Cartography/GeoReferenceDesc.proto"; 5 | 6 | message PlateGeoReferenceDesc { 7 | required cartography.DatumDesc datum = 1; 8 | required string map_proj = 2; 9 | required int32 tile_size = 3; 10 | required cartography.GeoReferenceDesc.PixelInterpretation pixel_interpretation = 4; 11 | } 12 | -------------------------------------------------------------------------------- /thirdparty/vw_protobuf/vw/Plate/Rpc.proto: -------------------------------------------------------------------------------- 1 | // __BEGIN_LICENSE__ 2 | // Copyright (C) 2006-2011 United States Government as represented by 3 | // the Administrator of the National Aeronautics and Space Administration. 4 | // All Rights Reserved. 5 | // __END_LICENSE__ 6 | 7 | 8 | package vw.platefile; 9 | 10 | message RpcNullMsg { 11 | optional int32 dummy = 1 [ default = 0 ]; // dummy parameter (empty message) 12 | } 13 | 14 | // The way enums work: 15 | // If you add an enum value to the list, code that doesn't known about that 16 | // new value will map it to the default. That default is UNKNOWN, which is 17 | // the same as "an exception that we don't specifically handle". You can add 18 | // to this enum, just don't re-use numbers. 19 | message RpcErrorMsg { 20 | enum Code { 21 | // 0-100 reserved for system 22 | SUCCESS = 0; 23 | UNKNOWN = 1; 24 | REMOTE_ERROR = 2; 25 | 26 | // 101-200 reserved for plate 27 | PLATE_UNKNOWN = 101; 28 | PLATE_TILE_NOT_FOUND = 102; 29 | PLATE_INVALID = 103; 30 | PLATE_CREATION_FAILED = 104; 31 | PLATE_BLOB_IO = 105; 32 | PLATE_BLOB_LIMIT = 106; 33 | } 34 | 35 | optional Code code = 1 [ default = UNKNOWN ]; 36 | optional string msg = 2; 37 | } 38 | 39 | message RpcWrapper { 40 | required string method = 1; 41 | optional bytes payload = 2; 42 | optional RpcErrorMsg error = 3; 43 | optional string requestor = 4; 44 | optional int32 seq = 5 [default = -1]; 45 | required uint32 checksum = 6; 46 | } 47 | -------------------------------------------------------------------------------- /thirdparty/vw_protobuf/vw/Plate/tests/TestRpcService.proto: -------------------------------------------------------------------------------- 1 | // __BEGIN_LICENSE__ 2 | // Copyright (C) 2006-2011 United States Government as represented by 3 | // the Administrator of the National Aeronautics and Space Administration. 4 | // All Rights Reserved. 5 | // __END_LICENSE__ 6 | 7 | 8 | package vw.platefile; 9 | import "vw/Plate/Rpc.proto"; 10 | 11 | message DoubleMessage { 12 | required int32 num = 1; 13 | optional uint32 seq = 2; 14 | } 15 | 16 | option cc_generic_services = true; 17 | 18 | service TestService { 19 | rpc DoubleRequest (DoubleMessage) returns (DoubleMessage); 20 | } 21 | --------------------------------------------------------------------------------