I have a black and white image . The image is of 280x420 pixels, and each pixel is a value within the interval [0,1]. I want to divide the picture in blocks of size (10-by-20), this will give 28x21 (= 588) blocks. ((In order to create the input vectors, each block should be written as (200-by-1) vectors, where each column of the blocks has been added to the previous one. In this way we will have 588 input vectors of size 200.)) How to do that and what code should I use?? thanks
Asked
Active
Viewed 50 times
0
-
http://de.mathworks.com/help/images/ref/im2col.html – Daniel Sep 23 '15 at 10:47
-
I think you are looking for `im2col` from `Image Processing Toolbox`. If you don't have it, use [`Efficient Implementation of im2col` and `col2im`](http://stackoverflow.com/questions/25449279/efficient-implementation-of-im2col-and-col2im). – Divakar Sep 23 '15 at 10:47
-
Is [this](http://stackoverflow.com/a/20337173/2586922) what you want? – Luis Mendo Sep 23 '15 at 10:55
-
thank you ,, so the code is like this : `A = reshape(linspace(0,1,16),[4 4])'; B = im2col(A,[2 2]); M = mean(B); newA = col2im(M,[1 1],[3 3])` Am I using right numbers??? – java Sep 23 '15 at 11:46