public ReconstructedImageBuilder(FastBitmap.FastBitmap target, double newImagePercentage)
 {
     _target             = target;
     _newImagePercentage = newImagePercentage;
     _oldImagePercentage = (1 - _newImagePercentage);
     _newImage           = new Bitmap(target.Width, target.Height);
 }
        private void WriteSourceAndFill(SourceAndMatch match)
        {
            FastBitmap.FastBitmap fillImage = new FastBitmap.FastBitmap(match.ReplacementImage);

            fillImage.Lock();

            ImageManipulationInfo hole = match.SourceSegment;

            for (int xOffset = 0; xOffset < hole.Width; xOffset++)
            {
                for (int yOffset = 0; yOffset < hole.Height; yOffset++)
                {
                    Color holeColor = _target.GetPixel(hole.StartX + xOffset, hole.StartY + yOffset);
                    Color fillColor = fillImage.GetPixel(xOffset, yOffset);
                    _newImage.SetPixel(hole.StartX + xOffset, hole.StartY + yOffset, GetNewColor(holeColor, fillColor));
                }
            }

            fillImage.Unlock();
        }
        public static Bitmap ToBitmap(this FlatArray2DArray <int> array)
        {
            FastBitmap.FastBitmap convolutedBitmap = new FastBitmap.FastBitmap(new Bitmap(array.Width, array.Height));
            convolutedBitmap.Lock();

            for (int y = 0; y < array.Height; y++)
            {
                for (int x = 0; x < array.Width; x++)
                {
                    // Get convolution value
                    int value = array[x, y];

                    value = value < 0 ? 0 : value;
                    value = value > 255 ? 255 : value;

                    // Set convolution value
                    convolutedBitmap.SetPixel(x, y, Color.FromArgb(value, value, value));
                }
            }

            convolutedBitmap.Unlock();

            return(convolutedBitmap.ToBitmap());
        }
 public FastBitmapToIntensity2DArrayAdapter(FastBitmap.FastBitmap source) : base(source, c => (c.R + c.G + c.B) / 3)
 {
 }
 public FastBitmapFilter2DArrayAdapter(FastBitmap.FastBitmap source, Func <Color, int> colorToIntFunc)
 {
     _source         = source;
     _colorToIntFunc = colorToIntFunc;
 }
Example #6
0
 public BitmapAndSegments(FastBitmap.FastBitmap image, IEnumerable <ImageManipulationInfo> manipulationInfos)
 {
     Image             = image;
     ManipulationInfos = manipulationInfos.ToArray();
 }