Results 1 to 3 of 3
  1. #1
    nat is offline Member
    Join Date
    Dec 2013
    Rep Power

    Default Help with raster and pixel manipulation


    I am not familiar with image manipulations in Java, especially raster and pixel manipulations.
    I have this piece of code

    int[] pix1 = new int[3];
    int[] pix2 = new int[3];
    for (int x = 0; x < raster1.getWidth(); x++) {
    for (int y = 0; y < raster1.getHeight(); y++)
    raster1.getPixel(x, y, pix1);
    raster2.getPixel(x, y, pix2);

    pix1[0] -= pix2[0];
    pix1[1] -= pix2[1];
    pix1[2] -= pix2[2];
    I don't understand why pix1 and pix2 are defines as arrays of dimension 3? Is it because the format of pixel is RGB, or?
    Why further in the code pi1[2]=125? e.c.t.

    I would like to ask kindly for a help with a web site that could help me understand these things. Can anybody recommend me please, or refer me to a good web site or literature?

    Thank you very much in advance.
    Last edited by nat; 12-09-2013 at 10:39 PM.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power

    Default Re: Help with raster and pixel manipulation

    Those arrays have a size of 3, not a dimension of 3. A 3-dimensional array is an array of arrays of arrays. You have an array of ints.

    For questions like this, your first stop should be the API: Java Platform SE 7
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

  3. #3
    nat is offline Member
    Join Date
    Dec 2013
    Rep Power

Similar Threads

  1. BufferedImage's raster
    By PhQ in forum New To Java
    Replies: 3
    Last Post: 09-30-2012, 07:02 PM
  2. Scanning Image Pixel by Pixel
    By the_transltr in forum Advanced Java
    Replies: 5
    Last Post: 08-28-2012, 04:01 PM
  3. Replies: 1
    Last Post: 07-18-2012, 09:50 PM
  4. Replies: 6
    Last Post: 01-15-2011, 04:03 PM
  5. compare two images pixel by pixel
    By java_bond in forum Advanced Java
    Replies: 6
    Last Post: 03-02-2010, 12:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts