boofcv.factory.denoise.FactoryDenoiseWaveletAlg Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of boofcv-ip Show documentation
Show all versions of boofcv-ip Show documentation
BoofCV is an open source Java library for real-time computer vision and robotics applications.
/*
* Copyright (c) 2021, 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;
import org.jetbrains.annotations.Nullable;
/**
* 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( @Nullable 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 - 2025 Weber Informatics LLC | Privacy Policy