diff options
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/imGradient.m')
| -rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/matlab/imGradient.m | 48 |
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 | |||
| 14 | function [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 | |||
| 19 | if (exist('edges') ~= 1) | ||
| 20 | edges = 'dont-compute'; | ||
| 21 | end | ||
| 22 | |||
| 23 | gp = [0.037659 0.249153 0.426375 0.249153 0.037659]'; | ||
| 24 | gd = [-0.109604 -0.276691 0.000000 0.276691 0.109604]'; | ||
| 25 | |||
| 26 | dx = corrDn(corrDn(im, gp, edges), gd', edges); | ||
| 27 | dy = corrDn(corrDn(im, gd, edges), gp', edges); | ||
| 28 | |||
| 29 | return | ||
| 30 | |||
| 31 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
| 32 | %%% TEST: | ||
| 33 | |||
| 34 | %%Make a ramp with random slope and direction | ||
| 35 | dir = 2*pi*rand - pi; | ||
| 36 | slope = 10*rand; | ||
| 37 | |||
| 38 | sz = 32 | ||
| 39 | im = mkRamp(sz, dir, slope); | ||
| 40 | [dx,dy] = imGradient(im); | ||
| 41 | showIm(dx + sqrt(-1)*dy); | ||
| 42 | |||
| 43 | ctr = (sz*sz/2)+sz/2; | ||
| 44 | slopeEst = sqrt(dx(ctr).^2 + dy(ctr).^2); | ||
| 45 | dirEst = atan2(dy(ctr), dx(ctr)); | ||
| 46 | |||
| 47 | [slope, slopeEst] | ||
| 48 | [dir, dirEst] | ||
