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
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