title: How to create Single feature vector by concatenating RGB vectors in python
body: <p>I am trying to plot RGB histogram for images. I am able to do it for single image for each channel using cv2 library. Here is the code i've been using:</p>
  
  <pre><code>image =  cv2.imread("path")
  image = cv2.resize(image,(width, height)) 
  chans = cv2.split(image)
  colors = ("b", "g", "r")
  plt.figure()
  plt.title("'Flattened' Color Histogram")
  plt.xlabel("Bins")
  plt.ylabel("# of Pixels")
  features = []
  
      # loop over the image channels
  for (chan, color) in zip(chans, colors):
      # create a histogram for the current channel and
      # concatenate the resulting histograms for each
      # channel
      hist = cv2.calcHist([chan], [0], None, [256], [0, 256])
      features.extend(hist)
  
      # plot the histogram
      plt.plot(hist, color = color)
      plt.xlim([0, 256])
  </code></pre>
  
  <p>What are some efficient ways to concat RGB vector for multiple image so that I can have combined RGB Histogram for complete set of image. </p>
  
  <p>Edit:
  Is vectorizing each image and then using <code>np.hstack()</code> a correct way to concatenate image vector and Plot RGB histogram?  </p>