07-11-2019 04:37 AM
Dear All,
I have an 2D array and I would like to average every two values in each line.
For example an incoming array (sizeX=16,sizeY=8) will result into an outcoming array of 8x8.
I have implemented this already, but I was wondering whether you could suggest me a faster way of doing so?
In the Example below the incoming 2D array has a dimension of 768x1536 and the out coming 2D array has a dimension of 768x768.
Thanks a lot!
Solved! Go to Solution.
07-11-2019 05:50 AM
You can try something like this if you have an even number of points in each row.
mcduff
07-11-2019 08:38 AM
Yes, decimate the array and do the averaging outside the array. You can convert it to U16 at the end if you need it to be an integer.
Try and do as much as possible outside the array to reduce redundency.
07-11-2019 10:00 AM
First, two comments on your description of your problem and your code:
I think McDuff's suggestion of using Decimate and Average is a good one, but (again) you need to clarify if you are combining rows or columns (McDuff's code combines columns, of course). And don't "hide" the rounding function.
Bob Schor
07-22-2019 12:30 AM
Thanks a lot for your solution. It was very helpful.