简体   繁体   中英

Wavelet Transform (Haar or Daubechies) in Java with BoofCV

Does anybody knows how to use a wavelet transform (Haar or Daubechies) of BoofCV in Java?

There's no code example on the web and I'm very new at this library.

I've tried this code below, but so for no results.

public static void main(String[] args) throws IOException, InstantiationException, IllegalAccessException {
    String dir = "C:\\Users\\user\\Desktop\\ImgTest\\";
    BufferedImage buff =UtilImageIO.loadImage(dir+"img.png");

    ImageUInt16 aux = UtilImageIO.loadImage(dir+"img.png", ImageUInt16.class);

    ImageSInt16 input = new ImageSInt16(aux.width, aux.height);
    input =ConvertImage.convert(aux, input);
    ImageSInt32 output = new ImageSInt32(aux.width, aux.height);

    int minPixelValue = 0;
    int maxPixelValue = 255;
    WaveletTransform<ImageSInt16, ImageSInt32, WlCoef_I32> transform =  
            FactoryWaveletTransform.create_I(FactoryWaveletHaar.generate(true, 0), 1, 
                    minPixelValue, maxPixelValue,ImageSInt16.class);
    output=transform.transform(input, output);

    //BufferedImage out = ConvertBufferedImage.convertTo(output, null);
    BufferedImage out = new BufferedImage(input.width*6, input.height*6, 5);
     out = VisualizeBinaryData.renderLabeled(output, 0, out);
    ImageIO.write(out, "PNG", new File(dir+"out.png"));
    }
}

I also tried JWave, but there's no code example either and the responsible wasn't able to help with it.

Thank you!

There are a lot of code examples outside there. I made one before, but in C# not Java. For Java Code, you could refer to here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM