N-Dimensional smoothing spline weighting
4 views (last 30 days)
Show older comments
Is anybody aware of how to use the weighting option of the csaps function for N-dimensional matrices? As an example, I can currently call csaps to fit a smoothing spline to a 2D MxN image, I, with a command like:
x = {1:M, 1:N};
spl_smooth = csaps(x, I);
I would like to fit a smoothing spline using a weighting matrix that has the same dimensions as the input image but it does not appear that I can do this with csaps since the weighting input argument must be a cell array with the same number of entries as the first input, x. This makes the size of the weighting argument {1xM, 1xN}, whereas I want it to be MxN.
Thank you for any help you can offer,
Avery
0 Comments
Answers (2)
Unai San Miguel
on 10 Dec 2018
You can use a cell of two set of weights, one in each direction of the input
csaps({1:M, 1:N}, I, [], {wi, wj});
with wi an array of weights of size [1, M] and wj an array of weights of size [1, N]. In this way at least you have constant-slices weighting.
4 Comments
Unai San Miguel
on 11 Dec 2018
And varying the p parameters from {0.9, 0.9} as defaults to some other values?
A smoothing spline will always decrease the smoothed matrix in the trusted regions (and increase it in the untrusted ones), won't it?
I would try to reason first in 1D. If you could make up an example in 1D, that is, 1-valued, 1-variate functions maybe I could understand better your case. Not meaning I would be able to help, though...
See Also
Categories
Find more on Spline Postprocessing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!