Results 1 to 1 of 1
  1. #1
    meth is offline Member
    Join Date
    Jan 2011
    Posts
    11
    Rep Power
    0

    Default output is not displayed

    so, im doing an image detection which i have to process on each red, green, n blue element to get the edge map and combine them become one to show the output. but it doesnt show my output image :( would anyone pls be kind enough to help me? here is my code so far.

    Java Code:
    //get the red element
    process_red = new int[width * height];
    counter = 0;
     for(int i = 0; i < 256; i++) {
         for(int j = 0; j < 256; j++) {
             int clr = buff_red.getRGB(j, i);
             int red = (clr & 0x00ff0000) >> 16;
             red = (0xFF<<24)|(red<<16)|(red<<8)|red;
             process_red[counter] = red;
             counter++;
         }
    }
    
    //set threshold value for red element
    int threshold = 100;
    for (int x = 0; x < width; x++) {
    for (int y = 0; y < height; y++) {
         int bin = (buff_red.getRGB(x, y) & 0x000000ff);
         if (bin < threshold)
                   bin = 0;
         else
                   bin = 255;
         buff_red.setRGB(x,y, 0xff000000 | bin << 16 | bin << 8 | bin);
         }
    }
    and i do the same process for green and blue element.

    Java Code:
    //combine the three elements
    process_combine = new int[width * height];
    counter = 0;
    for(int i = 0; i < 256; i++) {
        for(int j = 0; j < 256; j++) {
            int clr_a = buff_red.getRGB(j, i);
            int ar = clr_a & 0x000000ff;
            int clr_b = buff_green.getRGB(j, i);
            int bg = clr_b & 0x000000ff;
            int clr_c = buff_blue.getRGB(j, i);
            int cb = clr_b & 0x000000ff;
            int alpha = 0xff000000;
            int combine = alpha|(ar<<16)|(bg<<8)|cb;
            process_combine[counter] = combine;
            counter++;
         }
    }
    buff_rgb = new BufferedImage(width,height, BufferedImage.TYPE_INT_ARGB);
    Graphics rgb;
    rgb = buff_rgb.getGraphics();
    rgb.drawImage(output_rgb, 0, 0, null);
    rgb.dispose();
    repaint();

    so, to show the output from the combining process, i use draw method:
    g.drawImage(buff_rgb,800,100,this);

    but still it doesnt show me the output. can anyone pls help me? ur help is really appreciated. thanks.
    Last edited by meth; 01-07-2011 at 06:07 AM.

Similar Threads

  1. Replies: 3
    Last Post: 09-22-2010, 07:28 PM
  2. Nodes displayed in JTree
    By Orange in forum AWT / Swing
    Replies: 6
    Last Post: 08-08-2008, 05:07 AM
  3. Tooltip not getting displayed...
    By Preethi in forum New To Java
    Replies: 4
    Last Post: 07-31-2008, 10:00 AM
  4. displayed the rownumbers
    By geeta_ravikanti in forum JDBC
    Replies: 1
    Last Post: 04-22-2008, 02:30 AM
  5. Java Components are not displayed(sometimes)
    By archanajathan in forum AWT / Swing
    Replies: 3
    Last Post: 11-05-2007, 08:34 AM

Posting Permissions

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