Creating a Vector from Average Image Values
显示 更早的评论
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
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Image Arithmetic 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!