use of boofcv.struct.wavelet.WlCoef_F32 in project BoofCV by lessthanoptimal.
the class TestFactoryWaveletDaub method transform_biorthogonal_F32.
@Test
public void transform_biorthogonal_F32() {
for (BorderType type : borderTypes) {
for (int i = 5; i <= 5; i += 2) {
WaveletDescription<WlCoef_F32> desc = FactoryWaveletDaub.biorthogonal_F32(i, type);
checkEncodeDecode_F32(desc);
}
}
}
use of boofcv.struct.wavelet.WlCoef_F32 in project BoofCV by lessthanoptimal.
the class TestUtilWavelet method checkForwardLower.
private void checkForwardLower(int offsetA, int offsetB, int expected) {
WlCoef_F32 desc = new WlCoef_F32();
desc.offsetScaling = offsetA;
desc.offsetWavelet = offsetB;
assertEquals(expected, UtilWavelet.borderForwardLower(desc));
}
use of boofcv.struct.wavelet.WlCoef_F32 in project BoofCV by lessthanoptimal.
the class TestUtilWavelet method checkForwardUpper.
private void checkForwardUpper(int offsetA, int offsetB, int lengthA, int lengthB, int dataLength, int expected) {
WlCoef_F32 desc = new WlCoef_F32();
desc.offsetScaling = offsetA;
desc.offsetWavelet = offsetB;
desc.scaling = new float[lengthA];
desc.wavelet = new float[lengthB];
assertEquals(expected, UtilWavelet.borderForwardUpper(desc, dataLength));
}
use of boofcv.struct.wavelet.WlCoef_F32 in project BoofCV by lessthanoptimal.
the class WaveletTransformOps method inverse1.
/**
* <p>
* Performs a single level inverse wavelet transform. Do not pass in a whole image which has been
* transformed by a multilevel transform. Just the relevant sub-image.
* </p>
*
* @param desc Description of the inverse wavelet.
* @param input Input wavelet transform. Not modified.
* @param output Reconstruction of original image. Modified.
* @param storage Optional storage image. Should be the same size as the input image. If null then
* an image is declared internally.
* @param minValue Minimum allowed pixel value
* @param maxValue Maximum allowed pixel value
*/
public static void inverse1(WaveletDescription<WlCoef_F32> desc, GrayF32 input, GrayF32 output, GrayF32 storage, float minValue, float maxValue) {
UtilWavelet.checkShape(output, input);
WlCoef_F32 coef = desc.getForward();
if (output.width < coef.scaling.length || output.width < coef.wavelet.length)
throw new IllegalArgumentException("Wavelet is too large for provided image.");
if (output.height < coef.scaling.length || output.height < coef.wavelet.length)
throw new IllegalArgumentException("Wavelet is too large for provided image.");
storage = InputSanityCheck.checkDeclare(input, storage);
// the faster routines can only be run on images which are not too small
int minSize = Math.max(coef.getScalingLength(), coef.getWaveletLength()) * 3;
if (output.getWidth() <= minSize || output.getHeight() <= minSize) {
ImplWaveletTransformNaive.verticalInverse(desc.getBorder(), desc.getInverse(), input, storage);
ImplWaveletTransformNaive.horizontalInverse(desc.getBorder(), desc.getInverse(), storage, output);
} else {
ImplWaveletTransformInner.verticalInverse(desc.getInverse().getInnerCoefficients(), input, storage);
ImplWaveletTransformBorder.verticalInverse(desc.getBorder(), desc.getInverse(), input, storage);
ImplWaveletTransformInner.horizontalInverse(desc.getInverse().getInnerCoefficients(), storage, output);
ImplWaveletTransformBorder.horizontalInverse(desc.getBorder(), desc.getInverse(), storage, output);
}
if (minValue != -Float.MAX_VALUE && maxValue != Float.MAX_VALUE)
PixelMath.boundImage(output, minValue, maxValue);
}
use of boofcv.struct.wavelet.WlCoef_F32 in project BoofCV by lessthanoptimal.
the class WaveletTransformOps method transform1.
/**
* <p>
* Performs a single level wavelet transform.
* </p>
*
* @param desc Description of the wavelet.
* @param input Input image. Not modified.
* @param output Where the wavelet transform is written to. Modified.
* @param storage Optional storage image. Should be the same size as output image. If null then
* an image is declared internally.
*/
public static void transform1(WaveletDescription<WlCoef_F32> desc, GrayF32 input, GrayF32 output, GrayF32 storage) {
UtilWavelet.checkShape(input, output);
WlCoef_F32 coef = desc.getForward();
if (output.width < coef.scaling.length || output.width < coef.wavelet.length)
throw new IllegalArgumentException("Wavelet is too large for provided image.");
if (output.height < coef.scaling.length || output.height < coef.wavelet.length)
throw new IllegalArgumentException("Wavelet is too large for provided image.");
storage = InputSanityCheck.checkDeclare(output, storage);
// the faster routines can only be run on images which are not too small
int minSize = Math.max(coef.getScalingLength(), coef.getWaveletLength()) * 3;
if (input.getWidth() <= minSize || input.getHeight() <= minSize) {
ImplWaveletTransformNaive.horizontal(desc.getBorder(), coef, input, storage);
ImplWaveletTransformNaive.vertical(desc.getBorder(), coef, storage, output);
} else {
ImplWaveletTransformInner.horizontal(coef, input, storage);
ImplWaveletTransformBorder.horizontal(desc.getBorder(), coef, input, storage);
ImplWaveletTransformInner.vertical(coef, storage, output);
ImplWaveletTransformBorder.vertical(desc.getBorder(), coef, storage, output);
}
}
Aggregations