有人知道如何在Java中使用BoofCV的小波变换(Haar或Daubechies)吗?
网上没有代码示例,我在这个图书馆很新。
我已经尝试过以下代码,但是没有结果。
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,但也没有代码示例,负责人也无法提供帮助。
谢谢!