Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hello. I have a matrix that I want to average say 5x5 elements with no overlapping. Spent all day trying and have given up now!
Could some one point me to my error, and how to deal with padding round the outside.
Thanks
Jason
Solved! Go to Solution.
If you don't lke the way A is indexed you could divide the range variables by pxls and multiply everything in the submatrix statement by pxls.
The image you provided doesn't have a symmetrical array. You say you want an average of 5x5 region, but your image shows an array with 2 x 5x5 regions and 2 3x5 regions.
I'm a little confused.
Mike
Hi Mike, the coloured graphic was just to show that I don't want the 5x5 area to be overlapped (I only showed a portion of it). If you look at the matrix M, this is a 2048 X 2048 MATRIX.
Thanks
Jason
If you don't lke the way A is indexed you could divide the range variables by pxls and multiply everything in the submatrix statement by pxls.
Thanks Richard. Could you comment on my use of this for a real situation of trying to align an illumination source onto a sample.
Thanks
Jason
For alignment I would think what's needed is a real-time response. I can't envision myself aligning any optics by collecting some data, importing it to Mathcad, looking at the results, going back to the instrument.......
Perhaps a better solution would be to design optics that give more uniform illumination in the first place. Your illumination looks very non-uniform, and it's hard to imagine it couldn't be made better than that.