DirectByteBuffer and BufferedImage for image acquisition

Discussion in 'Java' started by Peter Szymanski, Jul 9, 2003.

  1. Hi there,
    I am trying to get acquired images into a java application for analysis from
    a 2000x1500 pixel 12 bit camera.
    I am currently copying from the camera framebuffer into malloc memory in a
    JNI compiled dll. At the moment

    <c file>
    JNIEXPORT jobject JNICALL Java_CameraEpixJNI_doNativeMapBuffer
    (JNIEnv *env, jobject obj, jint cardNum, jint bufNum){
    ...
    pxd_readuchar(1, 1, x1, y1, x2, y2, membuf, (long)capacity,"Grey");//library
    function to copy pixels into membuffer(membuffer malloced earlier)
    return (*env)->NewDirectByteBuffer(env, membuf, capacity);
    ....

    }
    </c>
    currently in java, whenever the application needs the BufferedImage, I use
    the 'bulk get' ByteBuffer.get(byte[] into, offset, length) method, where
    the into[] array has been used to create the member BufferedImage variable
    in the constructor of the camera class.

    My question is, is it possible to wrap a BufferedImage directly around the
    DirectByteBuffer, where if the dll is called to change the buffer in native
    code, will the BufferedImage reflect the change? Is there a better way?
    Thanks in advance,
    Peter
     
    Peter Szymanski, Jul 9, 2003
    #1
    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. jude
    Replies:
    7
    Views:
    953
    Brock Allen
    Mar 15, 2005
  2. yang su
    Replies:
    11
    Views:
    585
    Rolf Magnus
    Aug 10, 2004
  3. cornerback

    Problems using DirectByteBuffer

    cornerback, Aug 28, 2009, in forum: Java
    Replies:
    0
    Views:
    508
    cornerback
    Aug 28, 2009
  4. Davide
    Replies:
    6
    Views:
    367
    BartC
    Nov 21, 2011
  5. Steven Jenkins
    Replies:
    0
    Views:
    290
    Steven Jenkins
    Jan 19, 2004
Loading...

Share This Page