source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/image3dstiching/Occlu/LoadDataForFindOcclu.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 4.1 KB
Line 
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% */
39function [ImgInfo1 ImgInfo2 Img1Index Img2Index Pair GlobalScale]=LoadDataForFindOcclu(defaultPara, WrlName, ImgName1, ImgName2, ...
40                                                FlagPrestorage, PostFixStr)
41
42% This function load every data FindOccluPair needs
43if nargin < 6
44        PostFixStr = 'NonMono';
45end
46% initalize the ImgInfo
47ImgInfo = [];
48if FlagPrestorage
49        load([defaultPara.Fdir '/data/ImgInfo.mat']);
50else
51%       s = warning('off', 'all');
52    [ImgInfo] = ExifExtractDir(defaultPara.Fdir,ImgInfo); % Exif info
53    % 1) Extracting info
54    [ImgInfo] = ExtractGPSInfo(defaultPara, defaultPara.Fdir, ImgInfo); % GPS info
55    [ImgInfo] = ExtractRotationInfo( defaultPara, defaultPara.Fdir, ImgInfo); % IMU info
56    [ ImgInfo ] = AllXWorld(defaultPara, ImgInfo); %X_world info
57%       s = warning('on', 'all');
58end
59[Img1Index] = ImgInfoIndexFromName(ImgInfo, ImgName1);
60[Img2Index] = ImgInfoIndexFromName(ImgInfo, ImgName2);
61ImgInfo1 = ImgInfo(Img1Index);
62ImgInfo2 = ImgInfo(Img2Index);
63ImgInfo1.ExifInfo.IDName = ImgName1;
64ImgInfo2.ExifInfo.IDName = ImgName2;
65
66% load xxxx_NonMono.mat
67load([ defaultPara.Fdir '/data/' ImgName1 '/' WrlName '_' ImgName1 '_' PostFixStr '.mat']);
68ImgInfo1.Model = model;
69load([ defaultPara.Fdir '/data/' ImgName2 '/' WrlName '_' ImgName2 '_' PostFixStr '.mat']);
70ImgInfo2.Model = model;
71
72% load xxx_xxx_PosrMatch.mat
73% Notice the order
74disp('Start loading Initial Pose info');
75[Pair, Matches, Error] = LoadPoseMatch(defaultPara.Fdir, ImgName1, ImgName2);
76Pair.matches = Matches;
77if Error ~=0
78   disp('Not a good Match data, might give bad R and T');
79%    pause;
80end
81
82% load globalScale info in ModelStatus/xxx.mat
83load([defaultPara.Fdir '/data/ModelStatus/' WrlName '.mat']);
84GlobalScale =[];
85Count = 0;
86for i=1:length(ModelStatus)
87        if strcmp( ModelStatus(i).ImgName, ImgName1)
88                GlobalScale(1) = ModelStatus(i).Scale;
89                R1 = ModelStatus(i).R;
90                T1 = ModelStatus(i).T;
91        Count = Count + 1;
92        elseif strcmp( ModelStatus(i).ImgName, ImgName2)
93                GlobalScale(2) = ModelStatus(i).Scale;
94                R2 = ModelStatus(i).R;
95                T2 = ModelStatus(i).T;
96                Count = Count + 1;
97    end
98   
99        if Count == 2
100                break;
101        end
102end
103
104% Min add Aug 22th =========
105if ~exist('R2')
106    GlobalScale(2) = Pair.DepthScale(2)/Pair.DepthScale(1)*GlobalScale(1);
107else
108    % MainTain Global T nad R (coordinate 1 to 2)
109    Pair.R = R2'*R1;
110    Pair.T = (R2'*T1 - R2'*T2);
111end   
112% ==========================
113return;
Note: See TracBrowser for help on using the repository browser.