public ImageMLDataSet(IDownSample downsampler, bool findBounds, double hi, double lo) { if (((uint) lo) >= 0) { goto Label_005F; } Label_0018: if ((((uint) lo) + ((uint) lo)) >= 0) { this.x4d5aabc7a55b12ba = -1; this.x9b0739496f8b5475 = -1; } this.x20133758a5984793 = hi; this.x8948c4575e007d39 = lo; if (((uint) hi) <= uint.MaxValue) { return; } Label_005F: this.x0677e4dbe212e9d2 = downsampler; this.x103ca6537af9d723 = findBounds; if ((((uint) lo) - ((uint) findBounds)) > uint.MaxValue) { return; } goto Label_0018; }
/// <summary> /// Construct this class with the specified downsampler. /// </summary> /// <param name="downsampler">The downsampler to use.</param> /// <param name="findBounds">Should the bounds be found and clipped.</param> /// <param name="hi">The high value to normalize to.</param> /// <param name="lo">The low value to normalize to.</param> public ImageMLDataSet(IDownSample downsampler, bool findBounds, double hi, double lo) { this.downsampler = downsampler; this.findBounds = findBounds; height = -1; width = -1; this.hi = hi; this.lo = lo; }
/// <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; }
/// <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; }
private void ProcessCreateTraining() { String strWidth = GetArg("width"); String strHeight = GetArg("height"); String strType = GetArg("type"); downsampleHeight = int.Parse(strWidth); downsampleWidth = int.Parse(strHeight); if (strType.Equals("RGB")) { downsample = new RGBDownsample(); } else { downsample = new SimpleIntensityDownsample(); } training = new ImageMLDataSet(downsample, false, 1, -1); app.WriteLine("Training set created"); }
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; }