summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlab/pointOp.m
diff options
context:
space:
mode:
authorleochanj105 <leochanj@live.unc.edu>2020-10-19 23:09:30 -0400
committerleochanj105 <leochanj@live.unc.edu>2020-10-20 02:40:39 -0400
commitf618466c25d43f3bae9e40920273bf77de1e1149 (patch)
tree460e739e2165b8a9c37a9c7ab1b60f5874903543 /SD-VBS/benchmarks/texture_synthesis/src/matlab/pointOp.m
parent47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff)
initial sd-vbs
initial sd-vbs add sd-vbs sd-vbs
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/pointOp.m')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/pointOp.m28
1 files changed, 28 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/pointOp.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/pointOp.m
new file mode 100755
index 0000000..feb7750
--- /dev/null
+++ b/SD-VBS/benchmarks/texture_synthesis/src/matlab/pointOp.m
@@ -0,0 +1,28 @@
1% RES = pointOp(IM, LUT, ORIGIN, INCREMENT, WARNINGS)
2%
3% Apply a point operation, specified by lookup table LUT, to image IM.
4% LUT must be a row or column vector, and is assumed to contain
5% (equi-spaced) samples of the function. ORIGIN specifies the
6% abscissa associated with the first sample, and INCREMENT specifies the
7% spacing between samples. Between-sample values are estimated via
8% linear interpolation. If WARNINGS is non-zero, the function prints
9% a warning whenever the lookup table is extrapolated.
10%
11% This function is much faster than MatLab's interp1, and allows
12% extrapolation beyond the lookup table domain. The drawbacks are
13% that the lookup table must be equi-spaced, and the interpolation is
14% linear.
15
16% Eero Simoncelli, 8/96.
17
18function res = pointOp(im, lut, origin, increment, warnings)
19
20%% NOTE: THIS CODE IS NOT ACTUALLY USED! (MEX FILE IS CALLED INSTEAD)
21
22%fprintf(1,'WARNING: You should compile the MEX version of "pointOp.c",\n found in the MEX subdirectory of matlabPyrTools, and put it in your matlab path. It is MUCH faster.\n');
23
24X = origin + increment*[0:size(lut(:),1)-1];
25Y = lut(:);
26
27res = reshape(interp1(X, Y, im(:), 'linear', 'extrap'),size(im));
28