Re: How to downsample a image matrix using left and right
- To: mathgroup at smc.vnet.net
- Subject: [mg100973] Re: How to downsample a image matrix using left and right
- From: Ray Koopman <koopman at sfu.ca>
- Date: Thu, 18 Jun 2009 20:49:55 -0400 (EDT)
- References: <h19i7r$p7g$1@smc.vnet.net> <h1aadj$8jb$1@smc.vnet.net>
On Jun 17, 1:44 am, Ray Koopman <koop... at sfu.ca> wrote: > On Jun 16, 6:51 pm, tenveer <ten.v... at gmail.com> wrote: >> >> HI all >> >> i am just stuck with a unique problem ... >> >> What i want is to downsample a matrix (image matrix) using two left >> and right matrices.... >> e.g if i have a 100 by 100 image matrix X what i want is to downsample >> X to 25 by 25 matrix Y using two downsampling matrices U and V which >> are on left and right respectively i.e Y=U*X*V >> >> than what will the contents of the U and V matrices. >> >> Any help will be appreciated > > If you just want to take means then you can use U = Flatten /@ > (IdentityMatrix[25] /. {1 -> {.25,.25,.25,.25}, 0 -> {0,0,0,0}}) > and V = Transpose@U. However, you can also get U.X.Transpose@U as > Nest[ Transpose[Mean/@Partition[#,4]]&, X, 2]. Map[Mean@Flatten@#&,Partition[X,{4,4}],{2}]] is better.