Are HSV values stored as VSH in numpy array?
<p>since RGB is stored as BGR ,does the same happens in the case of HSV ?</p>

<p>I am making a project where i take input from webcam and convert it to HSV colour, to track object of a specific colour.</p>

<p>No. It's HSV mode.</p>

<p>Read the below code and its run on a sample image.</p>

<pre><code>int main()
{
    // Load your Red colored image
    cv::Mat frame = imread("test.png");

    // Split each channel
    cv::Mat rgbChannels[3];
    cv::split(frame, rgbChannels);
    cv::imshow("RGB", frame);

    // Check value of your Red, Blue and Green Channel
    double minVal, maxVal;
    // Note: Blue is first channel
    cv::minMaxLoc(rgbChannels[0], &amp;minVal, &amp;maxVal);
    std::cout &lt;&lt; "Blue: Min = " &lt;&lt; minVal &lt;&lt; ", Max = " &lt;&lt; maxVal &lt;&lt; std::endl;
    cv::minMaxLoc(rgbChannels[1], &amp;minVal, &amp;maxVal);
    std::cout &lt;&lt; "Green: Min = " &lt;&lt; minVal &lt;&lt; ", Max = " &lt;&lt; maxVal &lt;&lt; std::endl;
    cv::minMaxLoc(rgbChannels[2], &amp;minVal, &amp;maxVal);
    std::cout &lt;&lt; "Red: Min = " &lt;&lt; minVal &lt;&lt; ", Max = " &lt;&lt; maxVal &lt;&lt; std::endl;

    std::cout &lt;&lt; "*******************************" &lt;&lt; std::endl;

    cv::Mat hsv;
    cv::Mat hsvChannels[3];
    // Convert BGR image to HSV. Dont use CV_RGB2HSV.
    cv::cvtColor(frame, hsv, CV_BGR2HSV);

    // Split each channel
    cv::split(hsv, hsvChannels);

    // **Display HSV image: Note: When displaying opencv does not display image as Red image**
    // This is because imshow will just take first channel which is hue and treat it as Blue, second channel as 
    // Green, and last channel as Red.
    cv::imshow("HSV", hsv);
    cv::minMaxLoc(hsvChannels[0], &amp;minVal, &amp;maxVal);
    std::cout &lt;&lt; "Hue: Min = " &lt;&lt; minVal &lt;&lt; ", Max = " &lt;&lt; maxVal &lt;&lt; std::endl;
    cv::minMaxLoc(hsvChannels[1], &amp;minVal, &amp;maxVal);
    std::cout &lt;&lt; "Saturation: Min = " &lt;&lt; minVal &lt;&lt; ", Max = " &lt;&lt; maxVal &lt;&lt; std::endl;
    cv::minMaxLoc(hsvChannels[2], &amp;minVal, &amp;maxVal);
    std::cout &lt;&lt; "Value: Min = " &lt;&lt; minVal &lt;&lt; ", Max = " &lt;&lt; maxVal &lt;&lt; std::endl;
    waitKey(0);
    return 0;
}
</code></pre>

<p><a href="http://i.stack.imgur.com/YVZsA.png" rel="nofollow"><img src="http://i.stack.imgur.com/YVZsA.png" alt="Red Image"></a></p>

<p><strong>Output:-</strong></p>

<pre><code>Blue: Min = 36, Max = 36
Green: Min = 28, Max = 28
Red: Min = 237, Max = 237
*******************************
Hue: Min = 179, Max = 179
Saturation: Min = 225, Max = 225
Value: Min = 237, Max = 237
</code></pre>

<p><strong>Output Explanation</strong>
 Using this <a href="http://www.rapidtables.com/convert/color/rgb-to-hsv.htm" rel="nofollow">tool</a>, the RGB value (237, 28, 36) maps to HSV (358, 88.2, 92.9). Since, HUE ranges from 0 to 359, the value crosses 1-byte bound of allowing only 256 values. The HUE is divided by 2 to range from [0,179] in opencv to use less memory. The hue value 358 divided by 2 maps to 179 which is the first channel. Also, saturation and value are just normalized to scale 0-255. Thus as you can see saturation maps to second and value maps to third channel.</p>

python opencv numpy colors