开发者

java double[][] - display as image

开发者 https://www.devze.com 2022-12-30 00:32 出处:网络
just wondering if there is a simple way in java to display the contents of say 16x16 array of doubles [0..1] as a greyscale image (ala matlab)? using an unfamiliar matrix lib开发者_如何学Pythonrary, s

just wondering if there is a simple way in java to display the contents of say 16x16 array of doubles [0..1] as a greyscale image (ala matlab)? using an unfamiliar matrix lib开发者_如何学Pythonrary, so I'd like to check that I'm on the right track. don't really care if it is slow or ugly, or if it requires external library - it's just there for a quick look, so as long as it works, I'm fine.


Take a look at java.awt.MemoryImageSource.

The javadoc gives an example of how to use this class similar to what you need.

The Component.createImage(ImageProducer) method can then convert this into an Image that you can display in swing components with an ImageIcon.

0

精彩评论

暂无评论...
验证码 换一张
取 消