How can we perform cumulative sums along a particular directions in matrices?
Show older comments
Hi all,
I'm actually trying to perform cumulative sums along arbitrary directions in images. For sure a simple sum can be done with the radon() function, however I need to keep track of an integral, thus requiring a cumsum(). I've tried to use imrotate() and then cumsum() but initial and final images don't have the same dimensions anymore, causing another problem.
Any help would be really appreciated!
Regards,
Simon
1 Comment
the cyclist
on 20 Jun 2013
It might be helpful to give a small example or two of inputs and expected outputs.
Accepted Answer
More Answers (1)
the cyclist
on 20 Jun 2013
Direct from the documentation:
B = cumsum(A,dim) returns the cumulative sum of the elements along dimension dim.
Does that help?
So,
A = magic(5);
B_down = cumsum(A,1); % Cumulative sum down columns (the default)
B_across = cumsum(A,2); % Cumulative sum across the rows
Categories
Find more on Get Started with Computer Vision Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!