Can I get matrix operator for imfilter?
Show older comments
For example, I can get x-direction gradient of image through u_x = imfilter(u, [1 -1], 'corr','symmetric','same');
But I want to get the matrix operator corresponding to the above such that D*u = u_x Is it possible? (For example, in one dimension, D*u := [1 -1 0; 0 1 -1; 0 0 1] * [u1; u2; u3];)
(Additional question) Actually, what I want to do is to get transpose of D, i.e., D'. Is there a way to directly apply D' through imfilter?
Accepted Answer
More Answers (1)
Image Analyst
on 26 Sep 2015
0 votes
I don't know what all those dollar signs mean. And I have no idea what D is.
You know the filter because you pass it in. You passed in [1, -1] so that is your filter matrix - what you I guess you call "matrix operator".
4 Comments
jakeoung koo
on 26 Sep 2015
Edited: jakeoung koo
on 26 Sep 2015
Image Analyst
on 26 Sep 2015
And why do you think that you can get the same thing as a convolution by doing a matrix multiplication of a single matrix times the whole image?
jakeoung koo
on 27 Sep 2015
Image Analyst
on 27 Sep 2015
No, it can't. Think of it like this, in a matrix multiplication, the upper left element is the sum of the products of the first row of one matrix times the first row of the second matrix. So, that upper left element has "information" about all those pixels. In a convolution with a 3x3 window, the first element has information about every element in the 3x3 window, and information about the upper left 3x3 window of the second, larger matrix. Totally different pixels are going into the result, so they are not the same.
Perhaps you were thinking of something like convolution in the spatial or time domain is equivalent to multiplication in the frequency domain (which is true), and just got confused.
Categories
Find more on Image Filtering 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!