How to divide color image into blocks and calculate mean and std of each block.
1 次查看(过去 30 天)
显示 更早的评论
I want to divide color image into 5 * 5 blocks. For each block I want to calculate mean and std. How to do it?
0 个评论
回答(1 个)
KSSV
2016-12-15
I = rand(100,100,3); % be your image after imread..
R = I(:,:,1) ; G = I(:,:,2) ; B = I(:,:,3) ;
I1 = reshape(I,5,5,[]) ;
G1 = reshape(G,5,5,[]) ;
B1 = reshape(B,5,5,[]) ;
But be careful that, when you reshape into 5x5 the number of columns and rows must be divisible by 5. If not, you have to either change 5x5 to desired divisible number of dimensions or take 5X5 and last one block will not have 5X5.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!