示例#1
0
        /// <summary>
        /// Downsample, and copy, the image contents into the data of this object.
        /// Calling this method has no effect on the image, as the same image can be
        /// downsampled multiple times to different resolutions.
        /// </summary>
        /// <param name="downsampler">The downsampler object to use.</param>
        /// <param name="findBounds">Should the bounds be located and cropped.</param>
        /// <param name="height">The height to downsample to.</param>
        /// <param name="width">The width to downsample to.</param>
        /// <param name="hi">The high value to normalize to.</param>
        /// <param name="lo">The low value to normalize to.</param>
        public void Downsample(IDownSample downsampler,
                               bool findBounds, int height, int width,
                               double hi, double lo)
        {
            if (findBounds)
            {
                downsampler.FindBounds();
            }
            double[] sample = downsampler.DownSample(this.Image, height,
                                                     width);

            for (int i = 0; i < sample.Length; i++)
            {
                sample[i] = OutputFieldRangeMapped.Calculate(sample[i], 0,
                                                             255, hi, lo);
            }

            this.Data = sample;
        }
        /// <summary>
        /// Downsample, and copy, the image contents into the data of this object.
        /// Calling this method has no effect on the image, as the same image can be
        /// downsampled multiple times to different resolutions.
        /// </summary>
        /// <param name="downsampler">The downsampler object to use.</param>
        /// <param name="findBounds">Should the bounds be located and cropped.</param>
        /// <param name="height">The height to downsample to.</param>
        /// <param name="width">The width to downsample to.</param>
        /// <param name="hi">The high value to normalize to.</param>
        /// <param name="lo">The low value to normalize to.</param>
        public void Downsample(IDownSample downsampler,
                               bool findBounds, int height, int width,
                               double hi, double lo)
        {
            if (findBounds)
            {
                downsampler.FindBounds();
            }
            double[] sample = downsampler.DownSample(Image, height,
                                                     width);

            for (int i = 0; i < sample.Length; i++)
            {
                sample[i] = ((sample[i] - 0)
                             / (255 - 0))
                            * (hi - lo) + lo;
            }

            Data = sample;
        }
示例#3
0
        /// <summary>
        /// Downsample, and copy, the image contents into the data of this object.
        /// Calling this method has no effect on the image, as the same image can be
        /// downsampled multiple times to different resolutions.
        /// </summary>
        /// <param name="downsampler">The downsampler object to use.</param>
        /// <param name="findBounds">Should the bounds be located and cropped.</param>
        /// <param name="height">The height to downsample to.</param>
        /// <param name="width">The width to downsample to.</param>
        /// <param name="hi">The high value to normalize to.</param>
        /// <param name="lo">The low value to normalize to.</param>
        public void Downsample(IDownSample downsampler,
                               bool findBounds, int height, int width,
                               double hi, double lo)
        {
            if (findBounds)
            {
                downsampler.FindBounds();
            }
            double[] sample = downsampler.DownSample(Image, height,
                                                     width);

            for (int i = 0; i < sample.Length; i++)
            {
                sample[i] = ((sample[i] - 0)
                             /(255 - 0))
                            *(hi - lo) + lo;
            }

            _data = sample;
        }
示例#4
0
 public void Downsample(IDownSample downsampler, bool findBounds, int height, int width, double hi, double lo)
 {
     double[] numArray;
     int num;
     if (!findBounds)
     {
         goto Label_004B;
     }
     if (0 == 0)
     {
         goto Label_0033;
     }
     Label_0006:
     if (num < numArray.Length)
     {
         goto Label_005F;
     }
     this.Data = numArray;
     if ((((uint) width) - ((uint) height)) >= 0)
     {
         return;
     }
     Label_0033:
     if (((uint) num) < 0)
     {
         goto Label_005F;
     }
     downsampler.FindBounds();
     Label_004B:
     numArray = downsampler.DownSample(this.Image, height, width);
     num = 0;
     goto Label_0006;
     Label_005F:
     numArray[num] = (((numArray[num] - 0.0) / 255.0) * (hi - lo)) + lo;
     num++;
     goto Label_0006;
 }
        /// <summary>
        /// Downsample, and copy, the image contents into the data of this object.
        /// Calling this method has no effect on the image, as the same image can be
        /// downsampled multiple times to different resolutions.
        /// </summary>
        /// <param name="downsampler">The downsampler object to use.</param>
        /// <param name="findBounds">Should the bounds be located and cropped.</param>
        /// <param name="height">The height to downsample to.</param>
        /// <param name="width">The width to downsample to.</param>
        /// <param name="hi">The high value to normalize to.</param>
        /// <param name="lo">The low value to normalize to.</param>
        public void Downsample(IDownSample downsampler,
                 bool findBounds, int height, int width,
                 double hi, double lo)
        {
            if (findBounds)
            {
                downsampler.FindBounds();
            }
            double[] sample = downsampler.DownSample(this.Image, height,
                   width);

            for (int i = 0; i < sample.Length; i++)
            {
                sample[i] = OutputFieldRangeMapped.Calculate(sample[i], 0,
                        255, hi, lo);
            }

            this.Data = sample;
        }