# [PYTHON] A story that I was addicted to at np.where

## Introduction

Since I couldn't output the index extraction of ` np.where` during image processing at all. I understood it while referring to the sample code of here ... So it's a memorandum! If you understand how to read this, you can experience aha! ?? ??

## Output of np.where! !! ??

Reference sample code and output. This time the 3rd floor tensor (\$ Width \ times Height \ times Channels = 2 \ times 3 \ times 4 \$) It is.

``````a_3d = np.arange(24).reshape(2, 3, 4)
print(a_3d)
# output
# [[[ 0  1  2  3]
#   [ 4  5  6  7]
#   [ 8  9 10 11]]
#
#  [[12 13 14 15]
#   [16 17 18 19]
#   [20 21 22 23]]]

print(np.where(a_3d < 5))
# output
# (array([0, 0, 0, 0, 0]), array([0, 0, 0, 0, 1]), array([0, 1, 2, 3, 0]))
``````

Here is the output of ``np.where (a_3d <5)`` Width`array([0, 0, 0, 0, 0]) ` Height`array([0, 0, 0, 0, 1])` Channels`array([0, 1, 2, 3, 0])` See it as a list of Width`W` Height`H` Channels`C` To access the elements of the 3rd floor tensor

``````a_3d[W][H][C] = 0
a_3d[W][H][C] = 1
a_3d[W][H][C] = 2
a_3d[W][H][C] = 3
a_3d[W][H][C] = 4
``````

It becomes. Now you can finally read the output of ``` np.where (a_3d <5)` ``!

## at the end

At first, the array was just returned, so what is this? I was wondering When you can see the shapes of rows, columns, and depths, they change to meaningful numbers. Aha experience is good ~