Displaying a buffered image with a predifined colormap

I

Isaac Gerg

Hello all,
I have a matrix (normalized [0,1]) that I would like to display as an
image (similar to matlabs imagesc( )). I am able to load it into a buffered
image and display it but it only displays in grayscale. I would like to
provide a colormap to it so that it mimics matlabs 'jet' colormap. Any
ideas on how to do this? Are there any 'cookbook' type resources for java
imaging out there?

Isaac
 
A

ak

I have a matrix (normalized [0,1]) that I would like to display as an
image (similar to matlabs imagesc( )). I am able to load it into a buffered
image and display it but it only displays in grayscale. I would like to
provide a colormap to it so that it mimics matlabs 'jet' colormap. Any
ideas on how to do this?

you should pass appropriate IndexColorModel to constructor of BufferedImage
 
I

Isaac Gerg

I got that working. Thank you.

Now, how do I display the image in a window? This program is console
program.
 
A

ak

Now, how do I display the image in a window? This program is console
there are many ways...

for example :

Image image = ...;
ImageIcon icon = new ImageIcon(image);
JLabel label = new JLabel(icon);
JFrame frame = new JFrame();
frame.getContentPane().add(new JScrollPane(label));
frame.pack();
frame.show();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top