composite two images

F

fireman

Hi, I am new to java and hope you guys can help me.

I have two images. One is just oridinary color images. Another one is
a gray scale "mask" image with limited pixels values. Some pixels in
the mask images have value 6, some pxies have 7, some have 8, some
have 9. All other pixels have value 0. I would like to composte the
two images in the following way:

For the region in the mask image represented by pixels value 6,
overly semi-transparent (alphe=0.5) red on the original image. For
region with mask value 7, overly semi-transparent green. For value 8,
semi blue. Fior value 9, semi yellow.

How can I do it? If you guys could write some code, that would be
great.

Thank you very much.

Fireman
 
J

John B. Matthews

fireman said:
Hi, I am new to java and hope you guys can help me.

I have two images. One is just oridinary color images. Another one is
a gray scale "mask" image with limited pixels values. Some pixels in
the mask images have value 6, some pxies have 7, some have 8, some
have 9. All other pixels have value 0. I would like to composte the
two images in the following way:

For the region in the mask image represented by pixels value 6,
overly semi-transparent (alphe=0.5) red on the original image. For
region with mask value 7, overly semi-transparent green. For value 8,
semi blue. Fior value 9, semi yellow.

How can I do it?

If the two images are conformal, one approach would be to walk through
the Raster [1] associated with each BufferedImage [2], reading and
writing pixels values as desired. Alternatively, you might use LookupOp
[3], as seen in this example [4].

[1]<http://sites.google.com/site/drjohnbmatthews/raster>
[2]<http://download.oracle.com/javase/6/docs/api/javax/imageio/ImageIO.html>
[3]<http://download.oracle.com/javase/6/docs/api/java/awt/image/LookupOp.html>
[4]<http://www.java2s.com/Code/Java/2D-Graphics-GUI/Imagedemo.htm>
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top