从Java传递图像数据到C本地函数指针接受 [英] Passing Image Data from Java to C Native function accepting pointers
问题描述
我已经在外部.so文件中提供的C函数。这个函数的图像数据作为输入,并与图像输出lengh一起提供了COM pressed形象。
I have been provided a C function in an external .so file. This function takes Image data as input and provides the compressed image along with lengh of the image as output.
函数模板如下:
的char * OutputImage = com的pressImage((字符*)inputImage的(INT)及lenOutImage);
char *OutputImage = CompressImage((char *)InputImage, (int)&lenOutImage);
在我的Java code,我捕捉输入图像以byte []数据类型。现在我需要这个传递给上述原生的C函数。你能帮帮我怎样才能从Java实现这一目标?
In my Java code, I capture the input image as byte[] data type. Now I need to pass this to native C function mentioned above. Can you please help how I can achieve this from Java?
推荐答案
您有2个选项,使用JNI,JNA或。讨论如何做到这一点的详细是大的这个平台。
You have 2 options, use JNI, or JNA. Discussing how to do that in detail is to big for this platform.
这篇关于从Java传递图像数据到C本地函数指针接受的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!