Can we call image from drawable of android with native c++ code [closed]
Can we read Image from android drawable with jni like if I am using opencv with c++ in native environment of android with eclipse. Suppose I have a main.cpp
in jni
folder and from main.cpp
, Can I call the image from drawable like
Mat imread ("drawable\\2.png") // In jni code with c++
Or I can only call it from drawable in java environment on java programming side.
Drawable is where we put our images in eclipse
hi, FLY, that won't work.
the drawable folder is inside your apk, which is kinda a zipped filesystem
now, cheesy c++ functions like imread can't read from a zip file (that probably comes unexpected to a java guy), so you will have to copy it to sdcard or similar first, then imread() it from there
(apart from that, you need 2 backward slashes on windows, but 2forward slashes are just plain wrong)
ah
\\
:P , okay , well Thanks beraki'm sure there's something in android.utils, that allows you to read a bitmap-> Mat from resources, just can't find it
I think to resize my input image with constant image (image in drawable) on jni c++ end (which is not looking possible) , so I think now its better to deal both of them on java end
well, no , that backslashes only apply on windows, you can never use them on android.
see Utils.loadResource