public static PixelData GetPixelData(BGRA* pixel, Types model) { Color clr = Color.FromArgb(pixel->red, pixel->green, pixel->blue); PixelData pd = new PixelData(0, 0, 0, clr.Name); switch (model) { case Types.RGB: pd.Ch1 = pixel->red; pd.Ch2 = pixel->green; pd.Ch3 = pixel->blue; break; case Types.HSV: pd = RGBToHSV(pixel); break; default: throw new Exception("Conversion not implemented"); } pd.Name = clr.Name; return pd; }
public static PixelData RGBToHSV(BGRA* pixel) { return RGBToHSV(pixel->red, pixel->green, pixel->blue); }
private static float Min(BGRA* pixel) { return Min((float)pixel->red, (float)pixel->green, (float)pixel->blue); }