I have written a imageprocessing app with javacv. I have some samples which are there to find some objects on a taken picture. The problem is that my program just gets nullpointerexception.
static String objectFilename = "assets/sblinksoben.png";
object = cvLoadImage(objectFilename,
CV_LOAD_IMAGE_GRAYSCALE);
The first one is the path and the last one is how I load the image. Evertime when I check it with my debugger it only stands object = null.
So my guess is that the images are not getting packed into the .apk and the program will not find anything.
Does someone have solution for it?
Thanks in advance.
You need to use AssetManager to load files from the assets
folder of your project.
Not sure about the cvLoadImage()
method, but maybe it has a version which will take an InputStream
of the image. In that case you can use AssetManager.open()
to load the image from your assets and pass it to cvLoadImage()
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.