private void btnBackward_Click(object sender, EventArgs e) { // Create inverse transform WaveletTransform wt = new WaveletTransform(wavelet, true); // Apply inverse transform pictureBox.Image = wt.Apply(transformed); }
private void BackwardButtonOnClick(object sender, EventArgs eventArgs) { // Create inverse transform var wt = new WaveletTransform(this.wavelet, true); // Apply inverse transform this.transformImage.SetImageBitmap((Android.Graphics.Bitmap)wt.Apply(this.transformed)); }
public void WaveletTransformConstructorTest() { // Start with a grayscale image Bitmap src = Properties.Resources.lena512; // Create a wavelet filter IWavelet wavelet = new Accord.Math.Wavelets.Haar(2); WaveletTransform target = new WaveletTransform(wavelet); // Apply the transformation Bitmap dst = target.Apply(src); // Revert the transformation target.Backward = true; Bitmap org = target.Apply(dst); double[,] actual = org.ToDoubleMatrix(0); double[,] expected = src.ToDoubleMatrix(0); Assert.IsTrue(actual.IsEqual(expected, 0.102)); }
public void WaveletTransformConstructorTest() { // Start with a grayscale image Bitmap src = Accord.Imaging.Image.Clone(Resources.lena512); // Create a wavelet filter IWavelet wavelet = new Accord.Math.Wavelets.Haar(2); WaveletTransform target = new WaveletTransform(wavelet); // Apply the transformation Bitmap dst = target.Apply(src); // Revert the transformation target.Backward = true; Bitmap org = target.Apply(dst); double[,] actual; new ImageToMatrix().Convert(org, out actual); double[,] expected; new ImageToMatrix().Convert(src, out expected); Assert.IsTrue(actual.IsEqual(expected, atol: 0.102)); }
private void btnForward_Click(object sender, EventArgs e) { if ((string)cbWavelet.SelectedItem == "Haar") { wavelet = new Haar((int)numIterations.Value); } else { wavelet = new CDF97((int)numIterations.Value); } // Create forward transform WaveletTransform wt = new WaveletTransform(wavelet); // Apply forward transform transformed = wt.Apply(lenna); pictureBox.Image = transformed; }
private void ForwardButtonOnClick(object sender, System.EventArgs e) { var selectedTransform = (string)this.transformsSpinner.SelectedItem; var numIterations = Convert.ToInt32((string)this.iterationsSpinner.SelectedItem); if (selectedTransform == "Haar") { this.wavelet = new Haar(numIterations); } else { this.wavelet = new CDF97(numIterations); } // Create forward transform var wt = new WaveletTransform(this.wavelet); // Apply forward transform this.transformed = wt.Apply(this.lenna); this.transformImage.SetImageBitmap((Android.Graphics.Bitmap) this.transformed); }
public void Example1() { Bitmap image = Accord.Imaging.Image.Clone(Properties.Resources.lena512); // Create a new Haar Wavelet transform filter var wavelet = new WaveletTransform(new Haar(1)); // Apply the Wavelet transformation Bitmap result = wavelet.Apply(image); // Show on the screen //ImageBox.Show(result); Assert.IsNotNull(result); // Extract only one of the resulting images var crop = new Crop(new Rectangle(0, 0, image.Width / 2, image.Height / 2)); Bitmap quarter = crop.Apply(result); // Show on the screen //ImageBox.Show(quarter); Assert.IsNotNull(quarter); }