[37] | 1 | % * This code was used in the following articles:
|
---|
| 2 | % * [1] Learning 3-D Scene Structure from a Single Still Image,
|
---|
| 3 | % * Ashutosh Saxena, Min Sun, Andrew Y. Ng,
|
---|
| 4 | % * In ICCV workshop on 3D Representation for Recognition (3dRR-07), 2007.
|
---|
| 5 | % * (best paper)
|
---|
| 6 | % * [2] 3-D Reconstruction from Sparse Views using Monocular Vision,
|
---|
| 7 | % * Ashutosh Saxena, Min Sun, Andrew Y. Ng,
|
---|
| 8 | % * In ICCV workshop on Virtual Representations and Modeling
|
---|
| 9 | % * of Large-scale environments (VRML), 2007.
|
---|
| 10 | % * [3] 3-D Depth Reconstruction from a Single Still Image,
|
---|
| 11 | % * Ashutosh Saxena, Sung H. Chung, Andrew Y. Ng.
|
---|
| 12 | % * International Journal of Computer Vision (IJCV), Aug 2007.
|
---|
| 13 | % * [6] Learning Depth from Single Monocular Images,
|
---|
| 14 | % * Ashutosh Saxena, Sung H. Chung, Andrew Y. Ng.
|
---|
| 15 | % * In Neural Information Processing Systems (NIPS) 18, 2005.
|
---|
| 16 | % *
|
---|
| 17 | % * These articles are available at:
|
---|
| 18 | % * http://make3d.stanford.edu/publications
|
---|
| 19 | % *
|
---|
| 20 | % * We request that you cite the papers [1], [3] and [6] in any of
|
---|
| 21 | % * your reports that uses this code.
|
---|
| 22 | % * Further, if you use the code in image3dstiching/ (multiple image version),
|
---|
| 23 | % * then please cite [2].
|
---|
| 24 | % *
|
---|
| 25 | % * If you use the code in third_party/, then PLEASE CITE and follow the
|
---|
| 26 | % * LICENSE OF THE CORRESPONDING THIRD PARTY CODE.
|
---|
| 27 | % *
|
---|
| 28 | % * Finally, this code is for non-commercial use only. For further
|
---|
| 29 | % * information and to obtain a copy of the license, see
|
---|
| 30 | % *
|
---|
| 31 | % * http://make3d.stanford.edu/publications/code
|
---|
| 32 | % *
|
---|
| 33 | % * Also, the software distributed under the License is distributed on an
|
---|
| 34 | % * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
---|
| 35 | % * express or implied. See the License for the specific language governing
|
---|
| 36 | % * permissions and limitations under the License.
|
---|
| 37 | % *
|
---|
| 38 | % */
|
---|
| 39 | function [] = extractdata(); |
---|
| 40 | |
---|
| 41 | global GeneralDataFolder ScratchDataFolder LocalFolder ClusterExecutionDirectory... |
---|
| 42 | ImgFolder VertYNuPatch VertYNuDepth HoriXNuPatch HoriXNuDepth a_default b_default Ox_default Oy_default... |
---|
| 43 | Horizon_default filename batchSize NuRow_default SegVertYSize SegHoriXSize WeiBatchSize PopUpVertY PopUpHoriX taskName; |
---|
| 44 | |
---|
| 45 | %SearchFolder{1} = 'MinTest'; |
---|
| 46 | %SearchFolder{2} = 'Min96Int'; |
---|
| 47 | %SearchFolder{3} = 'SUCampus2'; |
---|
| 48 | SearchFolder{1} = 'AshOldTest'; |
---|
| 49 | SearchFolder{2} = 'AugTest'; |
---|
| 50 | SearchFolder{3} = 'MinDataOct21'; |
---|
| 51 | SearchFolder{4} = 'AshOldNewAdd'; |
---|
| 52 | %chFolder{1} = 'MinT'; |
---|
| 53 | NuFolder = 4; |
---|
| 54 | BatchSize = 10; |
---|
| 55 | |
---|
| 56 | for j = 1:NuFolder |
---|
| 57 | % if ~isempty(dir([ScratchDataFolder '/../' SearchFolder{j} '/data/TextLowResImgIndexSuperpixelSep.mat'])) |
---|
| 58 | % Text(j) = true; |
---|
| 59 | % else |
---|
| 60 | % Text(j) = false; |
---|
| 61 | % disp('Texture false'); |
---|
| 62 | % return; |
---|
| 63 | % end |
---|
| 64 | % if ~isempty(dir([ScratchDataFolder '/../' SearchFolder{j} '/Gridlaserdata'])) |
---|
| 65 | % Laserdepth(j) = true; |
---|
| 66 | % end |
---|
| 67 | if ~isempty(dir([ScratchDataFolder '/../' SearchFolder{j} '/data/feature_Abs_Whole*'])) |
---|
| 68 | Features(j) = true; |
---|
| 69 | else |
---|
| 70 | Features(j) = false; |
---|
| 71 | disp('feature false'); |
---|
| 72 | return; |
---|
| 73 | end |
---|
| 74 | end |
---|
| 75 | filename_ori= filename; |
---|
| 76 | NuPics = size(filename_ori,2) |
---|
| 77 | for i = 1: NuPics |
---|
| 78 | for j = 1 :NuFolder |
---|
| 79 | load([ScratchDataFolder '/../' SearchFolder{j} '/data/filename.mat']); |
---|
| 80 | foundFlag = 0; |
---|
| 81 | TargetNuPics = size(filename,2); |
---|
| 82 | for k = 1:TargetNuPics |
---|
| 83 | if strcmp(filename_ori{i}, filename{k}) |
---|
| 84 | filename_ori{i} |
---|
| 85 | filename{k} |
---|
| 86 | foundFlag = 1; |
---|
| 87 | break; |
---|
| 88 | end |
---|
| 89 | end |
---|
| 90 | if foundFlag |
---|
| 91 | break; |
---|
| 92 | end |
---|
| 93 | end |
---|
| 94 | if foundFlag == 0 |
---|
| 95 | disp('not found'); |
---|
| 96 | return; |
---|
| 97 | end |
---|
| 98 | j |
---|
| 99 | % find k the corresponding batch BaInd and Ind in size the Batch |
---|
| 100 | BaInd = ceil(k/BatchSize); |
---|
| 101 | Ind = k - BatchSize*(BaInd-1); |
---|
| 102 | if Features(j) |
---|
| 103 | ff = dir([ScratchDataFolder '/../' SearchFolder{j} '/data/feature_Abs_Whole' num2str(BaInd) '_*']); |
---|
| 104 | load([ScratchDataFolder '/../' SearchFolder{j} '/data/' ff(1).name]); |
---|
| 105 | end |
---|
| 106 | % load everything we need |
---|
| 107 | load([ScratchDataFolder '/../' SearchFolder{j} '/data/LowResImgIndexSuperpixelSep.mat']); |
---|
| 108 | load([ScratchDataFolder '/../' SearchFolder{j} '/data/DiffLowResImgIndexSuperpixelSep.mat']); |
---|
| 109 | load([ScratchDataFolder '/../' SearchFolder{j} '/data/MedSeg/MediResImgIndexSuperpixelSep' num2str(k) '.mat']); |
---|
| 110 | load([ScratchDataFolder '/../' SearchFolder{j} '/data/MaskGSky.mat']); |
---|
| 111 | load([ScratchDataFolder '/../' SearchFolder{j} '/data/FeatureSuperpixel.mat']); |
---|
| 112 | % depthfile = strrep(filename_ori{i},'img','depth_learned'); |
---|
| 113 | % load([ScratchDataFolder '/../' SearchFolder{j} '/_LearnDNonsky_depth/' depthfile '.mat']); |
---|
| 114 | %if Laserdepth(j) |
---|
| 115 | % depthfile = strrep(filename_ori{i},'img','depth_sph_corr'); |
---|
| 116 | % system(['cp ' ScratchDataFolder '/../' SearchFolder{j} '/Gridlaserdata/' depthfile '.mat ' ... |
---|
| 117 | % ScratchDataFolder '/Gridlaserdata/' depthfile '.mat']); |
---|
| 118 | %end |
---|
| 119 | |
---|
| 120 | GroupLowResImgIndexSuperpixelSep{i,:} = LowResImgIndexSuperpixelSep{k}; |
---|
| 121 | GroupDiffLowResImgIndexSuperpixelSep(i,:) = DiffLowResImgIndexSuperpixelSep(k,:); |
---|
| 122 | %if Text(j) |
---|
| 123 | % load([ScratchDataFolder '/../' SearchFolder{j} '/data/TextLowResImgIndexSuperpixelSep.mat']); |
---|
| 124 | % GroupTextLowResImgIndexSuperpixelSep(i,:,:) = TextLowResImgIndexSuperpixelSep(k,:,:); |
---|
| 125 | %end |
---|
| 126 | if Features(j) |
---|
| 127 | i |
---|
| 128 | i - BatchSize*(ceil(i/BatchSize)-1) |
---|
| 129 | Groupf{i - BatchSize*(ceil(i/BatchSize)-1)} = f{Ind}; |
---|
| 130 | whos('Groupf') |
---|
| 131 | clear f; |
---|
| 132 | end |
---|
| 133 | GroupmaskSky{i} = maskSky{k}; |
---|
| 134 | Groupmaskg{i} = maskg{k}; |
---|
| 135 | GroupFeatureSuperpixel{i} = FeatureSuperpixel{k}; |
---|
| 136 | |
---|
| 137 | % save Medi and depthMap first |
---|
| 138 | save([ScratchDataFolder '/data/MedSeg/MediResImgIndexSuperpixelSep' num2str(i) '.mat' ],'MediResImgIndexSuperpixelSep'); |
---|
| 139 | % save([ScratchDataFolder '/_LearnDNonsky_depth/' depthfile '.mat'],'depthMap'); |
---|
| 140 | if Features(j) && ~rem(i,BatchSize) |
---|
| 141 | f = Groupf; |
---|
| 142 | clear Groupf; |
---|
| 143 | whos('f') |
---|
| 144 | save([ScratchDataFolder '/data/feature_Abs_Whole' num2str(ceil(i/BatchSize)) '.mat' ],'f'); |
---|
| 145 | clear f; |
---|
| 146 | end |
---|
| 147 | |
---|
| 148 | LowResImgIndexSuperpixelSep = GroupLowResImgIndexSuperpixelSep; |
---|
| 149 | DiffLowResImgIndexSuperpixelSep = GroupDiffLowResImgIndexSuperpixelSep; |
---|
| 150 | maskSky = GroupmaskSky; |
---|
| 151 | maskg = Groupmaskg; |
---|
| 152 | FeatureSuperpixel = GroupFeatureSuperpixel; |
---|
| 153 | save([ScratchDataFolder '/data/LowResImgIndexSuperpixelSep.mat' ],'LowResImgIndexSuperpixelSep'); |
---|
| 154 | save([ScratchDataFolder '/data/DiffLowResImgIndexSuperpixelSep.mat' ],'DiffLowResImgIndexSuperpixelSep'); |
---|
| 155 | %if Text(j) |
---|
| 156 | % TextLowResImgIndexSuperpixelSep = GroupTextLowResImgIndexSuperpixelSep; |
---|
| 157 | % save([ScratchDataFolder '/data/TextLowResImgIndexSuperpixelSep.mat' ],'TextLowResImgIndexSuperpixelSep'); |
---|
| 158 | %end |
---|
| 159 | save([ScratchDataFolder '/data/MaskGSky.mat' ],'maskSky','maskg'); |
---|
| 160 | save([ScratchDataFolder '/data/FeatureSuperpixel.mat' ],'FeatureSuperpixel'); |
---|
| 161 | end |
---|
| 162 | LowResImgIndexSuperpixelSep = GroupLowResImgIndexSuperpixelSep; |
---|
| 163 | DiffLowResImgIndexSuperpixelSep = GroupDiffLowResImgIndexSuperpixelSep; |
---|
| 164 | maskSky = GroupmaskSky; |
---|
| 165 | maskg = Groupmaskg; |
---|
| 166 | FeatureSuperpixel = GroupFeatureSuperpixel; |
---|
| 167 | save([ScratchDataFolder '/data/LowResImgIndexSuperpixelSep.mat' ],'LowResImgIndexSuperpixelSep'); |
---|
| 168 | save([ScratchDataFolder '/data/DiffLowResImgIndexSuperpixelSep.mat' ],'DiffLowResImgIndexSuperpixelSep'); |
---|
| 169 | %if Text(j) |
---|
| 170 | % TextLowResImgIndexSuperpixelSep = GroupTextLowResImgIndexSuperpixelSep; |
---|
| 171 | % save([ScratchDataFolder '/data/TextLowResImgIndexSuperpixelSep.mat' ],'TextLowResImgIndexSuperpixelSep'); |
---|
| 172 | %end |
---|
| 173 | save([ScratchDataFolder '/data/MaskGSky.mat' ],'maskSky','maskg'); |
---|
| 174 | save([ScratchDataFolder '/data/FeatureSuperpixel.mat' ],'FeatureSuperpixel'); |
---|