composite two images

Discussion in 'Java' started by fireman, Nov 4, 2010.

  1. fireman

    fireman Guest

    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
     
    fireman, Nov 4, 2010
    #1
    1. Advertising

  2. In article
    <>,
    fireman <> wrote:

    > 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>

    --
    John B. Matthews
    trashgod at gmail dot com
    <http://sites.google.com/site/drjohnbmatthews>
     
    John B. Matthews, Nov 5, 2010
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sleigh
    Replies:
    1
    Views:
    2,694
    sleigh
    Feb 12, 2004
  2. CDB

    Composite Images

    CDB, Jul 16, 2003, in forum: Java
    Replies:
    0
    Views:
    312
  3. GenxLogic
    Replies:
    3
    Views:
    1,289
    andrewmcdonagh
    Dec 6, 2006
  4. Chad
    Replies:
    0
    Views:
    225
  5. Mike

    Composite vs non composite Controls

    Mike, Mar 10, 2005, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    266
    Sundararajan
    Mar 11, 2005
Loading...

Share This Page