如何使用 Java 和 NetBeans 将数据显示为图像
我是 Java 和 NetBeans 新手,但有 C/C++ 经验。我将开发一个具有显示图像区域的应用程序。图像将在内存中创建为无符号字节数组,并被视为单色。
我正在寻找将此类数据显示为图像的教程或示例。 (数据将从成像辐射计中读取 - 每隔几秒)我已经查看了 AWT 中的一些类,但我需要一个示例。
谢谢
I am new to Java and NetBeans but have experience in C/C++. I will be working on an application which will have an area to display an image. The image will be created in memory as an array of unsigned bytes and considered to be monochrome.
I'm looking for a tutorial or examples of displaying data like this as an image. (The data will be read from an imaging radiometer - every few seconds) I've looked at some classes in AWT but I need an example.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查看 Trail:2D 图形 和 BufferedImage。
Have a look at Trail: 2D Graphics and BufferedImage.
这是一个直接操作离屏图像像素的简单示例。这个复杂示例检查了在单独的线程中累积图像数据并定期查看的几种方法更新。
Here's a very simple example of manipulating the pixels of an off-screen image directly. This more complex example examines several approaches to accumulating image data in a separate thread and viewing periodic updates.
看起来你有两个问题。
从数组创建 java Image 对象:
将像素数组转换为图像使用 Java 的 ImageIO 对象?
显示java图像:
如何将图像添加到 JPanel?
有关使用 JPanel 渲染的更多信息可以在此处找到:
http://java.sun.com/docs/books/教程/uiswing/painting/index.html
It looks like you have two problems.
Creating a java Image object from an array:
Turn an array of pixels into an Image object with Java's ImageIO?
Displaying the java Image:
How to add an image to a JPanel?
More info on rendering with a JPanel can be found here:
http://java.sun.com/docs/books/tutorial/uiswing/painting/index.html