DirectByteBuffer and BufferedImage for image acquisition

  • Thread starter Peter Szymanski
  • Start date
P

Peter Szymanski

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,698
Latest member
LydiaHalle

Latest Threads

Top