python mask for different size numpy array -


i have 3 numpy arrays:

 x numpy array 2 dimensions (height , width), example: 1000x2000 y numpy array 2 dimensions (height , width), example: 1000x2000 img numpy array has 3 dimensions: (height, width, rgb) example: 1000x2000x3 

i've created mask of x , y, example: mask = [y[:,:]>100, x[:,:]>50] , i've created sum of these masks:

masks = mask[0] & mask[1] 

now want select x, y , img parts depending on mask:

x_ = x[masks] y_ = y[masks] 

this works fine, want same selection img, doesn't work since 3 dimensional array. how use mask select same "fields" x , y?

have tried indexing in same way? believe should work fine.

>>> = arange(24).reshape(2,4,3) >>> mask = arange(8).reshape(2,4) < 5 >>> a[mask].shape (5, 3) 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -