Ask Your Question

Tingke's profile - activity

2020-10-10 00:38:33 -0600 received badge  Nice Question (source)
2015-09-22 10:02:26 -0600 received badge  Student (source)
2015-09-22 09:03:50 -0600 asked a question Is it possible to zoom and focus using OpenCV on Android?

Hi There!

I am doing some image detection on Android with OpenCV. I noticed that the OpenCV camera is quite blurry if one tries to hold it up to a small object. Is there a way to zoom the camera and/or customize the mode of focus? I'm familiar with implementing touch focus on the regular android camera class but am not sure about what's possible with OpenCV's classes. I couldn't find much on this online.

Cheers, Kevin

2015-08-17 11:04:20 -0600 received badge  Enthusiast
2015-08-07 03:51:28 -0600 asked a question cameraBridgeViewBase Pausing Callback/Green Screen during Resume

Hi There!

I am using cameraBridgeViewBase to capture a frame, processing the frame, and drawing it onto the canvas of cameraBridgeViewBase for display for 5 seconds before repeating the process again. All the processing is done in my main activity. I noticed that the onCameraFrame() function kept interrupting the drawing onto the canvas so I had to use cameraBridgeViewBase.disableView() and cameraBridgeViewBase.enableView() to disable and enable the callBacks of the cameraBridgeViewBase after I've drawn the canvas. The problem is that everytime enableView() is a called, for a split second an annoying green frame pops into the preview on screen the smartphone (I'm assuming it's part of the initialization).

Is there a way to get rid of the green screen during enableVIew()? Is there a better way to pause the callBacks of cameraBridgeViewBase so I can peacefully draw my picture onto the canvas?

Thanks, Kevin

2015-08-06 02:19:11 -0600 received badge  Editor (source)
2015-08-06 02:12:53 -0600 asked a question How to offload imaging processing to worker

Hi All!

I've run into a little predicament. I'm trying to: 1. Use CameraBridgeViewBase in my main activity to grab images 2. Use a Worker class to process the images 3. Draw the processed images back in my main activity

The reason I'm using a worker class is because I thought it would be more efficient. However the way I've implemented it so far: 1. onCameraFrame() begins a new thread to run the Worker class 2. the Worker class finishes and disposes the thread 3. Repeat. This is quite inefficient since I recreate a thread each frame I process.

Is there a better way to offload the processing to the Worker? I've thought about just letting the Worker thread take callBacks from CameraBridgeViewBase but I'm not sure how that would work out. Doing this would make more sense if you could request/grab picture frames instead of wait on a callBack from CameraBridgeViewBase. I believe using VideoCapture allows you to request/grab frames instead of wait on a callBack, but I think the usage of that class has changed in the new OpenCV versions (the old tutorial doesn't work) and I can't find any new tutorials on using it.

Cheers! Kevin

2015-08-04 23:57:24 -0600 commented question Android development with OpenCV tutorial not working

Thank you so much! WOW I can't believe I've been stuck on this for a week... Ugh how is someone new supposed to know that there's no backwards compatibility with older OpenCV code

2015-08-04 01:18:31 -0600 commented question Android development with OpenCV tutorial not working

I've been looking around the internet for a while now and I still have no clue what's going on... Maybe this line in the log gives a clue? I don't know,

08-04 08:04:11.833 8506-8506/com.example.kevin.prototypev00 D/OpenCV_NativeCamera﹕ Supported Cameras: (null)

Is it supposed to say (null) for supported cameras?

P.S. I have written a camera app using the standard android library and it has worked and I have tested some of the OpenCV samples like blob detection and they have also worked...

2015-08-04 01:15:41 -0600 asked a question Android development with OpenCV tutorial not working

Hi There!

I am just following the OpenCV Android tutorial on the official webpage of OpenCV: http://docs.opencv.org/2.4.3/doc/tuto... and I mainly just copy-pasted the code but it doesn't seem to work. I keep getting the error: Error signal 11 (SIGSEGV) and it is always doing the initialization of a VideoCapture object. All help is much appreciated! Here is the activity:

public class helloWorldTutorial extends Activity {
private HelloOpenCVView mView;
private Context mContext;
public void onCreate (Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
}

public String TAG = "OpenCVLoading";
private BaseLoaderCallback mOpenCVCallBack = new BaseLoaderCallback(this) {
    @Override
    public void onManagerConnected(int status) {
        switch (status) {
            case LoaderCallbackInterface.SUCCESS:
            {
                Log.i(TAG, "OpenCV loaded successfully");
                mView = new HelloOpenCVView(mContext);
                setContentView (mView);
                if( !mView.cameraOpen() ) {
                    // MessageBox and exit app
                    AlertDialog ad = new AlertDialog.Builder(mContext).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);
                Log.i(TAG, "OpenCV loaded Unsuccessfully");
            } break;
        }
    }
};

protected void onResume()
{
    Log.i(TAG, "called onResume");
    super.onResume();

    Log.i(TAG, "Trying to load OpenCV library");
    if (!OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_2, this, mOpenCVCallBack))
    {
        Log.e(TAG, "Cannot connect to OpenCV Manager");
    }
}


// Here is the cameraOpen() function in the view class
public boolean cameraOpen() {
    synchronized (this) {
        cameraRelease();
        Log.e("HelloOpenCVView", "init vidCap");
        mCamera = new VideoCapture(-1);
        Log.e("HelloOpenCVView", "ugh");
        if (!mCamera.isOpened()) {
            mCamera.release();
            mCamera = null;
            Log.e("HelloOpenCVView", "Failed to open native camera");
            return false;
        }
    }
    return true;
}

    //Here is the log, the error being on the last line
    08-04 08:04:11.493    8506-8506/com.example.kevin.prototypev00 I/OpenCVLoading﹕ OpenCV loaded successfully
    08-04 08:04:11.493    8506-8506/com.example.kevin.prototypev00 E/HelloOpenCVView﹕ init vidCap
    08-04 08:04:11.493    8506-8506/com.example.kevin.prototypev00 D/OpenCV::camera﹕ CvCapture_Android::CvCapture_Android(-1)
    08-04 08:04:11.503    8506-8506/com.example.kevin.prototypev00 D/OpenCV::camera﹕ Library name: libopencv_java.so
    08-04 08:04:11.503    8506-8506/com.example.kevin.prototypev00 D/OpenCV::camera﹕ Library base address: 0x79e28000
    08-04 08:04:11.523    8506-8506/com.example.kevin.prototypev00 D/OpenCV::camera﹕ Libraries folder found: /data/app-lib/org.opencv.engine-1/
    08-04 08:04:11.523    8506-8506/com.example.kevin.prototypev00 D/OpenCV::camera﹕ CameraWrapperConnector::connectToLib: folderPath=/data/app-lib/org.opencv.engine-1/
    08-04 08:04:11.523    8506-8506/com.example.kevin.prototypev00 E/OpenCV::camera﹕ ||libnative_camera_r4.3.0.so
    08-04 08:04:11.523    8506-8506/com.example.kevin.prototypev00 E/OpenCV::camera﹕ ||libnative_camera_r4.0.3.so
    08-04 08:04:11.523    8506-8506/com.example.kevin.prototypev00 E/OpenCV::camera﹕ ||libnative_camera_r4.4.0.so
    08-04 08:04:11.523    8506-8506/com.example.kevin.prototypev00 E/OpenCV::camera﹕ ||libnative_camera_r2.3.3.so
    08-04 08:04:11.523    8506-8506/com.example.kevin.prototypev00 E/OpenCV::camera﹕ ||libnative_camera_r4.2.0.so
    08-04 08:04:11.523    8506-8506/com.example.kevin.prototypev00 E/OpenCV::camera﹕ ||libnative_camera_r2.2.0.so
    08-04 08:04:11 ...
(more)
2015-07-28 00:45:38 -0600 asked a question Android Studio OpenCV VideoCapture Error signal 11 (SIGSEGV) during setup

'm following an online tutorial on the basics of setting up OpenCV. I am getting the error: Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 1740 (Thread-16446). Using a series of log statements, I've traced the problem to the line:mCamera = new VideoCapture(mCameraId);. But I'm not sure where to go from here. All help is deeply appreciated!