Averaging image array values
Show older comments
I am trying to create an average filter to blur an image. I have my image array which has been padded stored in Y. Below is a section of my code trying to average individual red pixel values with its eight nearest neighbors. After running the code I get the error reading "Cannot convert double value 150 to a handle" I understand that something is wrong but I must compute the average manually in a similar fashion to the code below. (I cannot use a built in function to apply the filter.) Thanks in advance
Y = cat(3, newRed, newGreen, newBlue); %Re-stitches the RGB parts together [r,c,p]=size(Y) rows=r; columns=c; planes=p;
for i=2:r-1
for j=2:c-1
Red(1,i,j)=Y(1,mean2(i-1:i+1),mean2(j-1:j+1))
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Logical 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!