title: How to extract the first element of a 2d array in python?
body: <p>Let's say I have a 3d array in python that looks like this [[[3, 4, 9], [5, 3, 1], [6, 4, 2]], [[2, 3, 6], [7, 9, 10], [5, 12, 4]], [[7, 5, 1], [3, 1, 2], [6, 5, 2]]]. I want to extract the first element of each entry and put them all into a 1d array like this [3, 5, 6, 2, 7, 5, 7, 3, 6]. I'm working with an hsv image where each pixel has a 3 tuple where each entry corresponds to the hue, saturation, and value. I want to extract just the hue value of each pixel and put it into a 1d array. Here's what my code looks like. </p>
  
  <pre><code>import numpy as np
  import colorsys
  from skimage import color
  from skimage.color import rgb2hsv
  
  img = cv2.imread("input.jpg", 1)
  img_hsv = color.rgb2hsv(img)
  b = []
  for i in img_hsv:
      b.append(i[0][0])
  </code></pre>
  
  <p>The problem is that the image I'm reading in is 640x480 and the shape of b is just 640 which makes me think I haven't got all the pixels in the image. So my two questions are, is my for loop correct and do I even need a for loop to do this or does python have a library that can do this? </p>