ex 1 p3

Moderator: Computer Vision 2

Dragon
Mausschubser
Mausschubser
Beiträge: 80
Registriert: 18. Apr 2006 15:36
Wohnort: Darmstadt

ex 1 p3

Beitrag von Dragon » 31. Okt 2008 22:02

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

C.
Mausschubser
Mausschubser
Beiträge: 64
Registriert: 29. Nov 2004 23:14

Re: ex 1 p3

Beitrag von C. » 1. Nov 2008 11:47

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.

Dragon
Mausschubser
Mausschubser
Beiträge: 80
Registriert: 18. Apr 2006 15:36
Wohnort: Darmstadt

Re: ex 1 p3

Beitrag von Dragon » 1. Nov 2008 16:45

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?

C.
Mausschubser
Mausschubser
Beiträge: 64
Registriert: 29. Nov 2004 23:14

Re: ex 1 p3

Beitrag von C. » 1. Nov 2008 18:56

No, you don't.
You wrote:
I would need one loop to iterate over the 4x4 matrix blocks.
You mean 2x2 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)?

Dragon
Mausschubser
Mausschubser
Beiträge: 80
Registriert: 18. Apr 2006 15:36
Wohnort: Darmstadt

Re: ex 1 p3

Beitrag von Dragon » 2. Nov 2008 11:38

Thank you very much !!
Now I got the right idea. :D
I was to concentrated on extracting the 2x2 blocks (of course) I think.

Antworten

Zurück zu „Computer Vision 2“