opencv4android cvcapturefromfile() return NULL [duplicate] - android

Maybe I'm being a bit slow, but I can't find the equivalent of CaptureFromFile for grabbing video frames one by one from a file in OpenCV in Java on Android.
Can anyone put me out of my misery please and show me where to look?
Many thanks
Barry

OpenCV does not support video reading/writing on Android yet.

Take a look at solution in here. Also, it seems like Open CV is available thrue Android NDK, here you may find how to use it. In addition, you may take a look at Processing, which i believe supports Open CV and able to export code as apk.

Related

.obj to .glb conversion

I want to make an Android app which can convert .OBJ files into .GLB files.
I've researched this a fair bit but I haven't yet found any library that I'm confident I can use in an Android app for .OBJ to .GLB conversion. I had initially thought that the Assimp library was going to be the best bet: http://cms.assimp.org/index.php. Having looked more closely, however .GLB seems only to be listed as an import format and not as an export format: https://github.com/assimp/assimp So that presumably that means I can use Assimp to convert from .GLB to another format but not into .GLB from another format.
I'd be most grateful for any suggestions on alternative strategies that might be worth investigating. There must surely be some solution to this, but I can't immediately see what it could be!
You can use the Assimp-lib build for your android version ( shall work for 4.1.0 with android-cmake as far as I know ). Then you can use the functionalities to import an obj-file and export it as an glb-file. To write files there you will need to use th android-filesystem.
A short explanation cqn be found in our wiki how to build assimp for android ( check this here ). Or you can try our special build script, which is located here.
If you are facing any issues just create an issue report.

Put image over video and save video to sd card Android

I'm working on a feature in which I want to add picture over the video and save it to sd card.
in general, the user selects an image with semi-transparent background and puts that image above the video, after the user presses the save button he gets a new video but already with the image above the video.
I have heard about ffmpeg, and saw some commands that are provided by ffmpeg. but I don't know where I should initialize. can anyone provide me an example for the same?
Thank you.
One common approach is to use an ffmpeg wrapper to access ffmpeg functionality from your Android app.
There are several fairly well used wrappers available on GitHub - the ones below are particularly well featured and documented (note, I have not used these as they were not so mature when I was looking at this previously, but if I was doing something like this again now I would definitely build on one of these):
http://writingminds.github.io/ffmpeg-android-java/
https://github.com/guardianproject/android-ffmpeg
Using one of the well supported and used libraries will take care of some common issues that you might otherwise encounter - having to load different binaries for different processor types, and some tricky issues with native library reloading to avoid crashes on subsequent invocations of the wrapper.
Because this approach uses the standard ffmpeg cmd line syntax for commands it also means you should be able to search and find help easily on multiple different operations (as anyone using ffmpeg in 'normal' model will use the same syntax for the ffmpeg command itself).
For example, for your adding an image case here are some results from a quick search (ffmpeg syntax can change over time so it is worth doing a current check):
https://stackoverflow.com/a/32250369/334402
https://superuser.com/a/678171

Anyone know where I can find sample hardware/hardware c file for android

I'm trying to really get to know the android source code. I've downloaded what I thought would be the code, but it seems to lack many files that I would have expected there.
I'm looking for the hardware/hardware.c (cpp) file, and the hardware/power.c files.
Does anyone know where I could find some samples of this. Or perhaps where I could find a book on the topic.
I think it's here:
https://android.googlesource.com/platform/dalvik/
See also: Where to get the source to Dalvik?

How to read an AVI file in OpenCV for Android

I need to read an AVI file in Android and process its frames. I know its C++ way but not the android one! Can someone help me and give a start point. I'm using opencv 2.4.5.
You can try to compile OpenCV with FFMPEG for Android.
Video IO is not officially supported but if I remember correctly this patch worked: http://code.opencv.org/issues/2546 At least you can use it as a good starting point.
You can use javacv, it has ffmpeg and opencv wrappers with examples.
I don't think that it is implemented yet (at least it wasn't six months ago). You might want to split you video into frames and open those frames instead of the video file (have a look at this thread).
i'm not sure if it's useful , but take a look at this:
http://www.stanford.edu/class/ee368/Android/Tutorial-2-OpenCV-for-Android-Setup-Macintosh-API11.pdf

Android ffmpeg simple JNI wrapper

I've been trying to use an ffmpeg binary with command line access for a while now and getting nowhere (Using runtime.exec)
It looks like the only way I'll be able to get it to work is using a wrapper in C to access the built ffmpeg libraries using JNI...
Main problem: I haven't coded C for more than one and a half decades now and wouldn't know where to begin...
I just need 3 operations, I need to add audio to a video file, I need to concatenate two video files and if possible I need to rotate a clip by 90 degrees (but I could do without this)...
Does anyone have any example code that could work for me, or some good places to start (I've already exhausted much of the first pages of various google results to no avail)...
Any help would be greatly appreciated!
There are many open source projects available, But for simplicity, You can start from here
I believe this is what you are looking for:
https://github.com/hoary/JavaAV
Multiple platforms supported so your code will be more portable.

Categories

Resources