All Downloads are FREE. Search and download functionalities are using the official Maven repository.

boofcv.factory.denoise.FactoryDenoiseWaveletAlg Maven / Gradle / Ivy

Go to download

BoofCV is an open source Java library for real-time computer vision and robotics applications.

There is a newer version: 1.1.6
Show newest version
/*
 * Copyright (c) 2011-2017, Peter Abeles. All Rights Reserved.
 *
 * This file is part of BoofCV (http://boofcv.org).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package boofcv.factory.denoise;

import boofcv.alg.denoise.DenoiseWavelet;
import boofcv.alg.denoise.ShrinkThresholdRule;
import boofcv.alg.denoise.wavelet.DenoiseBayesShrink_F32;
import boofcv.alg.denoise.wavelet.DenoiseSureShrink_F32;
import boofcv.alg.denoise.wavelet.DenoiseVisuShrink_F32;
import boofcv.alg.denoise.wavelet.ShrinkThresholdSoft_F32;
import boofcv.struct.image.GrayF32;
import boofcv.struct.image.ImageGray;


/**
 * Factory for creating wavelet based image denoising classes.
 *
 *  @author Peter Abeles
 */
@SuppressWarnings({"unchecked"})
public class FactoryDenoiseWaveletAlg {

	/**
	 * Returns {@link DenoiseBayesShrink_F32 Bayes shrink} wavelet based image denoiser.
	 *
	 * @param rule Shrinkage rule. If null then a {@link ShrinkThresholdSoft_F32 soft threshold} rule will be used.
	 * @param imageType Type of image it will process.
	 * @return Bayes Shrink
	 */
	public static > DenoiseWavelet bayes(ShrinkThresholdRule rule , Class imageType )
	{
		if( rule == null ) {
			rule = (ShrinkThresholdRule)new ShrinkThresholdSoft_F32();
		}

		if( imageType == GrayF32.class ) {
			return (DenoiseWavelet)new DenoiseBayesShrink_F32((ShrinkThresholdRule)rule);
		} else {
			throw new IllegalArgumentException("Unsupported image type "+imageType);
		}
	}

	/**
	 * Returns {@link DenoiseSureShrink_F32 sure shrink} wavelet based image denoiser.
	 *
	 * @param imageType Type of image it will process.
	 * @return Bayes Shrink
	 */
	public static > DenoiseWavelet sure(Class imageType )
	{
		if( imageType == GrayF32.class ) {
			return (DenoiseWavelet)new DenoiseSureShrink_F32();
		} else {
			throw new IllegalArgumentException("Unsupported image type "+imageType);
		}
	}

	/**
	 * Returns {@link DenoiseVisuShrink_F32 visu shrink} wavelet based image denoiser.
	 *
	 * @param imageType Type of image it will process.
	 * @return Bayes Shrink
	 */
	public static > DenoiseWavelet visu(Class imageType )
	{
		if( imageType == GrayF32.class ) {
			return (DenoiseWavelet)new DenoiseVisuShrink_F32();
		} else {
			throw new IllegalArgumentException("Unsupported image type "+imageType);
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy