-
Notifications
You must be signed in to change notification settings - Fork 0
/
helperShowSceneImage.m
50 lines (41 loc) · 1.33 KB
/
helperShowSceneImage.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
function varargout = helperShowSceneImage(varargin)
%helperShowSceneImage Display scene image
% helperShowSceneImage(sceneName) displays the scene specified by
% sceneName on a figure in world coordinates.
%
% helperShowSceneImage(sceneImage, sceneRef) displays the scene image
% sceneImage using the spatial reference sceneRef. sceneImage must be a
% truecolor RGB image and sceneRef must be an imref2d object.
%
% hIm = helperShowSceneImage(...) returns the handle to the image object.
%
% Example - Display LargeParkingLot scene
% ---------------------------------------
% figure
% helperShowSceneImage('LargeParkingLot')
%
% See also imshow, imref2d
% Copyright 2019 The MathWorks, Inc.
narginchk(1,2);
nargoutchk(0,1);
if nargin==1
sceneName = varargin{1};
[sceneImage, sceneRef] = helperGetSceneImage(sceneName);
elseif nargin==2
sceneImage = varargin{1};
sceneRef = varargin{2};
end
validateattributes(sceneRef, {'imref2d'}, {'scalar'}, mfilename, 'sceneRef');
imageSize = sceneRef.ImageSize;
validateattributes(sceneImage, {'numeric'}, {'real','nonsparse','size',[imageSize 3]}, mfilename, 'sceneImage');
hIm = imshow(sceneImage, sceneRef);
set(gca, 'YDir', 'normal', 'Visible', 'on')
if nargin==1
title(sceneName)
end
xlabel('X (m)')
ylabel('Y (m)')
if nargout==1
varargout{1} = hIm;
end
end