2015-12-17 28 views
1

有谁知道如何在Java中使用BoofCV的小波变换(Haar或Daubechies)?Java中的小波变换(Haar或Daubechies)和BoofCV

网上没有代码示例,我在这个库上很新。

我试过下面的这段代码,但没有结果。

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")); 
    } 
} 

我也试过JWave,但没有代码示例要么与责任无法帮助它。

谢谢!

回答

0

外面有很多代码示例。我之前做过一个,但在C#中不是Java。对于Java代码,你可以参考here

+0

我也试过这个,但没有能够将它应用到图像的Java。谢谢! – RochaRF