public CircleParameters(string filepath, string imagepath, int circles,
                         string colors, IColorComparison colorMode, Dithering ditherMode, AverageMode averageMode,
                         IterationInformation iterationInformation, bool allowStretch = false) :
     base(filepath, imagepath, colors, colorMode, ditherMode, averageMode, iterationInformation, allowStretch)
 {
     init(circles);
 }
 /// <summary>
 /// Generiert eine Spirale mit der angegebenen Zahl Viertelumdrehungen.
 /// </summary>
 /// <param name="bitmap">Das der Spirale zugrunde liegende Bild.</param>
 /// <param name="quarterRotations">Die Viertelumdrehungen der Spirale.</param>
 /// <param name="normalWidth">Breite eines Steins in tangentialer Richtung</param>
 /// <param name="tangentialWidth">Breite eines Steins in normaler Richtung</param>
 /// <param name="normalDistance">Abstand zwischen zwei Steinen in normaler Richtung</param>
 /// <param name="tangentialDistance">Abstand zwischen zwei Steinen in tangentialer Richtung</param>
 /// <param name="colors">Die Farben, die für dieses Objekt verwendet werden sollen.</param>
 /// <param name="colorMode">Der Interpolationsmodus, der zur Farberkennung verwendet wird.</param>
 /// <param name="averageMode">Gibt an, ob nur ein Punkt des Dominos (linke obere Ecke) oder ein Durchschnittswert aller Pixel unter dem Pfad verwendet werden soll, um die Farbe auszuwählen.</param>
 /// <param name="allowStretch">Gibt an, ob beim Berechnen die Struktur an das Bild angepasst werden darf.</param>
 /// <param name="useOnlyMyColors">Gibt an, ob die Farben nur in der angegebenen Menge verwendet werden sollen.
 /// Ist diese Eigenschaft aktiviert, kann das optische Ergebnis schlechter sein, das Objekt ist aber mit den angegeben Steinen erbaubar.</param>
 public SpiralParameters(string filepath, string bitmap, int rotations, string colors,
                         IColorComparison colorMode, Dithering ditherMode, AverageMode averageMode, IterationInformation iterationInformation, bool allowStretch = false) :
     base(filepath, bitmap, colors, colorMode, ditherMode, averageMode, iterationInformation, allowStretch)
 {
     HasProtocolDefinition = false;
     init(rotations);
 }
 public CircleParameters(int imageWidth, int imageHeight, Color background, int circles,
                         string colors, IColorComparison colorMode, Dithering ditherMode, AverageMode averageMode,
                         IterationInformation iterationInformation, bool allowStretch = false) :
     base(imageWidth, imageHeight, background, colors, colorMode, ditherMode, averageMode, iterationInformation, allowStretch)
 {
     init(circles);
 }
 public SpiralParameters(int imageWidth, int imageHeight, Color background, int rotations, string colors,
                         IColorComparison colorMode, Dithering ditherMode, AverageMode averageMode, IterationInformation iterationInformation, bool allowStretch = false)
     : base(imageWidth, imageHeight, background, colors, colorMode, ditherMode, averageMode, iterationInformation, allowStretch)
 {
     HasProtocolDefinition = false;
     init(rotations);
 }
 /// <summary>
 /// Generiert eine Struktur mit den angegebenen Wiederholparametern in x- und y-Richtung.
 /// </summary>
 /// <param name="bitmap">Das Bitmap, welchem der Struk zugrunde liegen soll.</param>
 /// <param name="definition">Die XML-Strukturdefinition, die verwendet werden soll.</param>
 /// <param name="length">Die Anzahl der Wiederholung der mittleren Zelle in x-Richtung.</param>
 /// <param name="height">Die Anzahl der Wiederholung der mittleren Zelle in y-Richtung.</param>
 /// <param name="colors">Die Farben, die für dieses Objekt verwendet werden sollen.</param>
 /// <param name="colorMode">Der Interpolationsmodus, der zur Farberkennung verwendet wird.</param>
 /// <param name="averageMode">Gibt an, ob nur ein Punkt des Dominos (linke obere Ecke) oder ein Durchschnittswert aller Pixel unter dem Pfad verwendet werden soll, um die Farbe auszuwählen.</param>
 /// <param name="allowStretch">Gibt an, ob beim Berechnen die Struktur an das Bild angepasst werden darf.</param>
 /// <param name="useOnlyMyColors">Gibt an, ob die Farben nur in der angegebenen Menge verwendet werden sollen.
 /// Ist diese Eigenschaft aktiviert, kann das optische Ergebnis schlechter sein, das Objekt ist aber mit den angegeben Steinen erbaubar.</param>
 public StructureParameters(string filepath, string imagepath, XElement definition, int length, int height, string colors,
                            IColorComparison colorMode, Dithering ditherMode, AverageMode averageMode, IterationInformation iterationInformation, bool allowStretch = false) :
     base(filepath, imagepath, colors, colorMode, ditherMode, averageMode, allowStretch, iterationInformation)
 {
     StructureDefinitionXML = definition;
     this.Length            = length;
     this.Height            = height;
 }
 public override double distance(SKColor color, IColorComparison comp, byte transparencyThreshold)
 {
     if (count == 0 || Deleted) // if count is zero or the color was deleted, don't use for computation
     {
         return(Int32.MaxValue);
     }
     return(comp.Distance(color.SKToLab(), labColor));
 }
Example #7
0
 public override double distance(Emgu.CV.Structure.Bgra color, IColorComparison comp, byte transparencyThreshold)
 {
     if (count == 0)
     {
         return(Int32.MaxValue);
     }
     return(comp.Distance(color.ToLab(), labColor));
 }
 public StructureParameters(int imageWidth, int imageHeight, Color background, XElement definition,
                            int targetSize, String colors,
                            IColorComparison colorMode, Dithering ditherMode, AverageMode averageMode, IterationInformation iterationInformation, bool allowStretch = false)
     : base(imageWidth, imageHeight, background, colors, colorMode, ditherMode, averageMode, allowStretch, iterationInformation)
 {
     StructureDefinitionXML = definition;
     TargetCount            = targetSize;
 }
Example #9
0
 public override double distance(Emgu.CV.Structure.Bgra color, IColorComparison comp, byte transparencyThreshold)
 {
     if (color.Alpha < transparencyThreshold)
     {
         return(0);
     }
     else
     {
         return(Int32.MaxValue);
     }
 }
 public FieldParameters(string filepath, string imagePath, string colors, int horizontalDistance, int horizontalSize, int verticalSize, int verticalDistance, int width, int height,
                        SkiaSharp.SKFilterQuality scalingQuality, IColorComparison colorMode, Dithering ditherMode, IterationInformation iterationInformation) : base(filepath)
 {
     ColorPath             = colors;
     HorizontalDistance    = horizontalDistance;
     HorizontalSize        = horizontalSize;
     VerticalSize          = verticalSize;
     VerticalDistance      = verticalDistance;
     Length                = width;
     Height                = height;
     PrimaryImageTreatment = new FieldReadout(this, imagePath, scalingQuality);
     PrimaryCalculation    = new FieldCalculation(colorMode, ditherMode, iterationInformation);
     HasProtocolDefinition = true;
 }
Example #11
0
        public void CalculateColor(IDominoColor[] colors, IColorComparison comp, byte TransparencyThreshold, double[] weights)
        {
            double minimum = int.MaxValue;

            for (int color = 0; color < colors.Length; color++)
            {
                double value = colors[color].distance(PrimaryDitherColor, comp, TransparencyThreshold) * weights[color];
                if (value < minimum)
                {
                    minimum     = value;
                    this._color = color;
                }
            }
        }
        public FieldParameters(int imageWidth, int imageHeight, Color background, string colors, int horizontalDistance, int horizontalSize, int verticalSize, int verticalDistance, int targetSize,
            Inter scalingMode, IColorComparison colorMode, Dithering ditherMode, IterationInformation iterationInformation)
        {

            ColorPath = colors;
            HorizontalDistance = horizontalDistance;
            HorizontalSize = horizontalSize;
            VerticalSize = verticalSize;
            VerticalDistance = verticalDistance;
            PrimaryImageTreatment = new FieldReadout(this, imageWidth, imageHeight, scalingMode);
            PrimaryImageTreatment.Background = background;
            TargetCount = targetSize;
            PrimaryCalculation = new FieldCalculation(colorMode, ditherMode, iterationInformation);
            HasProtocolDefinition = true;
        }
Example #13
0
 public abstract double distance(Emgu.CV.Structure.Bgra color, IColorComparison comp, byte transparencyThreshold);
 public CircularStructure(int imageWidth, int imageHeight, Color background, string colors,
                          IColorComparison colorMode, Dithering ditherMode, AverageMode averageMode, IterationInformation iterationInformation, bool allowStretch = false)
     : base(imageWidth, imageHeight, background, colors, colorMode, ditherMode, averageMode, allowStretch, iterationInformation)
 {
 }
 public CircularStructure(string filepath, string bitmap, string colors,
                          IColorComparison colorMode, Dithering ditherMode, AverageMode averageMode, IterationInformation iterationInformation, bool allowStretch = false)
     : base(filepath, bitmap, colors, colorMode, ditherMode, averageMode, allowStretch, iterationInformation)
 {
 }
 /// <summary>
 /// Erzeugt einen RectangleDominoProvider (Basiskonstruktor) mit den angegebenen Eigenschaften.
 /// </summary>
 /// <param name="bitmap"></param>
 /// <param name="colors"></param>
 /// <param name="comp"></param>
 /// <param name="useOnlyMyColors"></param>
 /// <param name="filter"></param>
 /// <param name="averageMode"></param>
 /// <param name="allowStretch"></param>
 protected GeneralShapesProvider(string filepath, string imagePath, string colors, IColorComparison comp, Dithering ditherMode,
                                 AverageMode averageMode, bool allowStretch, IterationInformation iterationInformation)
     : base(filepath, imagePath, comp, ditherMode, colors, iterationInformation)
 {
     this.allowStretch = allowStretch;
     average           = averageMode;
 }
 protected GeneralShapesProvider(int imageWidth, int imageHeight, Color background, string colors, IColorComparison comp, Dithering ditherMode,
                                 AverageMode averageMode, bool allowStretch, IterationInformation iterationInformation)
     : base(imageWidth, imageHeight, background, comp, ditherMode, colors, iterationInformation)
 {
     this.allowStretch = allowStretch;
     average           = averageMode;
 }
 /// <summary>
 /// Generiert eine Struktur mit der angegebenen Steineanzahl.
 /// Dabei wird versucht, das Seitenverhältnis des Bildes möglichst anzunähern.
 /// </summary>
 /// <param name="bitmap">Das Bitmap, welchem der Struktur zugrunde liegen soll.</param>
 /// <param name="definition">Die XML-Strukturdefinition, die verwendet werden soll.</param>
 /// <param name="colors">Die Farben, die für dieses Objekt verwendet werden sollen.</param>
 /// <param name="colorMode">Der Interpolationsmodus, der zur Farberkennung verwendet wird.</param>
 /// <param name="averageMode">Gibt an, ob nur ein Punkt des Dominos (linke obere Ecke) oder ein Durchschnittswert aller Pixel unter dem Pfad verwendet werden soll, um die Farbe auszuwählen.</param>
 /// <param name="allowStretch">Gibt an, ob beim Berechnen die Struktur an das Bild angepasst werden darf.</param>
 /// <param name="useOnlyMyColors">Gibt an, ob die Farben nur in der angegebenen Menge verwendet werden sollen.
 /// Ist diese Eigenschaft aktiviert, kann das optische Ergebnis schlechter sein, das Objekt ist aber mit den angegeben Steinen erbaubar.</param>
 /// <param name="targetSize">Die Zielgröße des Objekts.</param>
 public StructureParameters(string filepath, string imagepath, XElement definition, int targetSize, String colors,
                            IColorComparison colorMode, Dithering ditherMode, AverageMode averageMode, IterationInformation iterationInformation, bool allowStretch = false)
     : this(filepath, imagepath, definition, 1, 1, colors, colorMode, ditherMode, averageMode, iterationInformation, allowStretch)
 {
     TargetCount = targetSize;
 }
 public abstract double distance(SKColor color, IColorComparison comp, byte transparencyThreshold);
 public FieldParameters(string filepath, string imagePath, string colors, int horizontalDistance, int horizontalSize, int verticalSize, int verticalDistance, int targetSize,
                        SkiaSharp.SKFilterQuality scalingQuality, IColorComparison colorMode, Dithering ditherMode, IterationInformation iterationInformation)
     : this(filepath, imagePath, colors, horizontalDistance, horizontalSize, verticalSize, verticalDistance, 1, 1, scalingQuality, colorMode, ditherMode, iterationInformation)
 {
     TargetCount = targetSize;
 }