'Enumerating regions of a two-dimensional array and interacting with them
I have two two-dimensional arrays res1, res2 of size 1501x780.
I have to take slices from them, process these slices with a function and add the result to the array.
The slice on res1 starts at (0,0) and goes up to (100,100). (size 100x100) It is fixed and does not move.
The second slice of the res2 array also starts at (0,0) and ends at (100,100).
We got 2 slices and calculated the value using a certain formula, and added this value to the resulting array.
Then, with a fixed slice of res1, we change the value of res2 to (0,1),(100,101). That is, we shift the slice to the right by one pixel, leaving it at the same height. We do all the same manipulations. Then again we shift to the right by (0,2),(100,102). And so 100 elements. That is, up to (0,100)(100,200).
Then we move it down one pixel, by (1.0)(0.100).
And we also run from (1,0...100) to (1,0...200)
Shift by (2,0),(2,100) and so on until (100,100),(200,200).
slice of res1 remains fixed in all this.
As a result, the resulting two-dimensional array of elements should be obtained ...
Thank you very much Robin De Schepper for his help, I understood how to interact with slices, but I didn’t describe my task in such a way. And if you add a second cycle for j in range(100) to its function, then I don't see how I can run through the slice values I need., and how to enter the result of the calculation into a two-dimensional array, because the declaration is ahead of results = [[]] doesn't work the way I imagined.
For some reason, while I was describing my question and thinking in parallel, I came to the conclusion that this is not possible to implement.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

