MATLAB, for thos who have access to Image Processing Toolbox offers the function convmtx2(). Yet there are 2 issues:
- It is only available to those who purchased Image PRocessing Toolbox.
- It creates the matrix for full convolution shape only.
What I'm after is doing somthing similar for Convolution Matrices for the different shapes: full, same, valid.
Namely a function with the following form:
function [ mK ] = CreateImageConvMtx( mH, numRows, numCols, convShape )
CONVOLUTION_SHAPE_FULL = 1;
CONVOLUTION_SHAPE_SAME = 2;
CONVOLUTION_SHAPE_VALID = 3;
switch(convShape)
case(CONVOLUTION_SHAPE_FULL)
case(CONVOLUTION_SHAPE_SAME)
case(CONVOLUTION_SHAPE_VALID)
end
end
I would be happy of someone could assist with that.
Again, prefer clarity over performance.
Thank You.
3 Comments
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/439928-creating-convolution-matrix-of-2d-kernel-for-different-shapes-of-convolution#comment_660839
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/439928-creating-convolution-matrix-of-2d-kernel-for-different-shapes-of-convolution#comment_660839
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/439928-creating-convolution-matrix-of-2d-kernel-for-different-shapes-of-convolution#comment_660855
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/439928-creating-convolution-matrix-of-2d-kernel-for-different-shapes-of-convolution#comment_660855
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/439928-creating-convolution-matrix-of-2d-kernel-for-different-shapes-of-convolution#comment_660928
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/439928-creating-convolution-matrix-of-2d-kernel-for-different-shapes-of-convolution#comment_660928
Sign in to comment.