Ask Your Question

stephanmg's profile - activity

2020-10-12 12:11:41 -0500 received badge  Popular Question (source)
2018-06-02 03:47:37 -0500 received badge  Popular Question (source)
2017-08-10 08:31:27 -0500 received badge  Notable Question (source)
2016-10-04 05:40:19 -0500 received badge  Famous Question (source)
2016-06-08 04:59:27 -0500 received badge  Popular Question (source)
2014-10-14 22:32:48 -0500 received badge  Notable Question (source)
2014-08-19 08:19:40 -0500 received badge  Taxonomist
2014-03-25 13:50:19 -0500 received badge  Popular Question (source)
2013-08-27 10:01:58 -0500 received badge  Student (source)
2013-08-27 09:51:04 -0500 asked a question OpenCV with USB camera on Android

DDear OpenCV users,

is it possible to use easily USB camera with OpenCV on Android? We would like to use cameras from Leopard Imaging ... but we want to make sure which USB camera can be used with OpenCV on Android.

All the best, Stephan

2013-07-01 08:39:53 -0500 answered a question VideoCapture device on Android

Dear Alexander,

thank's for your reply.

So, i do not necessarily need to use FFMPEG, i just want to read in videofiles on Android with OpenCV natively. Is there any other approach how I can do this?

All the best, Stephan

2013-06-13 09:55:25 -0500 asked a question VideoCapture device on Android

Dear users,

i'm successfully using my Camera on Android (native C++ OpenCV) for capturing images from my Hardware Camera.

Nevertheless I cannot read with cv::VideoCapture from a videofile on my SD card on my Android phone... the videofile I have converted to the correct format for OpenCV, nevertheless the videofile is not recognized and cannot be played.

1) I read some posts that suggest to install "FFmpeg" Codecs on the Android device - but how, and is this possible at all?

some guy from #android-dev on Freenode suggested:

2) <anonymous> stephanmg, if you want to use ffmpeg decoders, yes, you should statically link libavcodec/libavformat into your opencv library so it'll have the decoders available.

My question is: How can i read videofiles with cv::VideoCapture from a file, analogous to the case which i succesfully could manage, that is to read and process images which i captured from my hardware camera.

All the best, Stephan

2013-03-06 14:03:35 -0500 commented answer convert cv::Mat (C++, native Code) to Bitmap (Android, Java)

Thank you for your quick response again! I found that article: http://stackoverflow.com/questions/9818936/display-iplimage-as-android-bitmap

I cannot proceed as you suggested because of our project's design. Is the way described in the stackoverflow post the way to go then?

all the best, Stephan

2013-03-06 14:01:55 -0500 commented answer Use native OpenCV C++ camera in JNI call

No. In the native camera case it does not work, seems then to be an issue for the Motorola device with Android 2.x. We use Cyanogen Mod 7 as an additional information, maybe that's of interest?

2013-03-06 10:13:20 -0500 asked a question convert cv::Mat (C++, native Code) to Bitmap (Android, Java)

Dear OpenCV Users,

I have the following C++ native code which I use to get an image from my (native) camera:

string Java_com_example_hellojni_HelloJni_getImageNative(JNIEnv* env, jobject thiz) {
   // first camera available
   cv::VideoCapture capture(CV_CAP_ANDROID + 0);
   // set captuer properties
   capture.set(CV_CAP_PROP_FRAME_WIDTH, 640);
   capture.set(CV_CAP_PROP_FRAME_HEIGHT, 480);

   // check if capture is opened
   if( !capture.isOpened()) return env->NewStringUTF("Capture not opened!");

   //  grab frame
   cv::Mat frame;
  capture >> frame;

// how to return the image as Bitmap to Android??
}

How would I return a Bitmap to Android Code in Java via JNI?

All the best, Stephan

2013-03-06 05:04:53 -0500 commented answer Use native OpenCV C++ camera in JNI call

Thanks for the suggestions. We tried another device in which the code works. The device on which this is not working is an Milestone by Motorola. The Android Version is above 2.2, i. e. 2.3. Any other suggestions - please note the tutorial-1-camerapreview works.

2013-03-06 03:36:22 -0500 commented answer Use native OpenCV C++ camera in JNI call

I posted my AndroidManifest.xml and Java Code above. But it's not working, it's failing with:

03-06 10:35:57.508: E/OpenCV::camera(10449): calling (pGetPropertyC)(0xa5cd0, 0) 03-06 10:35:57.508: D/OpenCV_NativeCamera(10449): CameraHandler::getProperty(0) 03-06 10:35:57.508: E/OpenCV::camera(10449): calling (pGetPropertyC)(0xa5cd0, 1) 03-06 10:35:57.508: D/OpenCV_NativeCamera(10449): CameraHandler::getProperty(1)

2013-03-05 10:52:18 -0500 received badge  Editor (source)
2013-03-05 10:51:31 -0500 asked a question Use native OpenCV C++ camera in JNI call

Dear OpenCV Users,

as the topic suggests I want to use the OpenCV C++ interface for VideoCapture and use this as a native JNI call in my Java Android project.

Nevertheless I recognized that this isn't possible for CONSOLE applications as reported by: 1) [https://groups.google.com/forum/?fromgroups=#!topic/android-opencv/SUpxCPvQPIE] and 2) [http://code.opencv.org/issues/1193]

Is there any way to make this work again?

All the best, Stephan

P.S.: My AndroidManifest.xml looks like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.hellojni"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="2" android:targetSdkVersion="4"/>
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-feature android:name="android.hardware.camera.any" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application android:label="@string/app_name"
                 android:debuggable="true">
        <activity android:name=".HelloJni"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

And my Java Code:

package com.example.hellojni;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;


public class HelloJni extends Activity
{

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);


        /* Create a TextView and set its content.
         * the text is retrieved by calling a native
         * function.
         */

        // this works
        final Button button = new Button(getApplicationContext());
                button.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View v) {
                        // Perform action on click
                    }
                });
        TextView  tv = new TextView(this);
        tv.setText( stringFromJNI() );
        setContentView(tv);
    }

    /* A native method that is implemented by the
     * 'hello-jni' native library, which is packaged
     * with this application.
     */
    public native String  stringFromJNI();

    /* This is another native method declaration that is *not*
     * implemented by 'hello-jni'. This is simply to show that
     * you can declare as many native methods in your Java code
     * as you want, their implementation is searched in the
     * currently loaded native libraries only the first time
     * you call them.
     *
     * Trying to call this function will result in a
     * java.lang.UnsatisfiedLinkError exception !
     */
    public native String  unimplementedStringFromJNI();

    /* this is used to load the 'hello-jni' library on application
     * startup. The library has already been unpacked into
     * /data/data/com.example.hellojni/lib/libhello-jni.so at
     * installation time by the package manager.
     */
    static {
        System.loadLibrary("opencv_java");
        System.loadLibrary("hello-jni");
    }
}