I saw here and here that I can use as_strided() function for images with the depth of 1, but maybe there is a way to do that with 3 channel images. For example: I have an image of shape 128x128x3, where 3 is the depth(channels) of the image and I want to get a view into this array.
Asked
Active
Viewed 316 times
1
-
So, its `(128,128,1)` input and want to convert to `(128,128,3)` one? – Divakar Aug 17 '18 at 08:41
-
No. I have 128*128*3 image and I just want to create the view into it. – Nurislam Fazulzyanov Aug 17 '18 at 08:42
-
View as such doesn't mean anything. – Divakar Aug 17 '18 at 08:43
-
So I need to decrease the number of channels to one so I have 128x128 image? – Nurislam Fazulzyanov Aug 17 '18 at 08:45
-
1`array[...,0]`? – Divakar Aug 17 '18 at 08:46
-
Array of shape (128, 128) – Nurislam Fazulzyanov Aug 17 '18 at 08:52
-
1as_strided views of a single channel array can be adapted to work with a 3 channel image array. Is that what you want? – hpaulj Aug 17 '18 at 10:37
-
Yes, but how can I do that – Nurislam Fazulzyanov Aug 17 '18 at 10:41
-
1See https://stackoverflow.com/a/51890064/901925 – hpaulj Aug 17 '18 at 10:52
-
@hpaulj, You can post it as an answer. I'll accept it – Nurislam Fazulzyanov Aug 17 '18 at 18:10
-
1I added a 3 channel example to https://stackoverflow.com/questions/51866135/numpy-summation-with-sliding-window-is-really-slow – hpaulj Aug 17 '18 at 22:49