public IImageBuffer RenderThumbnail(IImageBuffer image)
        {
            IImageBuffer resizedImage = null;

            if (image.Width == 0 || image.Height == 0)
            {
                return(I.CreateRgbF32(0, 0));
            }

            Int2    size;
            IntRect cropRect;

            base.CalculateNewSize(new Int2(image.Width, image.Height), this.DesiredSize, out size, out cropRect);
            if (image.Width <= size.X && image.Height <= size.Y)
            {
                return(image);
            }

            resizedImage = image.ToF32().Resize(size, cropRect, ResizeFilterType.Quadratic);
            var f32image = resizedImage as I <float>;

            if (f32image != null)
            {
                return(f32image.ToU8());
            }

            return(resizedImage);
        }
Пример #2
0
 public I <float> Crop(
     IImageBuffer image,
     [InputPin(PropertyMode = PropertyMode.Default)] IntRect area
     )
 {
     return(image.ToF32().Crop(area));
 }
Пример #3
0
 public int[][] CreateHistogramm(
     IImageBuffer image,
     [InputPin(PropertyMode = PropertyMode.Default)] int bins
     )
 {
     return(image.ToF32().CreateHistogram(bins));
 }
Пример #4
0
 public I <float> Equalize(
     IImageBuffer image,
     [InputPin(PropertyMode = PropertyMode.Default)] int bins
     )
 {
     return(image.ToF32().HistogramEqualization(bins));
 }
Пример #5
0
 public I <float> Filter(
     IImageBuffer image,
     [InputPin(PropertyMode = PropertyMode.Default)] double weight
     )
 {
     return(image.ToF32().FastDoGFilter(weight));
 }
Пример #6
0
 public int[] CreateChannelHistogram(
     IImageBuffer image,
     [InputPin(PropertyMode = PropertyMode.Default)] int bins,
     [InputPin(PropertyMode = PropertyMode.Default)] int channel
     )
 {
     return(image.ToF32().CreateChannelHistogram(bins, channel));
 }
Пример #7
0
 public I <float> Equalize(
     IImageBuffer image,
     [InputPin(PropertyMode = PropertyMode.Default)] int channel,
     [InputPin(PropertyMode = PropertyMode.Default)] int bins
     )
 {
     return(image.ToF32().EqualizeSingleChannel(channel, bins));
 }
Пример #8
0
 public I <float> Filter(
     IImageBuffer image,
     [InputPin(PropertyMode = PropertyMode.Default)] double weight,
     [InputPin(PropertyMode = PropertyMode.Default)] double scaling
     )
 {
     return(image.ToF32().FastDivisionFilter(weight, scaling));
 }
Пример #9
0
        public I <float> ConvertColor(
            IImageBuffer image,
            [InputPin(PropertyMode = PropertyMode.Default)] ColorSpaceConversionType conversion
            )
        {
            var converter = GetConverter(conversion);

            return(converter(image.ToF32()));
        }
Пример #10
0
 public I <float> Filter(
     IImageBuffer image,
     [InputPin(PropertyMode = PropertyMode.Default)] int matrixSize,
     [InputPin(PropertyMode = PropertyMode.Default)] double weight,
     [InputPin(PropertyMode = PropertyMode.Default)] double scaling
     )
 {
     return(image.ToF32().DivisionOfGaussianFilter(matrixSize, weight, scaling));
 }
Пример #11
0
 public I <float> Filter(
     IImageBuffer image,
     [InputPin(PropertyMode = PropertyMode.Default)] int width,
     [InputPin(PropertyMode = PropertyMode.Default)] int height,
     [InputPin(PropertyMode = PropertyMode.Default)] ResizeFilterType resizeFilterType = ResizeFilterType.Lanczos8
     )
 {
     return(image.ToF32().Resize(new Int2(width, height), resizeFilterType));
 }
Пример #12
0
        public IEnumerable <I <float> > Split(IImageBuffer image)
        {
            var img = image.ToF32();

            for (int c = 0; c < img.Channels; ++c)
            {
                yield return(img.GetChannel(c));
            }
        }
Пример #13
0
 public I <float> EqualizeAdaptive(
     IImageBuffer image,
     [InputPin(PropertyMode = PropertyMode.Default)] int bins,
     [InputPin(PropertyMode = PropertyMode.Default)] int numTilesY,
     [InputPin(PropertyMode = PropertyMode.Default)] int numTilesX,
     [InputPin(PropertyMode = PropertyMode.Default)] double normalizedClipLimit
     )
 {
     return(image.ToF32().AdaptiveHistogramEqualization(bins, numTilesY, numTilesX, normalizedClipLimit));
 }
Пример #14
0
 public int[] CreateChannelHistogramOfRect(
     IImageBuffer image,
     [InputPin(PropertyMode = PropertyMode.Default)] int startRow,
     [InputPin(PropertyMode = PropertyMode.Default)] int startCol,
     [InputPin(PropertyMode = PropertyMode.Default)] int height,
     [InputPin(PropertyMode = PropertyMode.Default)] int width,
     [InputPin(PropertyMode = PropertyMode.Default)] int bins,
     [InputPin(PropertyMode = PropertyMode.Default)] int channel
     )
 {
     return(image.ToF32().CreateChannelHistogramOfRect(startRow, startCol, height, width, bins, channel));
 }
Пример #15
0
 public IImageBuffer Calculate(IImageBuffer image1, IImageBuffer image2)
 {
     return(I.Divide(image1.ToF32(), image2.ToF32()));
 }
Пример #16
0
 public IImageBuffer Calculate(IImageBuffer image1, IImageBuffer image2)
 {
     return(I.Multiply(image1.ToF32(), image2.ToF32()));
 }
Пример #17
0
 public I <float> ConvertDepth(IImageBuffer image)
 {
     return(image.ToF32());
 }
Пример #18
0
 public I <float> Process(IImageBuffer image, [InputPin(PropertyMode = PropertyMode.Default)] double[] stepSize)
 {
     return(image.ToF32().Quantization(stepSize));
 }
Пример #19
0
 public I <float> Scale(IImageBuffer image, [InputPin(PropertyMode = PropertyMode.Default)] Range <double>[] inRange, [InputPin(PropertyMode = PropertyMode.Default)] Range <double>[] outRange, [InputPin(PropertyMode = PropertyMode.Default)] double[] gamma = null)
 {
     return(image.ToF32().ScaleRanges(inRange, outRange, gamma));
 }
Пример #20
0
 public I <float> Filter(IImageBuffer image)
 {
     return(image.ToF32().CenteringAroundMean());
 }
Пример #21
0
 public I <float> Saturate(IImageBuffer image, [InputPin(PropertyMode = PropertyMode.Default)] double saturationFactor = 0.01, [InputPin(PropertyMode = PropertyMode.Default)] int bins = 500)
 {
     return(image.ToF32().AutoSaturate(saturationFactor, bins));
 }