title: splitting hue and saturation from an image
body: <p>I came across two code sample snippets of a function that claim to decompose an image and return an image with just hue, just saturation, and just value, depending on what color was passed as a parameter.</p>
  <pre><code>def break_down(image, channel):
  
      hsv = color.rgb2hsv(image)
  
      if (channel == &quot;H&quot;):
          out = hsv[:, :, 0].copy()
      if (channel == &quot;S&quot;):
          out = hsv[:, :, 1].copy()
      if (channel == &quot;V&quot;):
          out = hsv[:, :, 2].copy()
  
      return out
  </code></pre>
  <pre><code>def break_down(image, channel):
  
      hsv = color.rgb2hsv(image)
  
      out = hsv.copy()
      if (channel == &quot;H&quot;):
          out[:, :, 1] = 0
          out[:, :, 2] = 0
      if (channel == &quot;S&quot;):
          out[:, :, 0] = 0
          out[:, :, 2] = 0
      if (channel == &quot;V&quot;):
          out[:, :, 0] = 0
          out[:, :, 1] = 0
  
      return out
  </code></pre>
  <p>The first one gives output as colored images (red/green/blue). However, the second one gives outputs in black/white/grey shades. I am unable to understand which is the correct code. It's possible that none of them are accurate.</p>
  <p>Logically, what should happen when for example we show just saturation? If Hue is the color component of the image, then this returned image should be without colors right?</p>