title: Calculating bounding box of numpy array
body: <p>I'm struggling with a simple question. I have a numpy array of the form:</p>
  
  <pre><code>[[[ 1152.07507324   430.84799194]
    [ 4107.82910156   413.95199585]
    [ 4127.64941406  2872.32006836]
    [ 1191.71643066  2906.11206055]]]
  </code></pre>
  
  <p>And I want to calculate the bounding box, meaning, I want to have the leftmost, topmost, rightmost and bottommost point.</p>
  
  <p>This should be a correct solution</p>
  
  <pre><code>[[[ 1152.07507324   413.95199585]
    [ 4127.64941406   413.95199585]
    [ 4127.64941406  2906.11206055]
    [ 1152.07507324  2906.11206055]]]
  </code></pre>
  
  <p>I developed a nasty function that does the trick, but I'm very unsatisfied with it since its not really pythonic/numpyic</p>
  
  <pre><code>def bounding_box(iterable):
      minimum_x = min(iterable[0], key=lambda x:x[0])[0]
      maximum_x = max(iterable[0], key=lambda x:x[0])[0]
      minimum_y = min(iterable[0], key=lambda x:x[1])[1]
      maximum_y = max(iterable[0], key=lambda x:x[1])[1]
  
      return numpy.array([[(minimum_x, minimum_y), (maximum_x, minimum_y), (maximum_x, maximum_y), (minimum_x, maximum_y)]], dtype=numpy.float32)
  </code></pre>
  
  <p>Do you have any idea how to optimize the function above, perhaps using numpy builtins?</p>