Ask Your Question

Bruno's profile - activity

2017-05-19 21:47:34 -0500 received badge  Taxonomist
2012-10-07 22:23:12 -0500 received badge  Self-Learner (source)
2012-07-20 06:22:40 -0500 received badge  Notable Question (source)
2012-07-20 06:21:14 -0500 received badge  Notable Question (source)
2012-07-16 09:52:17 -0500 commented question Android + OpenCV + Face detection + Custom Layout

That is the problem : "but just a black screen is displayed" The live camera preview is not displayed at all.

2012-07-16 04:03:25 -0500 received badge  Popular Question (source)
2012-07-16 03:14:15 -0500 received badge  Popular Question (source)
2012-07-14 16:24:20 -0500 received badge  Editor (source)
2012-07-14 16:22:00 -0500 asked a question Android + OpenCV + Face detection + Custom Layout

Hi, I am using:

  • Android 4.0.3
  • OpenCV 2.4.2
  • Samsung Galaxy S2

The face-detection example (from the opencv 2.4.2) is working perfectly. But now, I would like to create a custom layout and actually work with just the data extracted from face detection and build a game on it. Not necessarily having the FdView surface taking the entire screen.

I have done these modifications below, but just a black screen is displayed.

Added a fd.xml layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">

    <org.opencv.samples.fd.FdView android:id="@+id/FdView" 
        android:layout_width="640dp" 
        android:layout_height="480dp"
        android:visibility="visible"
        />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#FF0000"
        android:text="hi"/>
</LinearLayout>

Modified the baseLoaderCallback of FdActivity.java:

    private BaseLoaderCallback  mOpenCVCallBack = new BaseLoaderCallback(this) {
    @Override
    public void onManagerConnected(int status) {
        switch (status) {
            case LoaderCallbackInterface.SUCCESS:
            {
                Log.i(TAG, "OpenCV loaded successfully");

                // Load native libs after OpenCV initialization
                System.loadLibrary("detection_based_tracker");

                //EXPERIMENT
                setContentView(R.layout.fd);
                FdView surface = (FdView) (findViewById(R.id.FdView));

                surface = mView;
                // Create and set View
                mView = new FdView(mAppContext);
                mView.setDetectorType(mDetectorType);
                mView.setMinFaceSize(0.2f);
                //setContentView(mView);


                // Check native OpenCV camera
                if( !mView.openCamera() ) {
                    AlertDialog ad = new AlertDialog.Builder(mAppContext).create();
                    ad.setCancelable(false); // This blocks the 'BACK' button
                    ad.setMessage("Fatal error: can't open camera!");
                    ad.setButton("OK", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        finish();
                        }
                    });
                    ad.show();
                }
            } break;
            default:
            {
                super.onManagerConnected(status);
            } break;
        }
    }
};

Added constructors in FdView.java:

    public FdView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    // TODO Auto-generated constructor stub
}

public FdView(Context context, AttributeSet attrs) {
    super(context, attrs);
    // TODO Auto-generated constructor stub
}

Added constructors in SampleCvViewBase.java:

    public SampleCvViewBase(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    // TODO Auto-generated constructor stub
}

public SampleCvViewBase(Context context, AttributeSet attrs) {
    super(context, attrs);
    // TODO Auto-generated constructor stub
}
2012-07-14 14:50:43 -0500 answered a question Installing Sample App / OpenCV Manager

I have got theses two apps from the store: https://play.google.com/store/apps/details?id=org.opencv.engine https://play.google.com/store/apps/details?id=org.opencv.libv24armv7a

That is on a Samsung galaxy S2. All the samples work.

P.S. for facedetection, tutorial-3-native and tutorial-4-mixed you have to complie native code using this tutorial http://docs.opencv.org/doc/tutorials/introduction/androidbinarypackage/androidbinarypackageusingwith_NDK.html

2012-07-13 16:02:14 -0500 asked a question How to use front-facing camera

Hi, I am using - opencv 2.4.2 - android 4.0.3

how can I use the front-facing camera instead of the rear-facing camera on the face-detection example?

Thank you, Bruno

2012-07-13 15:42:52 -0500 answered a question Face detection on Android 4.0.3
2012-07-13 12:10:08 -0500 asked a question Face detection on Android 4.0.3

Is it possible to use face detection feature on Android 4.0.3 with opencv 2.4.2 yet? I have tried using the native android API function getmaxnumdetectedfaces() but it returns 0, in other words, my hardware doesn't support the native feature.

So, back to opencv, I followed the instructions on http://docs.opencv.org/doc/tutorials/introduction/androidbinarypackage/androidbinarypackage.html but couldn't run the face detection example. It displays this error on eclipse:

07-13 13:07:24.533: E/AndroidRuntime(4561): FATAL EXCEPTION: main
07-13 13:07:24.533: E/AndroidRuntime(4561): java.lang.NoClassDefFoundError: org.opencv.samples.fd.FdActivity$1
07-13 13:07:24.533: E/AndroidRuntime(4561):     at org.opencv.samples.fd.FdActivity.<init>(FdActivity.java:27)
07-13 13:07:24.533: E/AndroidRuntime(4561):     at java.lang.Class.newInstanceImpl(Native Method)
07-13 13:07:24.533: E/AndroidRuntime(4561):     at java.lang.Class.newInstance(Class.java:1319)
07-13 13:07:24.533: E/AndroidRuntime(4561):     at android.app.Instrumentation.newActivity(Instrumentation.java:1026)
07-13 13:07:24.533: E/AndroidRuntime(4561):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1883)
07-13 13:07:24.533: E/AndroidRuntime(4561):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2000)
07-13 13:07:24.533: E/AndroidRuntime(4561):     at android.app.ActivityThread.access$600(ActivityThread.java:127)
07-13 13:07:24.533: E/AndroidRuntime(4561):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
07-13 13:07:24.533: E/AndroidRuntime(4561):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-13 13:07:24.533: E/AndroidRuntime(4561):     at android.os.Looper.loop(Looper.java:137)
07-13 13:07:24.533: E/AndroidRuntime(4561):     at android.app.ActivityThread.main(ActivityThread.java:4514)
07-13 13:07:24.533: E/AndroidRuntime(4561):     at java.lang.reflect.Method.invokeNative(Native Method)
07-13 13:07:24.533: E/AndroidRuntime(4561):     at java.lang.reflect.Method.invoke(Method.java:511)
07-13 13:07:24.533: E/AndroidRuntime(4561):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
07-13 13:07:24.533: E/AndroidRuntime(4561):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
07-13 13:07:24.533: E/AndroidRuntime(4561):     at dalvik.system.NativeStart.main(Native Method)

Thanks

2012-07-13 11:37:04 -0500 answered a question Facial feature detection

Hi, What about face detection on Android 4.0.3 ? Is possible to do?