Exemple #1
0
        public static Collection <Color> GetPlotColors(ColorSensitivity sensitivity)
        {
            Collection <byte> luminanceValues = new Collection <byte>();

            switch (sensitivity)
            {
            case ColorSensitivity.Low:
                luminanceValues = new Collection <byte>(new byte[] { 76, 220, 150, 179, 100, 45, 105 });
                break;

            case ColorSensitivity.Medium:
                luminanceValues = new Collection <byte>(new byte[] { 76, 185, 220, 185, 150, 165, 179, 230, 100, 122, 45, 75, 105, 90 });
                break;

            case ColorSensitivity.High:
                luminanceValues = new Collection <byte>(new byte[] { 76, 130, 185, 200, 220, 200, 185, 167, 150, 157, 165, 172, 179, 205, 230, 165, 100, 110, 122, 83, 45, 60, 75, 90, 105, 98, 90, 83 });
                break;
            }
            Collection <Color> plotColors = new Collection <Color>();
            double             binSize    = 255.0 / luminanceValues.Count;

            for (int i = 0; i < luminanceValues.Count; ++i)
            {
                byte hue = (byte)(binSize * i);
                plotColors.Add(Algorithms.ConvertColorValue(new ColorValue(new Hsl32Value((byte)hue, 80, luminanceValues[i])), ColorMode.Rgb).Rgb32.Color);
                plotColors.Add(Algorithms.ConvertColorValue(new ColorValue(new Hsl32Value((byte)hue, 255, luminanceValues[i])), ColorMode.Rgb).Rgb32.Color);
            }
            plotColors.Add(Color.Black);
            plotColors.Add(Color.White);
            return(plotColors);
        }
Exemple #2
0
 public static void PlotColorSpectrum(PictureBox pictureBox, ColorSensitivity sensitivity, Collection <double> colorSpectrum)
 {
     _colorSpectrum = colorSpectrum;
     _plotColors    = GetPlotColors(sensitivity);
     // Make sure the PictureBox gets redrawn.
     pictureBox.Invalidate();
 }
Exemple #3
0
 public static extern IntPtr imaqLearnColor(IntPtr image, ref ROI roi, ColorSensitivity sensitivity, int saturation);