简体   繁体   English

使用BoofCV在Java中进行小波变换(Haar或Daubechies)

[英]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? 有人知道如何在Java中使用BoofCV的小波变换(Haar或Daubechies)吗?

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. 我也尝试过JWave,但是也没有代码示例,负责人也无法提供帮助。

Thank you! 谢谢!

There are a lot of code examples outside there. 外面有很多代码示例。 I made one before, but in C# not Java. 我之前做了一个,但是在C#中不是Java。 For Java Code, you could refer to here 对于Java代码,您可以在这里参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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