summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pixelAxes.m
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pixelAxes.m')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pixelAxes.m70
1 files changed, 0 insertions, 70 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pixelAxes.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pixelAxes.m
deleted file mode 100755
index f88210d..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pixelAxes.m
+++ /dev/null
@@ -1,70 +0,0 @@
1% [ZOOM] = pixelAxes(DIMS, ZOOM)
2%
3% Set the axes of the current plot to cover a multiple of DIMS pixels,
4% thereby eliminating screen aliasing artifacts when displaying an
5% image of size DIMS.
6%
7% ZOOM (optional, default='same') expresses the desired number of
8% samples displayed per screen pixel. It should be a scalar, which
9% will be rounded to the nearest integer, or 1 over an integer. It
10% may also be the string 'same' or 'auto', in which case the value is chosen so
11% as to produce an image closest in size to the currently displayed
12% image. It may also be the string 'full', in which case the image is
13% made as large as possible while still fitting in the window.
14
15% Eero Simoncelli, 2/97.
16
17function [zoom] = pixelAxes(dims, zoom)
18
19%------------------------------------------------------------
20%% OPTIONAL ARGS:
21
22if (exist('zoom') ~= 1)
23 zoom = 'same';
24end
25
26%% Reverse dimension order, since Figure Positions reported as (x,y).
27dims = dims(2:-1:1);
28
29%% Use MatLab's axis function to force square pixels, etc:
30axis('image');
31ax = gca;
32
33oldunits = get(ax,'Units');
34
35if strcmp(zoom,'full');
36 set(ax,'Units','normalized');
37 set(ax,'Position',[0 0 1 1]);
38 zoom = 'same';
39end
40
41set(ax,'Units','pixels');
42pos = get(ax,'Position');
43ctr = pos(1:2)+pos(3:4)/2;
44
45if (strcmp(zoom,'same') | strcmp(zoom,'auto'))
46 %% HACK: enlarge slightly so that floor doesn't round down
47 zoom = min( pos(3:4) ./ (dims - 1) );
48elseif isstr(zoom)
49 error(sprintf('Bad ZOOM argument: %s',zoom));
50end
51
52%% Force zoom value to be an integer, or inverse integer.
53if (zoom < 0.75)
54 zoom = 1/ceil(1/zoom);
55 %% Round upward, subtracting 0.5 to avoid floating point errors.
56 newsz = ceil(zoom*(dims-0.5));
57else
58 zoom = floor(zoom + 0.001); % Avoid floating pt errors
59 if (zoom < 1.5) % zoom=1
60 zoom = 1;
61 newsz = dims + 0.5;
62 else
63 newsz = zoom*(dims-1) + mod(zoom,2);
64 end
65end
66
67set(ax,'Position', [floor(ctr-newsz/2)+0.5, newsz] )
68
69% Restore units
70set(ax,'Units',oldunits);