[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 [Pair Matches, fail]=LoadPoseMatch(Fdir, ImgName1, ImgName2) |
---|
| 40 | |
---|
| 41 | % This function load the xxx_xxx_PoseMatch.mat proberly by tring the two order automatically |
---|
| 42 | [status1, result1] = system(['ls ' Fdir '/data/' ImgName1 '_' ImgName2 '_PoseMatch.mat']); |
---|
| 43 | [status2, result2] = system(['ls ' Fdir '/data/' ImgName2 '_' ImgName1 '_PoseMatch.mat']); |
---|
| 44 | if ~status1 |
---|
| 45 | load([Fdir '/data/' ImgName1 '_' ImgName2 '_PoseMatch.mat']); |
---|
| 46 | % Cool then just load the .mat file |
---|
| 47 | elseif ~status2 |
---|
| 48 | load([Fdir '/data/' ImgName2 '_' ImgName1 '_PoseMatch.mat']); |
---|
| 49 | % Well we just need ot switch the variable |
---|
| 50 | Pair_tmp = Pair; |
---|
| 51 | Pair.R = Pair_tmp.R'; |
---|
| 52 | Pair.T = -Pair_tmp.R'*Pair_tmp.T; |
---|
| 53 | Pair.Xim = Pair_tmp.Xim([3 4 1 2],:); |
---|
| 54 | Pair.DepthScale = Pair_tmp.DepthScale([2 1],:); |
---|
| 55 | Pair.lamda = Pair_tmp.lamda([2 1],:); |
---|
| 56 | Pair.t = Pair_tmp.t; |
---|
| 57 | |
---|
| 58 | Matches = Matches([2 1],:); |
---|
| 59 | |
---|
| 60 | else % no direct match between ImgName1 and ImgName2 |
---|
| 61 | % so change to find any match including ImgName1 and ImgName2 seperately |
---|
| 62 | % for ImgName1 |
---|
| 63 | % No used anymore ======================================================================= |
---|
| 64 | if false |
---|
| 65 | file1 = dir([Fdir '/data/']); |
---|
| 66 | for i = 1:length(file1) |
---|
| 67 | if ~isempty( strfind(file1(i).name,ImgName1)) |
---|
| 68 | |
---|
| 69 | load([Fdir '/data/' file1(i).name]); |
---|
| 70 | if strfind(file1(i).name,ImgName1) == 1 |
---|
| 71 | Pair_tmp.Xim1 = Pair.Xim(1:2,:); |
---|
| 72 | Pair_tmp.DepthScale1 = Pair.DepthScale(1); |
---|
| 73 | Pair_tmp.lamda1 = Pair.lamda(1,:); |
---|
| 74 | else |
---|
| 75 | Pair_tmp.Xim1 = Pair.Xim(3:4,:); |
---|
| 76 | Pair_tmp.DepthScale1 = Pair.DepthScale(1); |
---|
| 77 | Pair_tmp.lamda1 = Pair.lamda(1,:); |
---|
| 78 | end |
---|
| 79 | end |
---|
| 80 | end |
---|
| 81 | end |
---|
| 82 | % =================================================================================== |
---|
| 83 | |
---|
| 84 | % just simply use empty matches; |
---|
| 85 | Pair.Xim = zeros(4,0); |
---|
| 86 | Pair.DepthScale = zeros(0,2); |
---|
| 87 | Pair.lamda = zeros(2,0); |
---|
| 88 | |
---|
| 89 | Matches = zeros(2,0); |
---|
| 90 | fail = 0; |
---|
| 91 | disp('No Match been tested'); |
---|
| 92 | end |
---|
| 93 | |
---|
| 94 | return; |
---|