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 [ImgInfo1 ImgInfo2 Img1Index Img2Index Pair GlobalScale]=LoadDataForFindOcclu(defaultPara, WrlName, ImgName1, ImgName2, ... |
---|
40 | FlagPrestorage, PostFixStr) |
---|
41 | |
---|
42 | % This function load every data FindOccluPair needs |
---|
43 | if nargin < 6 |
---|
44 | PostFixStr = 'NonMono'; |
---|
45 | end |
---|
46 | % initalize the ImgInfo |
---|
47 | ImgInfo = []; |
---|
48 | if FlagPrestorage |
---|
49 | load([defaultPara.Fdir '/data/ImgInfo.mat']); |
---|
50 | else |
---|
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'); |
---|
58 | end |
---|
59 | [Img1Index] = ImgInfoIndexFromName(ImgInfo, ImgName1); |
---|
60 | [Img2Index] = ImgInfoIndexFromName(ImgInfo, ImgName2); |
---|
61 | ImgInfo1 = ImgInfo(Img1Index); |
---|
62 | ImgInfo2 = ImgInfo(Img2Index); |
---|
63 | ImgInfo1.ExifInfo.IDName = ImgName1; |
---|
64 | ImgInfo2.ExifInfo.IDName = ImgName2; |
---|
65 | |
---|
66 | % load xxxx_NonMono.mat |
---|
67 | load([ defaultPara.Fdir '/data/' ImgName1 '/' WrlName '_' ImgName1 '_' PostFixStr '.mat']); |
---|
68 | ImgInfo1.Model = model; |
---|
69 | load([ defaultPara.Fdir '/data/' ImgName2 '/' WrlName '_' ImgName2 '_' PostFixStr '.mat']); |
---|
70 | ImgInfo2.Model = model; |
---|
71 | |
---|
72 | % load xxx_xxx_PosrMatch.mat |
---|
73 | % Notice the order |
---|
74 | disp('Start loading Initial Pose info'); |
---|
75 | [Pair, Matches, Error] = LoadPoseMatch(defaultPara.Fdir, ImgName1, ImgName2); |
---|
76 | Pair.matches = Matches; |
---|
77 | if Error ~=0 |
---|
78 | disp('Not a good Match data, might give bad R and T'); |
---|
79 | % pause; |
---|
80 | end |
---|
81 | |
---|
82 | % load globalScale info in ModelStatus/xxx.mat |
---|
83 | load([defaultPara.Fdir '/data/ModelStatus/' WrlName '.mat']); |
---|
84 | GlobalScale =[]; |
---|
85 | Count = 0; |
---|
86 | for 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 |
---|
102 | end |
---|
103 | |
---|
104 | % Min add Aug 22th ========= |
---|
105 | if ~exist('R2') |
---|
106 | GlobalScale(2) = Pair.DepthScale(2)/Pair.DepthScale(1)*GlobalScale(1); |
---|
107 | else |
---|
108 | % MainTain Global T nad R (coordinate 1 to 2) |
---|
109 | Pair.R = R2'*R1; |
---|
110 | Pair.T = (R2'*T1 - R2'*T2); |
---|
111 | end |
---|
112 | % ========================== |
---|
113 | return; |
---|