Creating a Vector from Average Image Values
Show older comments
I'm trying to create a vector of the averages of a 3x3 kernel for each layer of an image. I have the following code where I have initialized red/green/blueAvg as 0, and red/green/blue as an empty vector [ ]. I have checked the debugger and the vector values seem to be the right size, at 1x296, after only the for y = ... loop is run but once the for x = ... loop is exited, the vector value increases to 1x48544....Any ideas? (For more info: red/green/blueDoub are equal to double values at that layer (instead of uint8))
for x = 2:row-1
for y = 2:col-1
redAvg = mean(mean(redDoub(x - 1: x +1, y - 1: y + 1)));
greenAvg = mean(mean(greenDoub(x - 1: x +1, y - 1: y + 1)));
blueAvg = mean(mean(blueDoub(x - 1: x +1, y - 1: y + 1)));
red = [red redAvg];
green = [green greenAvg];
blue = [blue blueAvg];
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic 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!