summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlab/imGradient.m
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/imGradient.m')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/imGradient.m48
1 files changed, 0 insertions, 48 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/imGradient.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/imGradient.m
deleted file mode 100755
index 23187e3..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/imGradient.m
+++ /dev/null
@@ -1,48 +0,0 @@
1% [dx, dy] = imGradient(im, edges)
2%
3% Compute the gradient of the image using smooth derivative filters
4% optimized for accurate direction estimation. Coordinate system
5% corresponds to standard pixel indexing: X axis points rightward. Y
6% axis points downward. EDGES specify boundary handling (see corrDn
7% for options).
8
9% EPS, 1997.
10% original filters from Int'l Conf Image Processing, 1994.
11% updated filters 10/2003.
12% Added to matlabPyrTools 10/2004.
13
14function [dx, dy] = imGradient(im, edges)
15
16%% 1D smoothing and differentiation kernels.
17%% See Farid & Simoncelli, IEEE Trans Image Processing, 13(4):496-508, April 2004.
18
19if (exist('edges') ~= 1)
20 edges = 'dont-compute';
21end
22
23gp = [0.037659 0.249153 0.426375 0.249153 0.037659]';
24gd = [-0.109604 -0.276691 0.000000 0.276691 0.109604]';
25
26dx = corrDn(corrDn(im, gp, edges), gd', edges);
27dy = corrDn(corrDn(im, gd, edges), gp', edges);
28
29return
30
31%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32%%% TEST:
33
34%%Make a ramp with random slope and direction
35dir = 2*pi*rand - pi;
36slope = 10*rand;
37
38sz = 32
39im = mkRamp(sz, dir, slope);
40[dx,dy] = imGradient(im);
41showIm(dx + sqrt(-1)*dy);
42
43ctr = (sz*sz/2)+sz/2;
44slopeEst = sqrt(dx(ctr).^2 + dy(ctr).^2);
45dirEst = atan2(dy(ctr), dx(ctr));
46
47[slope, slopeEst]
48[dir, dirEst]