Quite hard to explain what I am looking for, I have an image represented as a m by n matrix in Matlab and I am trying to scale it down to 4×4 the same way an image would be scaled (average the nearest values)
So for example
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
0 2 3 4 9 9 7 8
0 2 3 4 9 9 7 8
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 7
1 2 3 4 5 6 7 7
Would become
1.5 3.5 5.5 7.5
1.0 3.5 9.0 7.5
1.5 3.5 5.5 7.5
1.5 3.5 5.5 7.0
Looks like
imresizegives something slightly different from what you expected. For your input data, the following will work:EDIT: Actually, it’s probably faster to do the following: