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 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 | |
---|
43 | global minDistance maxDistance |
---|
44 | minDistance = min(min(depthMap1)); |
---|
45 | maxDistance = max(max(depthMap1)); |
---|
46 | |
---|
47 | if nargin < 9, mode = 0; end |
---|
48 | if nargin < 8, trainOrTest = 1,end |
---|
49 | if nargin < 7, n = 0; end |
---|
50 | if nargin < 6, depthMap6=0; end |
---|
51 | if nargin < 5, depthMap5=0; end |
---|
52 | if nargin < 4, depthMap4=0; end |
---|
53 | if nargin < 3, depthMap3=0; end |
---|
54 | if nargin < 2, depthMap2=0; end |
---|
55 | if nargin < 1, disp('Why the **ck you called me: No Image to display.'); return; end |
---|
56 | |
---|
57 | if 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,1,1), end |
---|
82 | image( depthMap1 ); colormap( jetMap ); axis off; axis tight;%colorbar |
---|
83 | % if mode, figure, else, subplot(2,3,2), end |
---|
84 | % image( depthMap2 ); colormap( jetMap ); axis off; axis tight;%colorbar |
---|
85 | % if mode, figure, else, subplot(2,3,3), end |
---|
86 | % image( depthMap3 ); colormap( jetMap ); axis off; axis tight;%colorbar |
---|
87 | % if mode, figure, else, subplot(2,3,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 |
---|
93 | end |
---|
94 | |
---|
95 | if n ~= 0 |
---|
96 | if n > 0, figure(1000*n), |
---|
97 | else, figure(-1000*n); |
---|
98 | end |
---|
99 | n = abs(n); |
---|
100 | global imageDirectory |
---|
101 | dirList = dir([imageDirectory '*right*.jpg']); |
---|
102 | if trainOrTest == 1 |
---|
103 | actualImageNumber = floor((n-1)*4/3+1); |
---|
104 | else |
---|
105 | actualImageNumber = n*4; |
---|
106 | end |
---|
107 | imageFilename = dirList(actualImageNumber).name; |
---|
108 | A = imread([imageDirectory imageFilename]); |
---|
109 | imshow(A); |
---|
110 | end |
---|
111 | return; |
---|