grabPixels() unsuccessful...


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: grabPixels() unsuccessful...

  1. #1
    Join Date
    Aug 2006
    Posts
    2

    grabPixels() unsuccessful...

    Hi everyone,

    I capturing an Image from a camera (that works) and like to process it so I am calling grabPixels(). The code looks as follows:

    try{
    if(pgObj.grabPixels() &&
    ((pgObj.getStatus() &
    ImageObserver.ALLBITS)
    != 0))
    {

    }//end if

    else System.out.println("Pixel grab not successful");


    }catch(InterruptedException e){
    System.out.println("PixGrabber interrupted by other thread");
    e.printStackTrace();
    }//end catch

    I always get the "Pixel grab not successful" .... I did some more inspecting and found that while pgObj.grabPixels() returns true, ((pgObj.getStatus() & ImageObserver.ALLBITS)!= 0) returns false. I replaced ImageObserver.ALLBITS with ImageObserver.ERROR, ABORT and PROPERTIES and it is still false.
    However, when I use ImageObserver.FRAMEBITS, HEIGHT,SOMEBITS,WIDTH it returns true but the image i get is extremelly misformed...

    Can anyone tell me what the cause of thsi could be?

    I have searched all over and it feels i have echausted the www!

    help plz.....

  2. #2
    Join Date
    Aug 2003
    Posts
    313
    I'm not exactly sure the context of this, but this updateImage can be called when the entire image isn't know, but only new parts of the image are loaded. So, not getting ALLBITS is not necessarily an error, it just means that there might be more to go. I'm not sure if this helps, but hopefully it will.

    If you can post more information someone might be able to help further.
    ~evlich

  3. #3
    Join Date
    Aug 2006
    Posts
    2
    Thank you Elvich! knowing that makes debugging easier.

  4. #4
    Join Date
    Aug 2007
    Posts
    1
    can you plz tell me how to get RGB values through JAVA

  5. #5
    Join Date
    Aug 2003
    Posts
    313
    From a BufferedImage (http://java.sun.com/j2se/1.4.2/docs/...eredImage.html) you can do a getData() which will specify the data based on the color model. See the "Field Summary" above for the specifications of the color models.

    Hope this helps.
    ~evlich

Similar Threads

  1. Replies: 0
    Last Post: 09-07-2005, 03:12 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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center