Pure red, green and blue sit at 0, 120 and 240 degrees with full saturation and value. The orange pixel has red as its largest channel and leans halfway towards green, so its hue is about 30 degrees.
Hue, saturation and value (HSV) separate a pixel's colour from its brightness, which makes tasks like "find the red objects" much easier than in RGB. Convert an image to HSV with NumPy only.
Implement rgb_to_hsv(image).
image: array-like of shape (…,3) with integer channels in [0,255], in R, G, B order. Any leading shape is allowed (a single pixel, a row, an H×W image).
Return a float array of the same shape holding (H,S,V), rounded to 4 decimals, with H in degrees in [0,360) and S,V in [0,1].
With r,g,b the channels divided by 255, M=max(r,g,b), m=min(r,g,b) and chroma C=M−m:
When two channels share the maximum, the first case that applies in the order r,g,b is used. The computation must not emit any warnings (no division by zero).