source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/image3dstiching/Inference/SingleImgReInference.m @ 37

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

Added original make3d

File size: 5.3 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 SingleImgReInference(defaultPara, model, Img, GroundLevel, Wrlname, R, T, Scale,PostFixStr)
40
41% This funciton run the inference by loading all constrain in the model variable
42
43% Fix parameters
44% ==== General Parameters ===============
45Default.RenderFlag =  defaultPara.RenderFlag;
46[Default.VertYNuDepth Default.HoriXNuDepth] = size(model.Depth.FitDepth);
47Default.fy = 2400.2091651084;
48Default.fx = 2407.3312729885838;
49Default.Ox = 1110.7122391785729;%2272/2; %
50Default.Oy = 833.72104535435108;%1704/2; %
51Default.a_default = 2272/Default.fx; %0.70783777; %0.129; % horizontal physical size of image plane normalized to focal length (in meter)
52Default.b_default = 1704/Default.fy; %0.946584169;%0.085; % vertical physical size of image plane normalized to focal length (in meter)
53Default.Ox_default = 1-Default.Ox/2272;%0.489272914; % camera origin offset from the image center in horizontal direction
54Default.Oy_default = 1-Default.Oy/1704;%0.488886982; % camera origin offset from the image center in vertical direction
55Default.MinTriEffectPercent = 10; % 5 % higher the CoPlaner term % change to 10 make sure tri area are flat not jaggy
56Default.FarestTriDist = 1;%0.1; % unit in pixel
57
58% TriCountSupThre depends on the total number of model.Constrain.RayMatche
59Default.TriCountSupThre = size(model.Constrain.RayMatche,1)*0.1;
60% ========================================== First Model
61
62    % highly changable
63    Default.OutPutFolder = [ defaultPara.OutPutFolder Img '/'];
64    Default.ScratchFolder = Default.OutPutFolder;
65    Default.Wrlname{1} = [Wrlname '_' Img '_' PostFixStr];
66    Default.Flag.AfterInferenceStorage = 0;
67
68    AappendOpt = 0; % not append since generate seperate .wrl files
69
70        % simply constrain of the PairList matches
71    Aconstrain.RayMatched = model.Constrain.RayMatche;
72    Aconstrain.Depth_modified = model.Constrain.Depth_modified;
73    Aconstrain.SupMatched = model.Constrain.SupMatched;
74
75        % new constraian of the occlusion Matches
76    Aconstrain.OccluRayMatched = cell2mat(model.ConstrainOccluMatch.RayMatche(:));
77    Aconstrain.OccluDepth_modified = cell2mat(model.ConstrainOccluMatch.Depth_modified(:)');
78    Aconstrain.OccluSupMatched = cell2mat(model.ConstrainOccluMatch.SupMatched(:));
79       
80    ASup = model.Sup;
81    ASupOri = ASup;
82    AdepthMap = model.Depth.RawDepth; % or RawDepth
83    ARayOri = model.Ray;
84    ARayAll = ARayOri;
85    ASupNeighborTable = model.SupNeighborTable;
86    AmaskSky = model.maskSky;
87    AmaskG = model.maskG;
88    AMultiScaleSupTable = model.MultiScaleSupTable;
89   
90    Default.filename{1} = ['../' Img];
91% Calling PairReInferenceSepRender
92
93[ model.PlaneParaInfo] = PlaneParaMRFTriangulateOneShot( Default, R, T, AappendOpt, ...
94                           [ Aconstrain.RayMatched; Aconstrain.OccluRayMatched],...
95                           [ Aconstrain.Depth_modified Aconstrain.OccluDepth_modified]',...
96                           [ Aconstrain.SupMatched; Aconstrain.OccluSupMatched],...
97                           [ ], [ ], [ ], [],...
98                           ASup, ASupOri, [], AdepthMap, zeros(size(AdepthMap)), ARayOri, ARayAll, ...
99                           ASupNeighborTable, [], AmaskSky, AmaskG,...
100                           'cvx_allL1Norm',1,...
101                           [], [], AMultiScaleSupTable, [], [], [], false, Scale, R, GroundLevel);% eye(3), GroundLevel might be wrong //Min check
102
103    % Important Storage the Triangulated info in local scale
104    save( [defaultPara.ScratchFolder Img '/' Wrlname '_' Img '_' PostFixStr '.mat'], 'model'); % add prefix defaultPara.Wrlname to distinguish model
105return;
Note: See TracBrowser for help on using the repository browser.