Has anybody an idea how to do the downsample and upsample without loops ?
I would need one loop to iterate over the 4x4 matrix blocks.
Is there some command for handling the matrix as block matrizes?
I'm glad for any advise
ex 1 p3
Moderator: Computer Vision 2
Re: ex 1 p3
The key idea is to use "vectorization" instead of loops, a general concept to write smarter and of course faster code.
Have a look at the "vectorization guide" http://www.mathworks.com/support/tech-n ... /1109.html.
Have a look at the "vectorization guide" http://www.mathworks.com/support/tech-n ... /1109.html.
Re: ex 1 p3
thank you for your help.
I've read the whole guide. But there is no special idea I get from it how I can do this.
Like I've written before I know how to extract the blocks but there is still no idea how to iterate over them without
any loop.
Or are there some special commands to use instead of pure indexing?
I've read the whole guide. But there is no special idea I get from it how I can do this.

Like I've written before I know how to extract the blocks but there is still no idea how to iterate over them without
any loop.
Or are there some special commands to use instead of pure indexing?
Re: ex 1 p3
No, you don't.
You wrote:
You do not have to build these patches explicitly.
Have a look at http://www.mathworks.com/company/newsle ... atrix.html,
particularly at the ":" and "end" operator.
I will not give away the whole solution, but isn't the downsampled image just
the sum of four matrices of size n/2 X n/2 (plus a multiplication)?
You wrote:
You mean 2x2 blocks?I would need one loop to iterate over the 4x4 matrix blocks.
You do not have to build these patches explicitly.
Have a look at http://www.mathworks.com/company/newsle ... atrix.html,
particularly at the ":" and "end" operator.
I will not give away the whole solution, but isn't the downsampled image just
the sum of four matrices of size n/2 X n/2 (plus a multiplication)?
Re: ex 1 p3
Thank you very much !!
Now I got the right idea.
I was to concentrated on extracting the 2x2 blocks (of course) I think.
Now I got the right idea.

I was to concentrated on extracting the 2x2 blocks (of course) I think.