From 96b4626adcad3ca9e9b9b303d2e3d67a13e3f23e Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 1 Nov 2011 20:32:58 +0100 Subject: [PATCH] big update * updated install script to use precompiled version of vlfeat because of compile bug in ubuntu 11.10 * use of https://github.com/TheFrenchLeaf/CMVS-PMVS * new run script run.rb --- ccd_defs.rb | 277 ++++++++++++ convert_vlsift_to_lowesift.pl | 9 +- install-centos.sh | 216 ++++----- install.sh | 319 ++++++-------- .../program/thirdParty/CMakeLists.txt | 7 + run.pl | 4 +- run.rb | 417 ++++++++++++++++++ 7 files changed, 937 insertions(+), 312 deletions(-) create mode 100644 ccd_defs.rb mode change 100755 => 100644 convert_vlsift_to_lowesift.pl mode change 100755 => 100644 install-centos.sh mode change 100755 => 100644 install.sh create mode 100644 patched_files/src/cmvs-pmvs/program/thirdParty/CMakeLists.txt mode change 100755 => 100644 run.pl create mode 100644 run.rb diff --git a/ccd_defs.rb b/ccd_defs.rb new file mode 100644 index 000000000..2574175e2 --- /dev/null +++ b/ccd_defs.rb @@ -0,0 +1,277 @@ +#!/usr/bin/ruby + +$ccd_widths = { + :"Asahi Optical Co.,Ltd. PENTAX Optio330RS" => 7.176, # 1/1.8" + :"Canon Canon DIGITAL IXUS 400" => 7.176, # 1/1.8" + :"Canon Canon DIGITAL IXUS 40" => 5.76, # 1/2.5" + :"Canon Canon DIGITAL IXUS 430" => 7.176, # 1/1.8" + :"Canon Canon DIGITAL IXUS 500" => 7.176, # 1/1.8" + :"Canon Canon DIGITAL IXUS 50" => 5.76, # 1/2.5" + :"Canon Canon DIGITAL IXUS 55" => 5.76, # 1/2.5" + :"Canon Canon DIGITAL IXUS 60" => 5.76, # 1/2.5" + :"Canon Canon DIGITAL IXUS 65" => 5.76, # 1/2.5" + :"Canon Canon DIGITAL IXUS 700" => 7.176, # 1/1.8" + :"Canon Canon DIGITAL IXUS 750" => 7.176, # 1/1.8" + :"Canon Canon DIGITAL IXUS 800 IS" => 5.76, # 1/2.5" + :"Canon Canon DIGITAL IXUS II" => 5.27, # 1/2.7" + :"Canon Canon DIGITAL IXUS 430" => 6.18, # 1/2.3" + :"Canon Canon EOS 10D" => 22.7, + :"Canon Canon EOS-1D Mark II" => 28.7, + :"Canon Canon EOS-1Ds Mark II" => 35.95, + :"Canon Canon EOS 20D" => 22.5, + :"Canon Canon EOS 20D" => 22.5, + :"Canon Canon EOS 300D DIGITAL" => 22.66, + :"Canon Canon EOS 30D" => 22.5, + :"Canon Canon EOS 350D DIGITAL" => 22.2, + :"Canon Canon EOS 400D DIGITAL" => 22.2, + :"Canon Canon EOS 40D" => 22.2, + :"Canon Canon EOS 5D" => 35.8, + :"Canon Canon EOS DIGITAL REBEL" => 22.66, + :"Canon Canon EOS DIGITAL REBEL XT" => 22.2, + :"Canon Canon EOS DIGITAL REBEL XTi" => 22.2, + :"Canon Canon EOS Kiss Digital" => 22.66, + :"Canon Canon IXY DIGITAL 600" => 7.176, # 1/1.8" + :"Canon Canon PowerShot A10" => 5.23, # 1/1.8" + :"Canon Canon PowerShot A20" => 7.176, # 1/1.8" + :"Canon Canon PowerShot A400" => 4.54, # 1/3.2" + :"Canon Canon PowerShot A40" => 5.27, # 1/2.7" + :"Canon Canon PowerShot A510" => 5.76, # 1/2.5" + :"Canon Canon PowerShot A520" => 5.76, # 1/2.5" + :"Canon Canon PowerShot A530" => 5.76, # 1/2.5" + :"Canon Canon PowerShot A60" => 5.27, # 1/2.7" + :"Canon Canon PowerShot A620" => 7.176, # 1/1.8" + :"Canon Canon PowerShot A630" => 7.176, # 1/1.8" + :"Canon Canon PowerShot A640" => 7.176, # 1/1.8" + :"Canon Canon PowerShot A700" => 5.76, # 1/2.5" + :"Canon Canon PowerShot A70" => 5.27, # 1/2.7" + :"Canon Canon PowerShot A710 IS" => 5.76, # 1/2.5" + :"Canon Canon PowerShot A75" => 5.27, # 1/2.7" + :"Canon Canon PowerShot A80" => 7.176, # 1/1.8" + :"Canon Canon PowerShot A85" => 5.27, # 1/2.7" + :"Canon Canon PowerShot A95" => 7.176, # 1/1.8" + :"Canon Canon PowerShot G1" => 7.176, # 1/1.8" + :"Canon Canon PowerShot G2" => 7.176, # 1/1.8" + :"Canon Canon PowerShot G3" => 7.176, # 1/1.8" + :"Canon Canon PowerShot G5" => 7.176, # 1/1.8" + :"Canon Canon PowerShot G6" => 7.176, # 1/1.8" + :"Canon Canon PowerShot G7" => 7.176, # 1/1.8" + :"Canon Canon PowerShot G9" => 7.600, # 1/1.7" + :"Canon Canon PowerShot Pro1" => 8.8, # 2/3" + :"Canon Canon PowerShot S110" => 5.27, # 1/2.7" + :"Canon Canon PowerShot S1 IS" => 5.27, # 1/2.7" + :"Canon Canon PowerShot S200" => 5.27, # 1/2.7" + :"Canon Canon PowerShot S2 IS" => 5.76, # 1/2.5" + :"Canon Canon PowerShot S30" => 7.176, # 1/1.8" + :"Canon Canon PowerShot S3 IS" => 5.76, # 1/2.5" + :"Canon Canon PowerShot S400" => 7.176, # 1/1.8" + :"Canon Canon PowerShot S40" => 7.176, # 1/1.8" + :"Canon Canon PowerShot S410" => 7.176, # 1/1.8" + :"Canon Canon PowerShot S45" => 7.176, # 1/1.8" + :"Canon Canon PowerShot S500" => 7.176, # 1/1.8" + :"Canon Canon PowerShot S50" => 7.176, # 1/1.8" + :"Canon Canon PowerShot S60" => 7.176, # 1/1.8" + :"Canon Canon PowerShot S70" => 7.176, # 1/1.8" + :"Canon Canon PowerShot S80" => 7.176, # 1/1.8" + :"Canon Canon PowerShot SD1000" => 5.75, # 1/2.5" + :"Canon Canon PowerShot SD100" => 5.27, # 1/2.7" + :"Canon Canon PowerShot SD10" => 5.75, # 1/2.5" + :"Canon Canon PowerShot SD110" => 5.27, # 1/2.7" + :"Canon Canon PowerShot SD200" => 5.76, # 1/2.5" + :"Canon Canon PowerShot SD300" => 5.76, # 1/2.5" + :"Canon Canon PowerShot SD400" => 5.76, # 1/2.5" + :"Canon Canon PowerShot SD450" => 5.76, # 1/2.5" + :"Canon Canon PowerShot SD500" => 7.176, # 1/1.8" + :"Canon Canon PowerShot SD550" => 7.176, # 1/1.8" + :"Canon Canon PowerShot SD600" => 5.76, # 1/2.5" + :"Canon Canon PowerShot SD630" => 5.76, # 1/2.5" + :"Canon Canon PowerShot SD700 IS" => 5.76, # 1/2.5" + :"Canon Canon PowerShot SD750" => 5.75, # 1/2.5" + :"Canon Canon PowerShot SD800 IS" => 5.76, # 1/2.5" + :"Canon EOS 300D DIGITAL" => 22.66, + :"Canon EOS DIGITAL REBEL" => 22.66, + :"Canon PowerShot A510" => 5.76, # 1/2.5" ??? + :"Canon PowerShot S30" => 7.176, # 1/1.8" + :"CASIO COMPUTER CO.,LTD. EX-S500" => 5.76, # 1/2.5" + :"CASIO COMPUTER CO.,LTD. EX-Z1000" => 7.716, # 1/1.8" + :"CASIO COMPUTER CO.,LTD EX-Z30" => 5.76, # 1/2.5 " + :"CASIO COMPUTER CO.,LTD. EX-Z600" => 5.76, # 1/2.5" + :"CASIO COMPUTER CO.,LTD. EX-Z60" => 7.176, # 1/1.8" + :"CASIO COMPUTER CO.,LTD EX-Z750" => 7.176, # 1/1.8" + :"CASIO COMPUTER CO.,LTD. EX-Z850" => 7.176, + :"EASTMAN KODAK COMPANY KODAK CX7330 ZOOM DIGITAL CAMERA" => 5.27, # 1/2.7" + :"EASTMAN KODAK COMPANY KODAK CX7530 ZOOM DIGITAL CAMERA" => 5.76, # 1/2.5" + :"EASTMAN KODAK COMPANY KODAK DX3900 ZOOM DIGITAL CAMERA" => 7.176, # 1/1.8" + :"EASTMAN KODAK COMPANY KODAK DX4900 ZOOM DIGITAL CAMERA" => 7.176, # 1/1.8" + :"EASTMAN KODAK COMPANY KODAK DX6340 ZOOM DIGITAL CAMERA" => 5.27, # 1/2.7" + :"EASTMAN KODAK COMPANY KODAK DX6490 ZOOM DIGITAL CAMERA" => 5.76, # 1/2.5" + :"EASTMAN KODAK COMPANY KODAK DX7630 ZOOM DIGITAL CAMERA" => 7.176, # 1/1.8" + :"EASTMAN KODAK COMPANY KODAK Z650 ZOOM DIGITAL CAMERA" => 5.76, # 1/2.5" + :"EASTMAN KODAK COMPANY KODAK Z700 ZOOM DIGITAL CAMERA" => 5.76, # 1/2.5" + :"EASTMAN KODAK COMPANY KODAK Z740 ZOOM DIGITAL CAMERA" => 5.76, # 1/2.5" + :"EASTMAN KODAK COMPANY KODAK Z740 ZOOM DIGITAL CAMERA" => 5.76, # 1/2.5" ? + :"FUJIFILM FinePix2600Zoom" => 5.27, # 1/2.7" + :"FUJIFILM FinePix40i" => 7.600, # 1/1.7" + :"FUJIFILM FinePix A310" => 5.27, # 1/2.7" + :"FUJIFILM FinePix A330" => 5.27, # 1/2.7" + :"FUJIFILM FinePix A600" => 7.600, # 1/1.7" + :"FUJIFILM FinePix E500" => 5.76, # 1/2.5" + :"FUJIFILM FinePix E510" => 5.76, # 1/2.5" + :"FUJIFILM FinePix E550" => 7.600, # 1/1.7" + :"FUJIFILM FinePix E900" => 7.78, # 1/1.6" + :"FUJIFILM FinePix F10" => 7.600, # 1/1.7" + :"FUJIFILM FinePix F30" => 7.600, # 1/1.7" + :"FUJIFILM FinePix F450" => 5.76, # 1/2.5" + :"FUJIFILM FinePix F601 ZOOM" => 7.600, # 1/1.7" + :"FUJIFILM FinePix S3Pro" => 23.0, + :"FUJIFILM FinePix S5000" => 5.27, # 1/2.7" + :"FUJIFILM FinePix S5200" => 5.76, # 1/2.5" + :"FUJIFILM FinePix S5500" => 5.27, # 1/2.7" + :"FUJIFILM FinePix S6500fd" => 7.600, # 1/1.7" + :"FUJIFILM FinePix S7000" => 7.600, # 1/1.7" + :"FUJIFILM FinePix Z2" => 5.76, # 1/2.5" + :"Hewlett-Packard hp 635 Digital Camera" => 4.54, # 1/3.2" + :"Hewlett-Packard hp PhotoSmart 43x series" => 5.27, # 1/2.7" + :"Hewlett-Packard HP PhotoSmart 618 (V1.1)" => 5.27, # 1/2.7" + :"Hewlett-Packard HP PhotoSmart C945 (V01.61)" => 7.176, # 1/1.8" + :"Hewlett-Packard HP PhotoSmart R707 (V01.00)" => 7.176, # 1/1.8" + :"KONICA MILOLTA DYNAX 5D" => 23.5, + :"Konica Minolta Camera, Inc. DiMAGE A2" => 8.80, # 2/3" + :"KONICA MINOLTA CAMERA, Inc. DiMAGE G400" => 5.76, # 1/2.5" + :"Konica Minolta Camera, Inc. DiMAGE Z2" => 5.76, # 1/2.5" + :"KONICA MINOLTA DiMAGE A200" => 8.80, # 2/3" + :"KONICA MINOLTA DiMAGE X1" => 7.176, # 1/1.8" + :"KONICA MINOLTA DYNAX 5D" => 23.5, + :"Minolta Co., Ltd. DiMAGE F100" => 7.176, # 1/2.7" + :"Minolta Co., Ltd. DiMAGE Xi" => 5.27, # 1/2.7" + :"Minolta Co., Ltd. DiMAGE Xt" => 5.27, # 1/2.7" + :"Minolta Co., Ltd. DiMAGE Z1" => 5.27, # 1/2.7" + :"NIKON COOLPIX L3" => 5.76, # 1/2.5" + :"NIKON COOLPIX P2" => 7.176, # 1/1.8" + :"NIKON COOLPIX S4" => 5.76, # 1/2.5" + :"NIKON COOLPIX S7c" => 5.76, # 1/2.5" + :"NIKON CORPORATION NIKON D100" => 23.7, + :"NIKON CORPORATION NIKON D1" => 23.7, + :"NIKON CORPORATION NIKON D1H" => 23.7, + :"NIKON CORPORATION NIKON D200" => 23.6, + :"NIKON CORPORATION NIKON D2H" => 23.3, + :"NIKON CORPORATION NIKON D2X" => 23.7, + :"NIKON CORPORATION NIKON D40" => 23.7, + :"NIKON CORPORATION NIKON D50" => 23.7, + :"NIKON CORPORATION NIKON D60" => 23.6, + :"NIKON CORPORATION NIKON D70" => 23.7, + :"NIKON CORPORATION NIKON D70s" => 23.7, + :"NIKON CORPORATION NIKON D80" => 23.6, + :"NIKON CORPORATION NIKON D700" => 36.0, + :"NIKON E2500" => 5.27, # 1/2.7" + :"NIKON E2500" => 5.27, # 1/2.7" + :"NIKON E3100" => 5.27, # 1/2.7" + :"NIKON E3200" => 5.27, + :"NIKON E3700" => 5.27, # 1/2.7" + :"NIKON E4200" => 7.176, # 1/1.8" + :"NIKON E4300" => 7.18, + :"NIKON E4500" => 7.176, # 1/1.8" + :"NIKON E4600" => 5.76, # 1/2.5" + :"NIKON E5000" => 8.80, # 2/3" + :"NIKON E5200" => 7.176, # 1/1.8" + :"NIKON E5400" => 7.176, # 1/1.8" + :"NIKON E5600" => 5.76, # 1/2.5" + :"NIKON E5700" => 8.80, # 2/3" + :"NIKON E5900" => 7.176, # 1/1.8" + :"NIKON E7600" => 7.176, # 1/1.8" + :"NIKON E775" => 5.27, # 1/2.7" + :"NIKON E7900" => 7.176, # 1/1.8" + :"NIKON E7900" => 7.176, # 1/1.8" + :"NIKON E8800" => 8.80, # 2/3" + :"NIKON E990" => 7.176, # 1/1.8" + :"NIKON E995" => 7.176, # 1/1.8" + :"NIKON S1" => 5.76, # 1/2.5" + :"Nokia N80" => 5.27, # 1/2.7" + :"Nokia N80" => 5.27, # 1/2.7" + :"Nokia N93" => 4.536, # 1/3.1" + :"Nokia N95" => 5.7, # 1/2.7" + :"OLYMPUS CORPORATION C-5000Z" => 7.176, # 1/1.8" + :"OLYMPUS CORPORATION C5060WZ" => 7.176, # 1/1.8" + :"OLYMPUS CORPORATION C750UZ" => 5.27, # 1/2.7" + :"OLYMPUS CORPORATION C765UZ" => 5.76, # 1//2.5" + :"OLYMPUS CORPORATION C8080WZ" => 8.80, # 2/3" + :"OLYMPUS CORPORATION X250,D560Z,C350Z" => 5.76, # 1/2.5" + :"OLYMPUS CORPORATION X-3,C-60Z" => 7.176, # 1.8" + :"OLYMPUS CORPORATION X400,D580Z,C460Z" => 5.27, # 1/2.7" + :"OLYMPUS IMAGING CORP. E-500" => 17.3, # 4/3? + :"OLYMPUS IMAGING CORP. E-510" => 17.3, + :"OLYMPUS IMAGING CORP. FE115,X715" => 5.76, # 1/2.5" + :"OLYMPUS IMAGING CORP. SP310" => 7.176, # 1/1.8" + :"OLYMPUS IMAGING CORP. SP510UZ" => 5.75, # 1/2.5" + :"OLYMPUS IMAGING CORP. SP550UZ" => 5.76, # 1/2.5" + :"OLYMPUS IMAGING CORP. uD600,S600" => 5.75, # 1/2.5" + :"OLYMPUS_IMAGING_CORP. X450,D535Z,C370Z" => 5.27, # 1/2.7" + :"OLYMPUS IMAGING CORP. X550,D545Z,C480Z" => 5.76, # 1/2.5" + :"OLYMPUS OPTICAL CO.,LTD C2040Z" => 6.40, # 1/2" + :"OLYMPUS OPTICAL CO.,LTD C211Z" => 5.27, # 1/2.7" + :"OLYMPUS OPTICAL CO.,LTD C2Z,D520Z,C220Z" => 4.54, # 1/3.2" + :"OLYMPUS OPTICAL CO.,LTD C3000Z" => 7.176, # 1/1.8" + :"OLYMPUS OPTICAL CO.,LTD C300Z,D550Z" => 5.4, + :"OLYMPUS OPTICAL CO.,LTD C4100Z,C4000Z" => 7.176, # 1/1.8" + :"OLYMPUS OPTICAL CO.,LTD C750UZ" => 5.27, # 1/2.7" + :"OLYMPUS OPTICAL CO.,LTD X-2,C-50Z" => 7.176, # 1/1.8" + :"OLYMPUS SP550UZ" => 5.76, # 1/2.5" + :"OLYMPUS X100,D540Z,C310Z" => 5.27, # 1/2.7" + :"Panasonic DMC-FX01" => 5.76, # 1/2.5" + :"Panasonic DMC-FX07" => 5.75, # 1/2.5" + :"Panasonic DMC-FX9" => 5.76, # 1/2.5" + :"Panasonic DMC-FZ20" => 5.760, # 1/2.5" + :"Panasonic DMC-FZ2" => 4.54, # 1/3.2" + :"Panasonic DMC-FZ30" => 7.176, # 1/1.8" + :"Panasonic DMC-FZ50" => 7.176, # 1/1.8" + :"Panasonic DMC-FZ5" => 5.760, # 1/2.5" + :"Panasonic DMC-FZ7" => 5.76, # 1/2.5" + :"Panasonic DMC-LC1" => 8.80, # 2/3" + :"Panasonic DMC-LC33" => 5.760, # 1/2.5" + :"Panasonic DMC-LX1" => 8.50, # 1/6.5" + :"Panasonic DMC-LZ2" => 5.76, # 1/2.5" + :"Panasonic DMC-TZ1" => 5.75, # 1/2.5" + :"Panasonic DMC-TZ3" => 5.68, # 1/2.35" + :"Panasonic DMC-TZ5" => 6.12, # 1/2.33" + :"PENTAX Corporation PENTAX *ist DL" => 23.5, + :"PENTAX Corporation PENTAX *ist DS2" => 23.5, + :"PENTAX Corporation PENTAX *ist DS" => 23.5, + :"PENTAX Corporation PENTAX K100D" => 23.5, + :"PENTAX Corporation PENTAX Optio 450" => 7.176, # 1/1.8" + :"PENTAX Corporation PENTAX Optio 550" => 7.176, # 1/1.8" + :"PENTAX Corporation PENTAX Optio E10" => 5.76, # 1/2.5" + :"PENTAX Corporation PENTAX Optio S40" => 5.76, # 1/2.5" + :"PENTAX Corporation PENTAX Optio S4" => 5.76, # 1/2.5" + :"PENTAX Corporation PENTAX Optio S50" => 5.76, # 1/2.5" + :"PENTAX Corporation PENTAX Optio S5i" => 5.76, # 1/2.5" + :"PENTAX Corporation PENTAX Optio S5z" => 5.76, # 1/2.5" + :"PENTAX Corporation PENTAX Optio SV" => 5.76, # 1/2.5" + :"PENTAX Corporation PENTAX Optio WP" => 5.75, # 1/2.5" + :"RICOH CaplioG3 modelM" => 5.27, # 1/2.7" + :"RICOH Caplio GX" => 7.176, # 1/1.8" + :"RICOH Caplio R30" => 5.75, # 1/2.5" + :"Samsung Digimax 301" => 5.27, # 1/2.7" + :"Samsung Techwin " => 5.76, # 1/2.5" + :"SAMSUNG TECHWIN Pro 815" => 8.80, # 2/3" + :"SONY DSC-F828" => 8.80, # 2/3" + :"SONY DSC-N12" => 7.176, # 1/1.8" + :"SONY DSC-P100" => 7.176, # 1/1.8" + :"SONY DSC-P10" => 7.176, # 1/1.8" + :"SONY DSC-P12" => 7.176, # 1/1.8" + :"SONY DSC-P150" => 7.176, # 1/1.8" + :"SONY DSC-P200" => 7.176, # 1/1.8"); + :"SONY DSC-P52" => 5.27, # 1/2.7" + :"SONY DSC-P72" => 5.27, # 1/2.7" + :"SONY DSC-P73" => 5.27, + :"SONY DSC-P8" => 5.27, # 1/2.7" + :"SONY DSC-R1" => 21.5, + :"SONY DSC-S40" => 5.27, # 1/2.7" + :"SONY DSC-S600" => 5.760, # 1/2.5" + :"SONY DSC-T9" => 7.18, + :"SONY DSC-V1" => 7.176, # 1/1.8" + :"SONY DSC-W1" => 7.176, # 1/1.8" + :"SONY DSC-W30" => 5.760, # 1/2.5" + :"SONY DSC-W50" => 5.75, # 1/2.5" + :"SONY DSC-W5" => 7.176, # 1/1.8" + :"SONY DSC-W7" => 7.176, # 1/1.8" + :"SONY DSC-W80" => 5.75, # 1/2.5" +} diff --git a/convert_vlsift_to_lowesift.pl b/convert_vlsift_to_lowesift.pl old mode 100755 new mode 100644 index 176aafb71..dc72a1f4c --- a/convert_vlsift_to_lowesift.pl +++ b/convert_vlsift_to_lowesift.pl @@ -7,21 +7,18 @@ $filename_src = $filename_base.".key.sift"; $filename_dest_bin = $filename_base.".key.bin"; $filename_dest_key = $filename_base.".key"; -$filename_image = $filename_base.".jpg"; +$filename_image = $filename_base.".pgm"; open (DEST_BIN, ">$filename_dest_bin"); open (DEST_KEY, ">$filename_dest_key"); open (SRC, "$filename_src"); -$resolution_line = `jhead $filename_image | grep "Resolution"`; -($res_x, $res_y) = $resolution_line =~ /: ([0-9]*) x ([0-9]*)/; - $linecount = 0; $linecount += tr/\n/\n/ while sysread(SRC, $_, 2 ** 16); - -printf ("found %d features in %s (%d x %d)\n", $linecount, $filename_image, $res_x, $res_y); +printf ("%d", $linecount); + if($write_binary){ seek(SRC, 0, 0); diff --git a/install-centos.sh b/install-centos.sh old mode 100755 new mode 100644 index 855a17964..b1b163ccc --- a/install-centos.sh +++ b/install-centos.sh @@ -15,52 +15,61 @@ echo echo echo " - script started - `date`" + ## dest base path + TOOLS_PATH="$PWD" + ## paths for the tools + TOOLS_BIN_PATH="$TOOLS_PATH/bin" + TOOLS_INC_PATH="$TOOLS_PATH/include" + TOOLS_LIB_PATH="$TOOLS_PATH/lib" + TOOLS_SRC_PATH="$TOOLS_PATH/src" + TOOLS_LOG_PATH="$TOOLS_PATH/logs" + TOOLS_PATCHED_PATH="$TOOLS_PATH/patched_files" + ## loacal dest paths + LIB_PATH="/usr/local/lib" + INC_PATH="/usr/local/include" + ## source paths + BUNDLER_PATH="$TOOLS_SRC_PATH/bundler" + CMVS_PMVS_PATH="$TOOLS_SRC_PATH/cmvs-pmvs" + CLAPACK_PATH="$TOOLS_SRC_PATH/clapack" + VLFEAT_PATH="$TOOLS_SRC_PATH/vlfeat" + PARALLEL_PATH="$TOOLS_SRC_PATH/parallel" + PSR_PATH="$TOOLS_SRC_PATH/PoissonRecon" + ## executables + EXTRACT_FOCAL="$TOOLS_BIN_PATH/extract_focal.pl" + MATCHKEYS="$TOOLS_BIN_PATH/KeyMatch" + MATCHKEYSFULL="$TOOLS_BIN_PATH/KeyMatchFull" + BUNDLER="$TOOLS_BIN_PATH/bundler" + BUNDLE2PVMS="$TOOLS_BIN_PATH/Bundle2PMVS" + CMVS="$TOOLS_BIN_PATH/cmvs" + PMVS="$TOOLS_BIN_PATH/pmvs2" + GENOPTION="$TOOLS_BIN_PATH/genOption" + VLSIFT="$TOOLS_BIN_PATH/vlsift" + PARALLEL="$TOOLS_BIN_PATH/parallel" + PSR="$TOOLS_BIN_PATH/PoissonRecon" +VLSIFT_TO_LOWESIFT="$TOOLS_BIN_PATH/convert_vlsift_to_lowesift.pl" + ## get sys vars ARCH=`uname -m` CORES=`grep -c processor /proc/cpuinfo` - ## dest base path - TOOLS_PATH="$PWD" - ## paths for the tools - TOOLS_BIN_PATH="$TOOLS_PATH/bin" - TOOLS_INC_PATH="$TOOLS_PATH/include" - TOOLS_LIB_PATH="$TOOLS_PATH/lib" - TOOLS_SRC_PATH="$TOOLS_PATH/src" - TOOLS_LOG_PATH="$TOOLS_PATH/logs" - ## loacal dest paths - INC_PATH="/usr/local/include" - if [ "$ARCH" = "i686" ]; then - LIB_PATH="/usr/lib" - fi - if [ "$ARCH" = "x86_64" ]; then - LIB_PATH="/usr/lib64" - fi - ## source paths - BUNDLER_PATH="$TOOLS_SRC_PATH/bundler" - CMVS_PATH="$TOOLS_SRC_PATH/cmvs" - PMVS_PATH="$TOOLS_SRC_PATH/pmvs" - GRACLUS_PATH="$TOOLS_SRC_PATH/graclus" - CLAPACK_PATH="$TOOLS_SRC_PATH/clapack" - OPENCV_PATH="$TOOLS_SRC_PATH/openCv" - VLFEAT_PATH="$TOOLS_SRC_PATH/vlfeat" - PARALLEL_PATH="$TOOLS_SRC_PATH/parallel" - PSR_PATH="$TOOLS_SRC_PATH/PoissonRecon" - ## executables - EXTRACT_FOCAL="$TOOLS_BIN_PATH/extract_focal.pl" - MATCHKEYS="$TOOLS_BIN_PATH/KeyMatchFull" - BUNDLER="$TOOLS_BIN_PATH/bundler" - BUNDLE2PVMS="$TOOLS_BIN_PATH/Bundle2PMVS" - CMVS="$TOOLS_BIN_PATH/cmvs" - PMVS="$TOOLS_BIN_PATH/pmvs2" - GENOPTION="$TOOLS_BIN_PATH/genOption" - VLSIFT="$TOOLS_BIN_PATH/vlsift" - PARALLEL="$TOOLS_BIN_PATH/parallel" - PSR="$TOOLS_BIN_PATH/PoissonRecon" - VLSIFT_TO_LOWESIFT="$TOOLS_BIN_PATH/convert_vlsift_to_lowesift.pl" - ## prevents different (localized) output LC_ALL=C +## removing old stuff +sudo rm -Rf "$TOOLS_BIN_PATH" +sudo rm -Rf "$TOOLS_INC_PATH" +sudo rm -Rf "$TOOLS_LIB_PATH" +sudo rm -Rf "$TOOLS_SRC_PATH" +sudo rm -Rf "$TOOLS_LOG_PATH" + +## create needed directories +mkdir -p "$TOOLS_BIN_PATH" +mkdir -p "$TOOLS_INC_PATH" +mkdir -p "$TOOLS_LIB_PATH" +mkdir -p "$TOOLS_SRC_PATH" +mkdir -p "$TOOLS_LOG_PATH" + + ## removing old stuff rm -rf `ls -1 | egrep -v '\.zip$|\.tgz$|\.bz2$|\.gz$|\.sh$|\.pl$' | xargs` @@ -84,7 +93,7 @@ sudo yum update -y > "$TOOLS_LOG_PATH/apt-get_get.log" 2>&1 echo " - installing" yum install -y \ - cmake gcc gcc-c++ compat-gcc-32 compat-gcc-32-c++ gcc-gfortran perl \ + cmake gcc gcc-c++ compat-gcc-32 compat-gcc-32-c++ gcc-gfortran perl ruby rubygems git \ curl wget \ unzip \ ImageMagick jhead \ @@ -93,13 +102,15 @@ yum install -y \ opencv-devel \ > "$TOOLS_LOG_PATH/apt-get_install.log" 2>&1 +sudo gem install parallel > /dev/null 2>&1 + echo " < done - `date`" ## downloading sources echo echo " > getting the sources" -git clone git://github.com/vlfeat/vlfeat.git --quiet > /dev/null 2>&1 & +git clone https://github.com/TheFrenchLeaf/CMVS-PMVS.git --quiet > /dev/null 2>&1 & ## getting all archives if not already present; save them to .tmp and rename them after download while read target source @@ -116,11 +127,10 @@ do fi done < graclus" - cd "$GRACLUS_PATH" +echo " < done - `date`" - if [ "$ARCH" = "i686" ]; then - sed -i "$GRACLUS_PATH/Makefile.in" -e "11c\COPTIONS = -DNUMBITS=32" - fi - if [ "$ARCH" = "x86_64" ]; then - sed -i "$GRACLUS_PATH/Makefile.in" -e "11c\COPTIONS = -DNUMBITS=64" - fi - - echo " - cleaning graclus" - make clean > "$TOOLS_LOG_PATH/graclus_1_clean.log" 2>&1 +# building +echo +echo " - building" - echo " - building graclus" - make -j$CORES > "$TOOLS_LOG_PATH/graclus_2_build.log" 2>&1 - - mkdir "$TOOLS_INC_PATH/metisLib" - cp -f "$GRACLUS_PATH/metisLib/"*.h "$TOOLS_INC_PATH/metisLib/" +sudo chown -R `id -u`:`id -g` * +sudo chmod -R 777 * - cp -f lib* "$TOOLS_LIB_PATH/" -echo " < done - `date`" -echo echo " > poisson surface reconstruction " cd "$PSR_PATH" @@ -195,6 +193,7 @@ echo " > poisson surface reconstruction " echo " < done - `date`" echo + echo " > parallel" cd "$PARALLEL_PATH" @@ -210,6 +209,7 @@ echo " > parallel" echo " < done - `date`" echo + echo " > clapack" cd "$CLAPACK_PATH" cp make.inc.example make.inc @@ -229,59 +229,34 @@ echo echo " > vlfeat" cd "$VLFEAT_PATH" - - echo " - cleaning vlfeat" - make clean > "$TOOLS_LOG_PATH/vlfeat_1_clean.log" 2>&1 - - echo " - building vlfeat" - make > "$TOOLS_LOG_PATH/vlfeat_2_build.log" 2>&1 - - if [ "$ARCH" = "i686" ]; then - cp -f "$VLFEAT_PATH/bin/glnx32/sift" "$TOOLS_BIN_PATH/vlsift" - cp -f "$VLFEAT_PATH/bin/glnx32/libvl.so" "$TOOLS_LIB_PATH/" - fi - - if [ "$ARCH" = "x86_64" ]; then - cp -f "$VLFEAT_PATH/bin/glnxa64/sift" "$TOOLS_BIN_PATH/vlsift" - cp -f "$VLFEAT_PATH/bin/glnxa64/libvl.so" "$TOOLS_LIB_PATH/" - fi + + echo " - installing vlfeat" + + if [ "$ARCH" = "i686" ]; then + cp -f "$VLFEAT_PATH/bin/glnx32/sift" "$TOOLS_BIN_PATH/vlsift" + cp -f "$VLFEAT_PATH/bin/glnx32/libvl.so" "$TOOLS_LIB_PATH/" + fi + + if [ "$ARCH" = "x86_64" ]; then + cp -f "$VLFEAT_PATH/bin/glnxa64/sift" "$TOOLS_BIN_PATH/vlsift" + cp -f "$VLFEAT_PATH/bin/glnxa64/libvl.so" "$TOOLS_LIB_PATH/" + fi echo " < done - `date`" echo + echo " > cmvs" - cd "$CMVS_PATH/program/main" + cd "$CMVS_PMVS_PATH/program" - sed -i "$CMVS_PATH/program/main/genOption.cc" -e "5c\#include \n" - sed -i "$CMVS_PATH/program/base/cmvs/bundle.cc" -e "3c\#include \n" - - sed -i "$CMVS_PATH/program/main/Makefile" -e "10c\#Your INCLUDE path (e.g., -I\/usr\/include)" - sed -i "$CMVS_PATH/program/main/Makefile" -e "11c\YOUR_INCLUDE_PATH =-I$INC_PATH -I$TOOLS_INC_PATH" - sed -i "$CMVS_PATH/program/main/Makefile" -e "13c\#Your metis directory (contains header files under graclus1.2/metisLib/)" - sed -i "$CMVS_PATH/program/main/Makefile" -e "14c\YOUR_INCLUDE_METIS_PATH = -I$TOOLS_INC_PATH/metisLib/" - sed -i "$CMVS_PATH/program/main/Makefile" -e "16c\#Your LDLIBRARY path (e.g., -L/usr/lib)" - sed -i "$CMVS_PATH/program/main/Makefile" -e "17c\YOUR_LDLIB_PATH = -L$LIB_PATH -L$TOOLS_LIB_PATH" - if [ "$ARCH" = "i686" ]; then - sed -i "$CMVS_PATH/program/main/Makefile" -e "22c\CXXFLAGS_CMVS = -O2 -Wall -Wno-deprecated -DNUMBITS=32 \\\\" - sed -i "$CMVS_PATH/program/main/Makefile" -e '24c\ -fopenmp -DNUMBITS=32 ${OPENMP_FLAG}' - fi + echo " - building cmvs/pmvs" - if [ "$ARCH" = "x86_64" ]; then - sed -i "$CMVS_PATH/program/main/Makefile" -e "22c\CXXFLAGS_CMVS = -O2 -Wall -Wno-deprecated -DNUMBITS=64 \\\\" - sed -i "$CMVS_PATH/program/main/Makefile" -e '24c\ -fopenmp -DNUMBITS=64 ${OPENMP_FLAG}' - fi - - echo " - cleaning cmvs" - make clean > "$TOOLS_LOG_PATH/cmvs_1_clean.log" 2>&1 - - echo " - building cmvs" - make -j$CORES > "$TOOLS_LOG_PATH/cmvs_2_build.log" 2>&1 + cmake . > "$TOOLS_LOG_PATH/cmcs-pmvs_1_cmake.log" 2>&1 + make -j > "$TOOLS_LOG_PATH/cmcs-pmvs_2_build.log" 2>&1 - echo " - make depend cmvs" - sudo make depend > "$TOOLS_LOG_PATH/cmvs_3_depend.log" 2>&1 - - cp -f "$CMVS_PATH/program/main/cmvs" "$CMVS_PATH/program/main/pmvs2" "$CMVS_PATH/program/main/genOption" "$TOOLS_BIN_PATH/" - cp -f "$CMVS_PATH/program/main/"*so* "$TOOLS_LIB_PATH/" + echo " - installing cmvs/pmvs" + + cp -f "$CMVS_PMVS_PATH/program/main/cmvs" "$CMVS_PMVS_PATH/program/main/pmvs2" "$CMVS_PMVS_PATH/program/main/genOption" "$TOOLS_BIN_PATH/" echo " < done - `date`" echo @@ -305,6 +280,7 @@ cd "$TOOLS_PATH" sudo install -o `id -u` -g `id -g` -m 644 -t "$LIB_PATH" lib/*.so sudo /sbin/ldconfig -v > "$TOOLS_LOG_PATH/ldconfig.log" 2>&1 + sudo chown -R `id -u`:`id -g` * sudo chmod -R 777 * diff --git a/install.sh b/install.sh old mode 100755 new mode 100644 index fcda2515a..6a6c20d15 --- a/install.sh +++ b/install.sh @@ -15,41 +15,38 @@ echo echo echo " - script started - `date`" - ## dest base path - TOOLS_PATH="$PWD" - ## paths for the tools - TOOLS_BIN_PATH="$TOOLS_PATH/bin" - TOOLS_INC_PATH="$TOOLS_PATH/include" - TOOLS_LIB_PATH="$TOOLS_PATH/lib" - TOOLS_SRC_PATH="$TOOLS_PATH/src" - TOOLS_LOG_PATH="$TOOLS_PATH/logs" - TOOLS_PATCHED_PATH="$TOOLS_PATH/patched_files" - ## loacal dest paths - LIB_PATH="/usr/local/lib" - INC_PATH="/usr/local/include" - ## source paths - BUNDLER_PATH="$TOOLS_SRC_PATH/bundler" - CMVS_PATH="$TOOLS_SRC_PATH/cmvs" - PMVS_PATH="$TOOLS_SRC_PATH/pmvs" - GRACLUS_PATH="$TOOLS_SRC_PATH/graclus" - CLAPACK_PATH="$TOOLS_SRC_PATH/clapack" - OPENCV_PATH="$TOOLS_SRC_PATH/openCv" - VLFEAT_PATH="$TOOLS_SRC_PATH/vlfeat" - PARALLEL_PATH="$TOOLS_SRC_PATH/parallel" - PSR_PATH="$TOOLS_SRC_PATH/PoissonRecon" - ## executables - EXTRACT_FOCAL="$TOOLS_BIN_PATH/extract_focal.pl" - MATCHKEYS="$TOOLS_BIN_PATH/KeyMatch" - MATCHKEYSFULL="$TOOLS_BIN_PATH/KeyMatchFull" - BUNDLER="$TOOLS_BIN_PATH/bundler" - BUNDLE2PVMS="$TOOLS_BIN_PATH/Bundle2PMVS" - CMVS="$TOOLS_BIN_PATH/cmvs" - PMVS="$TOOLS_BIN_PATH/pmvs2" - GENOPTION="$TOOLS_BIN_PATH/genOption" - VLSIFT="$TOOLS_BIN_PATH/vlsift" - PARALLEL="$TOOLS_BIN_PATH/parallel" - PSR="$TOOLS_BIN_PATH/PoissonRecon" - VLSIFT_TO_LOWESIFT="$TOOLS_BIN_PATH/convert_vlsift_to_lowesift.pl" + ## dest base path + TOOLS_PATH="$PWD" + ## paths for the tools + TOOLS_BIN_PATH="$TOOLS_PATH/bin" + TOOLS_INC_PATH="$TOOLS_PATH/include" + TOOLS_LIB_PATH="$TOOLS_PATH/lib" + TOOLS_SRC_PATH="$TOOLS_PATH/src" + TOOLS_LOG_PATH="$TOOLS_PATH/logs" + TOOLS_PATCHED_PATH="$TOOLS_PATH/patched_files" + ## loacal dest paths + LIB_PATH="/usr/local/lib" + INC_PATH="/usr/local/include" + ## source paths + BUNDLER_PATH="$TOOLS_SRC_PATH/bundler" + CMVS_PMVS_PATH="$TOOLS_SRC_PATH/cmvs-pmvs" + CLAPACK_PATH="$TOOLS_SRC_PATH/clapack" + VLFEAT_PATH="$TOOLS_SRC_PATH/vlfeat" + PARALLEL_PATH="$TOOLS_SRC_PATH/parallel" + PSR_PATH="$TOOLS_SRC_PATH/PoissonRecon" + ## executables + EXTRACT_FOCAL="$TOOLS_BIN_PATH/extract_focal.pl" + MATCHKEYS="$TOOLS_BIN_PATH/KeyMatch" + MATCHKEYSFULL="$TOOLS_BIN_PATH/KeyMatchFull" + BUNDLER="$TOOLS_BIN_PATH/bundler" + BUNDLE2PVMS="$TOOLS_BIN_PATH/Bundle2PMVS" + CMVS="$TOOLS_BIN_PATH/cmvs" + PMVS="$TOOLS_BIN_PATH/pmvs2" + GENOPTION="$TOOLS_BIN_PATH/genOption" + VLSIFT="$TOOLS_BIN_PATH/vlsift" + PARALLEL="$TOOLS_BIN_PATH/parallel" + PSR="$TOOLS_BIN_PATH/PoissonRecon" +VLSIFT_TO_LOWESIFT="$TOOLS_BIN_PATH/convert_vlsift_to_lowesift.pl" ## get sys vars ARCH=`uname -m` @@ -83,19 +80,17 @@ echo " > installing required packages" echo " - updating" sudo apt-get update --assume-yes > "$TOOLS_LOG_PATH/apt-get_get.log" 2>&1 -## for cmvs: libjpeg-dev libboost-dev libgsl0-dev libx11-dev libxext-dev liblapack-dev -##for bundler: libzip-dev - echo " - installing" sudo apt-get install --assume-yes --install-recommends \ - build-essential cmake g++ gcc gFortran perl \ - curl wget \ - unzip \ - imagemagick jhead \ - libjpeg-dev libboost-dev libgsl0-dev libx11-dev libxext-dev liblapack-dev \ - libzip-dev \ - libcv-dev libcvaux-dev \ - > "$TOOLS_LOG_PATH/apt-get_install.log" 2>&1 + build-essential cmake g++ gcc gFortran perl ruby rubygems git \ + curl wget \ + unzip \ + imagemagick jhead \ + libjpeg-dev libboost-dev libgsl0-dev libx11-dev libxext-dev liblapack-dev \ + libzip-dev \ + > "$TOOLS_LOG_PATH/apt-get_install.log" 2>&1 + +sudo gem install parallel > /dev/null 2>&1 echo " < done - `date`" @@ -103,28 +98,27 @@ echo " < done - `date`" echo echo " > getting the sources" -git clone git://github.com/vlfeat/vlfeat.git --quiet > /dev/null 2>&1 & +git clone https://github.com/TheFrenchLeaf/CMVS-PMVS.git --quiet > /dev/null 2>&1 & ## getting all archives if not already present; save them to .tmp and rename them after download while read target source do - if [ ! -f "$target" ] ; then - echo " - getting $source" - - curl --progress-bar --location -o "$target.tmp" "$source" - mv "$target.tmp" "$target" - echo " - finished $target" - echo - else - echo " - already downloaded $source" - fi + if [ ! -f "$target" ] ; then + echo " - getting $source" + + curl --progress-bar --location -o "$target.tmp" "$source" + mv "$target.tmp" "$target" + echo " - finished $target" + echo + else + echo " - already downloaded $source" + fi done < "$TOOLS_LOG_PATH/extract_$i.log" 2>&1 & + tar xjf "$i" > "$TOOLS_LOG_PATH/extract_$i.log" 2>&1 & done for i in *.tgz *.tar.gz ; do - tar xzf "$i" > "$TOOLS_LOG_PATH/extract_$i.log" 2>&1 & + tar xzf "$i" > "$TOOLS_LOG_PATH/extract_$i.log" 2>&1 & done for i in *.zip ; do - unzip "$i" > "$TOOLS_LOG_PATH/extract_$i.log" 2>&1 & + unzip "$i" > "$TOOLS_LOG_PATH/extract_$i.log" 2>&1 & done wait -mv -f clapack-3.2.1-CMAKE "$CLAPACK_PATH" -mv -f vlfeat "$VLFEAT_PATH" -mv -f graclus1.2 "$GRACLUS_PATH" -mv -f bundler-v0.4-source "$BUNDLER_PATH" -mv -f cmvs "$CMVS_PATH" -mv -f parallel-20100922 "$PARALLEL_PATH" -mv -f PoissonRecon "$PSR_PATH" +mv -f clapack-3.2.1-CMAKE "$CLAPACK_PATH" +mv -f vlfeat-0.9.13 "$VLFEAT_PATH" +mv -f bundler-v0.4-source "$BUNDLER_PATH" +mv -f parallel-20100922 "$PARALLEL_PATH" +mv -f PoissonRecon "$PSR_PATH" +mv -f CMVS-PMVS "$CMVS_PMVS_PATH" echo " < done - `date`" @@ -161,159 +154,115 @@ echo echo " - copying patches" for file in `find $TOOLS_PATCHED_PATH -type f -print` ; do - cp $file $TOOLS_PATH/${file/$TOOLS_PATCHED_PATH/.} + cp $file $TOOLS_PATH/${file/$TOOLS_PATCHED_PATH/.} done echo " < done - `date`" + # building echo echo " - building" +echo sudo chown -R `id -u`:`id -g` * sudo chmod -R 777 * -echo " > graclus" - cd "$GRACLUS_PATH" - - if [ "$ARCH" = "i686" ]; then - sed -i "$GRACLUS_PATH/Makefile.in" -e "11c\COPTIONS = -DNUMBITS=32" - fi - - if [ "$ARCH" = "x86_64" ]; then - sed -i "$GRACLUS_PATH/Makefile.in" -e "11c\COPTIONS = -DNUMBITS=64" - fi - - echo " - cleaning graclus" - make clean > "$TOOLS_LOG_PATH/graclus_1_clean.log" 2>&1 - - echo " - building graclus" - make -j$CORES > "$TOOLS_LOG_PATH/graclus_2_build.log" 2>&1 - - mkdir "$TOOLS_INC_PATH/metisLib" - cp -f "$GRACLUS_PATH/metisLib/"*.h "$TOOLS_INC_PATH/metisLib/" - - cp -f lib* "$TOOLS_LIB_PATH/" -echo " < done - `date`" -echo echo " > poisson surface reconstruction " - cd "$PSR_PATH" - - sed -i "$PSR_PATH/Makefile" -e "21c\BIN = ./" - - echo " - building poisson surface reconstruction" - make -j$CORES > "$TOOLS_LOG_PATH/poisson_1_build.log" 2>&1 - - cp -f "$PSR_PATH/PoissonRecon" "$TOOLS_BIN_PATH/PoissonRecon" - + cd "$PSR_PATH" + + sed -i "$PSR_PATH/Makefile" -e "21c\BIN = ./" + + echo " - building poisson surface reconstruction" + make -j$CORES > "$TOOLS_LOG_PATH/poisson_1_build.log" 2>&1 + + cp -f "$PSR_PATH/PoissonRecon" "$TOOLS_BIN_PATH/PoissonRecon" + echo " < done - `date`" echo + echo " > parallel" - cd "$PARALLEL_PATH" - - echo " - configuring parallel" - ./configure > "$TOOLS_LOG_PATH/parallel_1_build.log" 2>&1 - - echo " - building paralel" - make -j$CORES > "$TOOLS_LOG_PATH/parallel_2_build.log" 2>&1 - - - cp -f src/parallel "$TOOLS_BIN_PATH/" - + cd "$PARALLEL_PATH" + + echo " - configuring parallel" + ./configure > "$TOOLS_LOG_PATH/parallel_1_build.log" 2>&1 + + echo " - building paralel" + make -j$CORES > "$TOOLS_LOG_PATH/parallel_2_build.log" 2>&1 + + cp -f src/parallel "$TOOLS_BIN_PATH/" + echo " < done - `date`" echo + echo " > clapack" - cd "$CLAPACK_PATH" - cp make.inc.example make.inc - - set +e - echo " - building clapack" - make all -j$CORES > "$TOOLS_LOG_PATH/clapack_1_build.log" 2>&1 - set -e - - echo " - installing clapack" - make lapack_install > "$TOOLS_LOG_PATH/clapack_2_install.log" 2>&1 - - sudo cp -Rf INCLUDE "$INC_PATH/clapack" - + cd "$CLAPACK_PATH" + cp make.inc.example make.inc + + set +e + echo " - building clapack" + make all -j$CORES > "$TOOLS_LOG_PATH/clapack_1_build.log" 2>&1 + set -e + + echo " - installing clapack" + make lapack_install > "$TOOLS_LOG_PATH/clapack_2_install.log" 2>&1 + + sudo cp -Rf INCLUDE "$INC_PATH/clapack" + echo " < done - `date`" echo + echo " > vlfeat" - cd "$VLFEAT_PATH" + cd "$VLFEAT_PATH" + + echo " - installing vlfeat" + + if [ "$ARCH" = "i686" ]; then + cp -f "$VLFEAT_PATH/bin/glnx32/sift" "$TOOLS_BIN_PATH/vlsift" + cp -f "$VLFEAT_PATH/bin/glnx32/libvl.so" "$TOOLS_LIB_PATH/" + fi + + if [ "$ARCH" = "x86_64" ]; then + cp -f "$VLFEAT_PATH/bin/glnxa64/sift" "$TOOLS_BIN_PATH/vlsift" + cp -f "$VLFEAT_PATH/bin/glnxa64/libvl.so" "$TOOLS_LIB_PATH/" + fi +echo " < done - `date`" +echo - echo " - cleaning vlfeat" - make clean > "$TOOLS_LOG_PATH/vlfeat_1_clean.log" 2>&1 - echo " - building vlfeat" - make > "$TOOLS_LOG_PATH/vlfeat_2_build.log" 2>&1 +echo " > cmvs/pmvs" + cd "$CMVS_PMVS_PATH/program" + + echo " - building cmvs/pmvs" - if [ "$ARCH" = "i686" ]; then - cp -f "$VLFEAT_PATH/bin/glnx32/sift" "$TOOLS_BIN_PATH/vlsift" - cp -f "$VLFEAT_PATH/bin/glnx32/libvl.so" "$TOOLS_LIB_PATH/" - fi + cmake . > "$TOOLS_LOG_PATH/cmcs-pmvs_1_cmake.log" 2>&1 + make -j > "$TOOLS_LOG_PATH/cmcs-pmvs_2_build.log" 2>&1 - if [ "$ARCH" = "x86_64" ]; then - cp -f "$VLFEAT_PATH/bin/glnxa64/sift" "$TOOLS_BIN_PATH/vlsift" - cp -f "$VLFEAT_PATH/bin/glnxa64/libvl.so" "$TOOLS_LIB_PATH/" - fi + echo " - installing cmvs/pmvs" + + cp -f "$CMVS_PMVS_PATH/program/main/cmvs" "$CMVS_PMVS_PATH/program/main/pmvs2" "$CMVS_PMVS_PATH/program/main/genOption" "$TOOLS_BIN_PATH/" echo " < done - `date`" echo -echo " > cmvs" - cd "$CMVS_PATH/program/main" - - sed -i "$CMVS_PATH/program/main/genOption.cc" -e "5c\#include \n" - sed -i "$CMVS_PATH/program/base/cmvs/bundle.cc" -e "3c\#include \n" - - sed -i "$CMVS_PATH/program/main/Makefile" -e "10c\#Your INCLUDE path (e.g., -I\/usr\/include)" - sed -i "$CMVS_PATH/program/main/Makefile" -e "11c\YOUR_INCLUDE_PATH =-I$INC_PATH -I$TOOLS_INC_PATH" - sed -i "$CMVS_PATH/program/main/Makefile" -e "13c\#Your metis directory (contains header files under graclus1.2/metisLib/)" - sed -i "$CMVS_PATH/program/main/Makefile" -e "14c\YOUR_INCLUDE_METIS_PATH = -I$TOOLS_INC_PATH/metisLib/" - sed -i "$CMVS_PATH/program/main/Makefile" -e "16c\#Your LDLIBRARY path (e.g., -L/usr/lib)" - sed -i "$CMVS_PATH/program/main/Makefile" -e "17c\YOUR_LDLIB_PATH = -L$LIB_PATH -L$TOOLS_LIB_PATH" - - if [ "$ARCH" = "i686" ]; then - sed -i "$CMVS_PATH/program/main/Makefile" -e "22c\CXXFLAGS_CMVS = -O2 -Wall -Wno-deprecated -DNUMBITS=32 \\\\" - sed -i "$CMVS_PATH/program/main/Makefile" -e '24c\ -fopenmp -DNUMBITS=32 ${OPENMP_FLAG}' - fi - - if [ "$ARCH" = "x86_64" ]; then - sed -i "$CMVS_PATH/program/main/Makefile" -e "22c\CXXFLAGS_CMVS = -O2 -Wall -Wno-deprecated -DNUMBITS=64 \\\\" - sed -i "$CMVS_PATH/program/main/Makefile" -e '24c\ -fopenmp -DNUMBITS=64 ${OPENMP_FLAG}' - fi - - echo " - cleaning cmvs" - make clean > "$TOOLS_LOG_PATH/cmvs_1_clean.log" 2>&1 - - echo " - building cmvs" - make -j$CORES > "$TOOLS_LOG_PATH/cmvs_2_build.log" 2>&1 - - echo " - make depend cmvs" - sudo make depend > "$TOOLS_LOG_PATH/cmvs_3_depend.log" 2>&1 - - cp -f "$CMVS_PATH/program/main/cmvs" "$CMVS_PATH/program/main/pmvs2" "$CMVS_PATH/program/main/genOption" "$TOOLS_BIN_PATH/" - cp -f "$CMVS_PATH/program/main/"*so* "$TOOLS_LIB_PATH/" -echo " < done - `date`" -echo echo " > bundler" - cd "$BUNDLER_PATH" + cd "$BUNDLER_PATH" - sed -i "$BUNDLER_PATH/src/BundlerApp.h" -e "620c\ BundlerApp();" + sed -i "$BUNDLER_PATH/src/BundlerApp.h" -e "620c\ BundlerApp();" - echo " - cleaning bundler" - make clean > "$TOOLS_LOG_PATH/bundler_1_clean.log" 2>&1 + echo " - cleaning bundler" + make clean > "$TOOLS_LOG_PATH/bundler_1_clean.log" 2>&1 - echo " - building bundler" - make -j $CORES > "$TOOLS_LOG_PATH/bundler_2_build.log" 2>&1 + echo " - building bundler" + make -j $CORES > "$TOOLS_LOG_PATH/bundler_2_build.log" 2>&1 - cp -f "$BUNDLER_PATH/bin/Bundle2PMVS" "$BUNDLER_PATH/bin/Bundle2Vis" "$BUNDLER_PATH/bin/KeyMatchFull" "$BUNDLER_PATH/bin/KeyMatch" "$BUNDLER_PATH/bin/bundler" "$BUNDLER_PATH/bin/RadialUndistort" "$TOOLS_BIN_PATH/" + cp -f "$BUNDLER_PATH/bin/Bundle2PMVS" "$BUNDLER_PATH/bin/Bundle2Vis" "$BUNDLER_PATH/bin/KeyMatchFull" "$BUNDLER_PATH/bin/KeyMatch" "$BUNDLER_PATH/bin/bundler" "$BUNDLER_PATH/bin/RadialUndistort" "$TOOLS_BIN_PATH/" - cp -f "$BUNDLER_PATH/lib/libANN_char.so" "$TOOLS_LIB_PATH/" + cp -f "$BUNDLER_PATH/lib/libANN_char.so" "$TOOLS_LIB_PATH/" echo " < done - `date`" echo diff --git a/patched_files/src/cmvs-pmvs/program/thirdParty/CMakeLists.txt b/patched_files/src/cmvs-pmvs/program/thirdParty/CMakeLists.txt new file mode 100644 index 000000000..63249c324 --- /dev/null +++ b/patched_files/src/cmvs-pmvs/program/thirdParty/CMakeLists.txt @@ -0,0 +1,7 @@ +ADD_SUBDIRECTORY(graclus1.2) +ADD_SUBDIRECTORY(lmfit-3.2/lib) +IF(WIN32) +ADD_SUBDIRECTORY(jpeg) +ADD_SUBDIRECTORY(gsl-1.13) +ADD_SUBDIRECTORY(clapack-3.2.1-CMAKE) +ENDIF(WIN32) diff --git a/run.pl b/run.pl old mode 100755 new mode 100644 index 39ffa18c5..d2d605fa4 --- a/run.pl +++ b/run.pl @@ -65,6 +65,8 @@ sub now { sub parseArgs { ## defaults + $args{"--match-size"} = "200"; + $args{"--resize-to"} = "1200"; $args{"--start-with"} = "resize"; @@ -545,7 +547,7 @@ sub bundler { print "\n"; print "\n - running bundler - "; now(); print "\n"; print "\n"; - + chdir($jobOptions{jobDir}); mkdir($jobOptions{jobDir}."/bundle"); diff --git a/run.rb b/run.rb new file mode 100644 index 000000000..9bc7a6f2e --- /dev/null +++ b/run.rb @@ -0,0 +1,417 @@ +#!/usr/bin/ruby + +require 'rubygems' +require 'optparse' +require 'pp' +require 'parallel' +require 'fileutils' + +#alias :puts_original :puts +# +#def puts (*args) +# puts_original(args) +# puts_original(args) +#end + +$options = {} + +optparse = OptionParser.new do|opts| + opts.banner = "Usage: run.rb [options] " + + $options[:base_path] = "." + + $options[:resize_to] = 1200 + opts.on('-r', '--resize-to int', "") do |param| + $options[:resize_to] = param.to_i + end + + $options[:match_size] = 200 + opts.on('-m', '--match-size int', "") do |param| + $options[:match_size] = param.to_i + end + + $options[:start_with] = "resize" + opts.on('', '--start-with ', "values: \"resize\", \"getKeypoints\", \"match\", \"bundler\", \"cmvs\", \"pmvs\"") do |param| + $options[:start_with] = param + end + + $options[:end_with] = "pmvs" + opts.on('', '--end-with ', "values: \"resize\", \"getKeypoints\", \"match\", \"bundler\", \"cmvs\", \"pmvs\"") do |param| + $options[:end_with] = param + end + + $options[:force_ccd] = false + opts.on('', '--force-ccd float', "") do |param| + $options[:force_ccd] = param.to_f + end + + + $options[:force_focal] = false + opts.on('', '--force-focal float', "") do |param| + $options[:force_focal] = param.to_f + end + + $options[:cmvs_max_images] = 100 + opts.on('', '--cmvs-max-images int', "") do |param| + $options[:cmvs_maxImages] = param.to_i + end + + $options[:matcher_ratio] = 0.6 + opts.on('', '--matcher-ratio float', "") do |param| + $options[:matcher_ratio] = param.to_f + end + + $options[:matcher_threshold] = 2.0 + opts.on('', '--matcher-threshold float', "") do |param| + $options[:matcher_threshold] = param.to_f + end + + $options[:pmvs_min_image_num] = 3 + opts.on('', '--pmvs-minImageNum n', "") do |param| + $options[:pmvs_minImageNum] = param.to_i + end + $options[:pmvs_wsize] = 7 + opts.on('', '--pmvs-wsize int', "") do |param| + $options[:pmvs_wsize] = param.to_i + end + $options[:pmvs_threshold] = 0.7 + opts.on('', '--pmvs-threshold float', "") do |param| + $options[:pmvs_threshold] = param.to_f + end + $options[:pmvs_csize] = 2 + opts.on('', '--pmvs-csize int', "") do |param| + $options[:pmvs_csize] = param.to_i + end + $options[:pmvs_level] = 1 + opts.on('', '--pmvs-level int', "") do |param| + $options[:pmvs_level] = param.to_i + end + + opts.on( '-h', '--help', 'Display this screen' ) do + puts opts + exit + end +end + +begin + optparse.parse! + + $options[:path_base] = ARGV[0] if ARGV.length == 1 + $options[:path_base] = File.expand_path($options[:path_base]) + + $options[:path_bin] = File.expand_path(File.dirname(__FILE__)) + "/bin" + + require "#{File.expand_path(File.dirname(__FILE__))}/ccd_defs.rb" + + begin + puts " Configuration:" + puts " bin_path = #{$options[:path_bin]}" + puts " base_path = #{$options[:path_base]}" + puts " " + puts " start_with = #{$options[:start_with]}" + puts " end_with = #{$options[:end_with]}" + puts " " + puts " resize_to = #{$options[:resize_to]}" + puts " " + puts " match_size = #{$options[:match_size]}" + puts " matcher_ratio = #{$options[:matcher_ratio]}" + puts " matcher_threshold = #{$options[:matcher_threshold]}" + puts " " + puts " cmvs_max_images = #{$options[:cmvs_max_images]}" + puts " " + puts " pmvs_threshold = #{$options[:pmvs_threshold]}" + puts " pmvs_csize = #{$options[:pmvs_csize]}" + puts " pmvs_level = #{$options[:pmvs_level]}" + puts " pmvs_min_image_num = #{$options[:pmvs_min_image_num]}" + puts " pmvs_wsize = #{$options[:pmvs_wsize]}" + puts " " + end + + file_objects = [] + + source_files = `ls -1 #{$options[:path_base]} | egrep "\.[jJ]{1}[pP]{1}[eE]{0,1}[gG]{1}"`.split("\n") + file_objects = Parallel.map(source_files) { |source_file| + file_object = Hash.new + + file_object[:file_name] = "#{source_file}" + file_object[:file_basename] = "#{source_file}".sub(/\.[^\.]+$/, "") + file_object[:path_src] = "#{$options[:path_base]}/#{source_file}" + + jhead_text = `jhead #{file_object[:path_src]}` + file_object[:jhead] = Hash.new + + jhead_text.split("\n").each { |jhead_line| + jhead_parts = jhead_line.split(/\ +:\ /) + + file_object[:jhead][jhead_parts[0].to_sym] = jhead_parts[1] if jhead_parts.length == 2 + } + + file_object[:model_id] = "#{file_object[:jhead][:'Camera make']} #{file_object[:jhead][:'Camera model']}" + + file_object[:width],file_object[:height] = [file_object[:jhead][:Resolution].split(" x ")[0].to_i, file_object[:jhead][:Resolution].split(" x ")[1].to_i] if file_object[:jhead][:Resolution] + + + file_object[:focal] = file_object[:jhead][:'Focal length'] =~ /:[\ ]*([0-9\.]*)mm/ + file_object[:ccd] = file_object[:jhead][:'CCD width'] =~ /:[\ ]*([0-9\.]*)mm/ + file_object[:ccd] = $ccd_widths[file_object[:model_id].to_sym] unless file_object[:ccd] + + file_object[:focal] = $options[:force_focal] if $options[:force_focal] + file_object[:ccd] = $options[:force_ccd] if $options[:force_ccd] + + + if file_object[:focal] && file_object[:ccd] && file_object[:width] && file_object[:height] + file_object[:focal_px] = (file_object[:focal] / file_object[:ccd]) * [[file_object[:width], file_object[:height]].max.to_f, $options[:resize_to].to_f].min + file_object + else + nil + end + } + + file_objects = file_objects.select {|file_object| file_object} + + puts "found #{file_objects.length} usable objects" + + def get_feature_count (bin_file_name) + io = File.open(bin_file_name, "rb") + feature_count = io.read(4).unpack("L") + io.close + + feature_count.first.to_i + end + + def match?(i, j, file_object_i, file_object_j, path) + pairwise_match = "#{path}/#{i}-#{j}.txt" + + !File.exists?(pairwise_match) + end + def match (i, j, file_object_i, file_object_j, path) + pairwise_match = "#{path}/.#{i}-#{j}.txt" + done_pairwise_match = "#{path}/#{i}-#{j}.txt" + + file_object_i_key = "#{path}/../#{file_object_i[:file_basename]}.key" + file_object_j_key = "#{path}/../#{file_object_j[:file_basename]}.key" + + feature_count_i = get_feature_count("#{path}/../#{file_object_i[:file_basename]}.key.bin") + feature_count_j = get_feature_count("#{path}/../#{file_object_j[:file_basename]}.key.bin") + + `touch '#{pairwise_match}' && '#{$options[:path_bin]}/KeyMatch' '#{file_object_i_key}' '#{file_object_j_key}' '#{pairwise_match}' #{$options[:matcher_ratio]} #{$options[:matcher_threshold]}` unless File.exists?(pairwise_match) + matches =`cat '#{pairwise_match}' | wc -l`.to_i + + if matches > 0 + puts "%6d / %6d - %6.2f%% matches between #{file_object_i[:file_name]}, #{file_object_j[:file_name]}" % [$prog_start + $index + 1, $prog_total, matches.to_f*100/([feature_count_i, feature_count_j].min)] + end + + FileUtils.mv(pairwise_match, done_pairwise_match) + end + + def get_keypoints_for_file?(file_object, path, size) + path_matching_base_name = "#{path}/#{file_object[:file_basename]}" + path_matching_key_bin = "#{path_matching_base_name}.key.bin" + path_matching_key_gz = "#{path_matching_base_name}.key.gz" + path_matching_jpg = "#{path_matching_base_name}.jpg" + + !(File.exists?(path_matching_jpg) && File.exists?(path_matching_key_bin) && File.exists?(path_matching_key_gz)) + end + def get_keypoints_for_file (file_object, path, size) + path_matching_base_name = "#{path}/.#{file_object[:file_basename]}" + path_matching_jpg = "#{path_matching_base_name}.jpg" + path_matching_pgm = "#{path_matching_base_name}.pgm" + path_matching_sift = "#{path_matching_base_name}.key.sift" + path_matching_key = "#{path_matching_base_name}.key" + path_matching_key_bin = "#{path_matching_base_name}.key.bin" + path_matching_key_gz = "#{path_matching_base_name}.key.gz" + + done_path_matching_base_name = "#{path}/#{file_object[:file_basename]}" + done_path_matching_key_bin = "#{done_path_matching_base_name}.key.bin" + done_path_matching_key_gz = "#{done_path_matching_base_name}.key.gz" + done_path_matching_jpg = "#{done_path_matching_base_name}.jpg" + + + `convert -format jpg -resize #{size}x#{size} -quality 100 '#{file_object[:path_src]}' '#{path_matching_jpg}'` + `convert -format pgm -resize #{size}x#{size} -quality 100 '#{file_object[:path_src]}' '#{path_matching_pgm}'` + + `'#{$options[:path_bin]}/vlsift' '#{path_matching_pgm}' -o '#{path_matching_sift}'` + + `perl '#{$options[:path_bin]}/../convert_vlsift_to_lowesift.pl' '#{path_matching_base_name}'` + + `gzip -f '#{path_matching_key}' && rm -f '#{path_matching_sift}' && rm -f '#{path_matching_pgm}'` + + feature_count = get_feature_count(path_matching_key_bin) + + puts "%6d / %6d - got #{feature_count} keypoints from #{file_object[:file_name]} @ #{size}px" % [$prog_start + $index + 1, $prog_total] + + FileUtils.mv(path_matching_key_bin , done_path_matching_key_bin ) + FileUtils.mv(path_matching_key_gz , done_path_matching_key_gz ) + FileUtils.mv(path_matching_jpg , done_path_matching_jpg ) + end + + if file_objects.length > 0 + job_options = Hash.new + + job_options[:path] = "#{$options[:path_base]}/__reconstruction-#{$options[:resize_to]}" + + Dir::mkdir(job_options[:path]) unless File.directory?(job_options[:path]) + + ### MATCHING + + job_options[:path_matching] = "#{$options[:path_base]}/__pre_matching-#{$options[:match_size]}" + job_options[:path_matchinglarge] = "#{job_options[:path]}" + job_options[:path_matching_pairs] = "#{$options[:path_base]}/__pre_matching-#{$options[:match_size]}/_pairs" + job_options[:path_matchinglarge_pairs] = "#{job_options[:path_matchinglarge]}/_pairs" + + Dir::mkdir(job_options[:path_matching]) unless File.directory?(job_options[:path_matching]) + Dir::mkdir(job_options[:path_matchinglarge]) unless File.directory?(job_options[:path_matchinglarge]) + Dir::mkdir(job_options[:path_matching_pairs]) unless File.directory?(job_options[:path_matching_pairs]) + Dir::mkdir(job_options[:path_matchinglarge_pairs]) unless File.directory?(job_options[:path_matchinglarge_pairs]) + + + + puts "\n**\n** GETTING KEYPOINTS SMALL VERSION\n** #{Time.now}\n\n" + + file_objects_todo = file_objects.select { |file_object| get_keypoints_for_file?(file_object, job_options[:path_matching], $options[:match_size]) } + + $prog_start = (file_objects.length - file_objects_todo.length) + $prog_total = file_objects.length + Parallel.each_with_index(file_objects_todo) { |file_object, $index| get_keypoints_for_file(file_object, job_options[:path_matching], $options[:match_size]) } + + puts (file_objects_todo.empty? ? "nothing to do" : "done") + + + + puts "\n**\n** MATCHING SMALL VERSION\n** #{Time.now}\n\n" + + match_indeces = Array.new + + (0...file_objects.length).inject(match_indeces) { |memo, i| + (i+1...file_objects.length).inject(memo) { |memo, j| + memo.push([i, j]) + } + } + + match_indeces_todo = match_indeces.select { |i,j| match?(i, j, file_objects[i], file_objects[j], job_options[:path_matching_pairs]) } + + $prog_start = (match_indeces.length - match_indeces_todo.length) + $prog_total = match_indeces.length + Parallel.each_with_index(match_indeces_todo) { |(i, j), $index| + match(i, j, file_objects[i], file_objects[j], job_options[:path_matching_pairs]) + } + + puts (match_indeces_todo.empty? ? "nothing to do" : "done") + + + + puts "\n**\n** GETTING KEYPOINTS BIG VERSION\n** #{Time.now}\n\n" + + file_objects_todo = file_objects.select { |file_object| get_keypoints_for_file?(file_object, job_options[:path_matchinglarge], $options[:resize_to]) } + + $prog_start = (file_objects.length - file_objects_todo.length) + $prog_total = file_objects.length + Parallel.each_with_index(file_objects_todo, :in_processes => 4) { |file_object, $index| get_keypoints_for_file(file_object, job_options[:path_matchinglarge], $options[:resize_to]) } + + puts (file_objects_todo.empty? ? "nothing to do" : "done") + + + + puts "\n**\n** MATCHING BIG VERSION\n** #{Time.now}\n\n" + + matches_files = `ls -1 #{job_options[:path_matching_pairs]} | egrep "\.txt"`.split("\n").map {|e| (e.sub("\.txt", "").split("-")).map{|n| n.to_i} } + matches_files = matches_files.select {|i,j| File.size?("#{job_options[:path_matching_pairs]}/#{i}-#{j}.txt") } + + matches_files_todo = matches_files.select { |i, j| match?(i, j, file_objects[i], file_objects[j], job_options[:path_matchinglarge_pairs]) } + + $prog_start = (matches_files.length - matches_files_todo.length) + $prog_total = matches_files.length + Parallel.each_with_index(matches_files_todo) { |(i, j), $index| match(i, j, file_objects[i], file_objects[j], job_options[:path_matchinglarge_pairs]) } + + puts (matches_files_todo.empty? ? "nothing to do" : "done") + + + + puts "\n**\n** RUNNING BUNDLER\n** #{Time.now}\n\n" + + job_options[:path_bundle] = "#{job_options[:path]}/bundle" + job_options[:path_pmvs] = "#{job_options[:path]}/pmvs" + job_options[:path_pmvs_txt] = "#{job_options[:path]}/pmvs/txt" + job_options[:path_pmvs_visualize] = "#{job_options[:path]}/pmvs/visualize" + job_options[:path_pmvs_models] = "#{job_options[:path]}/pmvs/models" + + job_options[:file_bundler_filelist] = "#{job_options[:path]}/_bundler_list.txt" + job_options[:file_bundler_options] = "#{job_options[:path]}/_bundler_options.txt" + job_options[:file_bundler_matches_init] = "#{job_options[:path]}/_bundler_matches.init.txt" + + Dir::mkdir(job_options[:path_bundle]) unless File.directory?(job_options[:path_bundle]) + Dir::mkdir(job_options[:path_pmvs]) unless File.directory?(job_options[:path_pmvs]) + Dir::mkdir(job_options[:path_pmvs_txt]) unless File.directory?(job_options[:path_pmvs_txt]) + Dir::mkdir(job_options[:path_pmvs_visualize]) unless File.directory?(job_options[:path_pmvs_visualize]) + Dir::mkdir(job_options[:path_pmvs_models]) unless File.directory?(job_options[:path_pmvs_models]) + +# files_for_bundler = `ls -1 #{job_options[:path_matchinglarge]} | egrep "\.[jJ]{1}[pP]{1}[eE]{0,1}[gG]{1}$"`.split("\n").sort +# files_for_bundler = file_objects.select { |file_object| files_for_bundler.include?(file_object[:file_name]) } + + File.open(job_options[:file_bundler_filelist], 'w') do |file| + file_objects.each { |file_object| + file.puts "./%s 0 %0.5f" % ["#{file_object[:file_basename]}.jpg", file_object[:focal_px]] + } + end + + File.open(job_options[:file_bundler_options], 'w') do |file| + file.puts "--match_table _bundler_matches.init.txt" + file.puts "--output bundle.out" + file.puts "--output_all bundle_" + file.puts "--output_dir bundle" + file.puts "--variable_focal_length" + file.puts "--use_focal_estimate" + file.puts "--constrain_focal" + file.puts "--constrain_focal_weight 0.01" + file.puts "--estimate_distortion" + file.puts "--run_bundle" + end + + File.open(job_options[:file_bundler_matches_init], 'w') do |file| + matches_files = `ls -1 #{job_options[:path_matchinglarge_pairs]} | egrep "\.txt"`.split("\n").map {|e| (e.sub("\.txt", "").split("-")).map{|n| n.to_i} } + matches_files = matches_files.sort + + matches_files.each {|i,j| + if File.size?("#{job_options[:path_matchinglarge_pairs]}/#{i}-#{j}.txt") + file.puts "#{i} #{j}" + file.puts File.read("#{job_options[:path_matchinglarge_pairs]}/#{i}-#{j}.txt") + end + } + end + + Dir.chdir("#{job_options[:path]}") + + system("'#{$options[:path_bin]}/bundler' '#{job_options[:file_bundler_filelist]}' --options_file '#{job_options[:file_bundler_options]}'") + + puts "\n**\n** RUNNING BUNDLE2PMVS\n** #{Time.now}\n\n" + system("'#{$options[:path_bin]}/Bundle2PMVS' '#{job_options[:file_bundler_filelist]}' 'bundle/bundle.out'") + + puts "\n**\n** RUNNING RADIALUNDISTORT\n** #{Time.now}\n\n" + system("'#{$options[:path_bin]}/RadialUndistort' '#{job_options[:file_bundler_filelist]}' 'bundle/bundle.out' 'pmvs'") + + i = 0 + + file_objects.each { |file_object| + if File.exist?("#{job_options[:path]}/pmvs/#{file_object[:file_basename]}.rd.jpg") + nr = "%08d" % [i] + + puts "#{job_options[:path]}/pmvs/#{file_object[:file_basename]}.rd.jpg", "#{job_options[:path]}/pmvs/visualize/#{nr}.jpg" + + FileUtils.mv("#{job_options[:path]}/pmvs/#{file_object[:file_basename]}.rd.jpg", "#{job_options[:path]}/pmvs/visualize/#{nr}.jpg") + FileUtils.mv("#{job_options[:path]}/pmvs/#{nr}.txt", "#{job_options[:path]}/pmvs/txt/#{nr}.txt") + + i += 1 + end + } + + puts "\n**\n** RUNNING CMVS\n** #{Time.now}\n\n" + system("'#{$options[:path_bin]}/cmvs' pmvs/ #{$options[:cmvs_max_images]} #{Parallel.processor_count}"); + + puts "\n**\n** GENOPTION CMVS\n** #{Time.now}\n\n" + system("'#{$options[:path_bin]}/genOption' pmvs/ #{$options[:pmvs_level]} #{$options[:pmvs_csize]} #{$options[:pmvs_threshold]} #{$options[:pmvs_wsize]} #{$options[:pmvs_min_image_num]} #{Parallel.processor_count}"); + + puts "\n**\n** GENOPTION PMVS\n** #{Time.now}\n\n" + system("'#{$options[:path_bin]}/pmvs2' pmvs/ option-0000"); + + end +end \ No newline at end of file