How to divide color image into blocks and calculate mean and std of each block.
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
KSSV
on 15 Dec 2016
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 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!