Convolution on all dimensions of an image
조회 수: 3(최근 30일)
I want this code to apply on RGB (and more dimentions) too.
what needs to be modified?
function output = mean_con(kernelSize) % get a kernel size from user (for a 3*3 they enter 3)
[path,~]=imgetfile(); % get an image
kernelSize = floor(kernelSize/2); % radius
clip = I((j-kernelSize):(j+kernelSize),(i-kernelSize):(i+kernelSize));
ave = imagemean(clip); % mean filter
ave = mean2(clip);
IOut(j,i) = kernelMean;
KALYAN ACHARJYA 2021년 1월 3일
"I want this code to apply on RGB (and more dimentions) too."
One way: Try with different planes, and concatenation later, lets consider 3 D case
If you are applying an average filter with a specific window (kernel) size, you can do this in a simpler way, have you looked at the vectorization approach to solve the same.
Image Analyst 2021년 1월 3일
You can use convn() but I don't see the point of blurring across color channels (blending the color channels together). I think you'd be better off blurring each color channel independently. That's what happens in the real world when an image is blurred.