Tile an Image using pixels
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
This is an assignment. The prof has provided us code to tile the images in Lush but since I am working in Matlab, I need to use matlab function. I would assume matlab has some function already built in for it.
This is what his function does: Takes an image of 800x600 pixels and cuts into 7500 non-overlapping, 8x8 pixel tiles. The tiles are turned into 64 dimensional vectors (by lining up pixels in raster order; left to right and top to bottom).
I am really not asking a solution for hw. If you don't believe me you can check out this page: http://www.cs.nyu.edu/~yann/2011f-G22-2565-001/index.html
So, what function in matlab can do this for me.
Thanks
4 comentarios
Image Analyst
el 14 de Nov. de 2011
The word tiling threw me - it doesn't sound like tiling like I usually hear it. So you're saying he takes a 8x8 block from a single image, reshapes it into a 1 by 64 row vector and then does this for all 7500 8x8 blocks in the image, concatenating vertically row by row, so that the resulting array is a 7500 row by 64 column matrix? Okay...so what would you use this for?
Walter Roberson
el 14 de Nov. de 2011
Use? I don't know. But glancing at the course description, I lean towards it being preparation for a NN.
Respuestas (2)
Walter Roberson
el 13 de Nov. de 2011
Insufficient information as you do not indicate what order the tiles are to be considered relative to each other, nor what the output format needs to be.
One solution:
t = mat2cell(YourImage, 8*ones(1,100), 8*ones(1,75));
Vectors = cell2mat(cellfun(@(B) reshape(B.',1,64), t.'(:),'Uniform',0));
It might be possible to skip a step or two there.
Key concept here: if you have a block of data that you need to scan by row, then the way to do that is to transpose the block so that the rows become columns, and then to reshape() in to vectors: reshape uses up the data in order of columns [and thus in order of what were originally rows.]
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!