source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/LearningCode/Useful/displayDepthMaps.m @ 37

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

Added original make3d

File size: 4.7 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 displayDepthMaps(depthMap1, depthMap2, depthMap3, depthMap4, depthMap5, depthMap6, n, trainOrTest, mode)
40% this function displays the _Real_ values of depthmaps in the display, so
41% that you can compare them side-by-side.
42
43global minDistance maxDistance
44minDistance = min(min(depthMap1));
45maxDistance = max(max(depthMap1));
46
47if nargin < 9,  mode = 0;       end
48if nargin < 8,  trainOrTest = 1,end
49if nargin < 7,  n = 0;          end
50if nargin < 6,  depthMap6=0;    end
51if nargin < 5,  depthMap5=0;    end
52if nargin < 4,  depthMap4=0;    end
53if nargin < 3,  depthMap3=0;    end
54if nargin < 2,  depthMap2=0;    end
55if nargin < 1,  disp('Why the **ck you called me: No Image to display.');     return;    end
56
57if n >= 0
58    jetMap = jet;
59    jetMap = 1-jetMap(end:-1:1,:);
60    jetMap = jetMap(end:-1:1,:);
61
62    jetMap = imresize(jetMap, [256 3], 'bilinear');
63
64    displayNorm = size(jetMap,1);
65
66    warning off;
67    depthMap1 = uint8( displayNorm* (depthMap1 - minDistance) / (maxDistance - minDistance) );
68    depthMap2 = uint8( displayNorm* (depthMap2 - minDistance) / (maxDistance - minDistance) );
69    depthMap3 = uint8( displayNorm* (depthMap3 - minDistance) / (maxDistance - minDistance) );
70    depthMap4 = uint8( displayNorm* (depthMap4 - minDistance) / (maxDistance - minDistance) );
71    depthMap5 = uint8( displayNorm* (depthMap5 - minDistance) / (maxDistance - minDistance) );
72    depthMap6 = uint8( displayNorm* (depthMap6 - minDistance) / (maxDistance - minDistance) );
73    warning on;
74
75    %figure, hist( double(depthMap1(:) )) ;
76    %figure, hist( double(depthMap2(:) )) ;
77
78    [max( depthMap1(:) ), min( depthMap1(:) )];
79
80    if mode == 0,   figure, end
81    if mode, figure, else, subplot(1,2,1), end
82    image( depthMap1 );  colormap( jetMap );    axis off;   axis tight;%colorbar
83     if mode, figure, else, subplot(1,2,2), end
84     image( depthMap2 );  colormap( jetMap );    axis off;   axis tight;%colorbar
85%     if mode, figure, else, subplot(1,4,3), end
86%     image( depthMap3 );  colormap( jetMap );    axis off;   axis tight;%colorbar
87%     if mode, figure, else, subplot(1,4,4), end
88%     image( depthMap4 );  colormap( jetMap );    axis off;   axis tight;%colorbar
89%     if mode, figure, else, subplot(2,3,5), end
90%     image( depthMap5 );  colormap( jetMap );    axis off;   axis tight;%colorbar
91%     if mode, figure, else, subplot(2,3,6), end
92%     image( depthMap6 );  colormap( jetMap );    axis off;   axis tight;%colorbar
93end
94
95if n ~= 0
96%    if n > 0, figure(1000*n),
97%    else, figure(-1000*n);
98%    if n > 0, figure(100),
99%    else, figure(-100);
100%    end
101    n = abs(n);
102    global imageDirectory
103    dirList = dir([imageDirectory '*right*.jpg']);
104    if trainOrTest == 1
105        actualImageNumber = floor((n-1)*4/3+1);
106    else
107        actualImageNumber = n*4;
108    end
109    imageFilename = dirList(actualImageNumber).name;
110    A = imread([imageDirectory imageFilename]);
111    imshow(A);
112end
113return;
Note: See TracBrowser for help on using the repository browser.