问题描述:

I am working with OpenCV4Android version 2.4.11 and I am retrieving frames from the camera to make some image processing on these frames. What I want to do is, when the camera focuses I should start the image processing step. to do

so, I used

mOpenCvCameraView.setOnFocusChangeListener

but the problem is, when the app starts the camera starts previewing and despite the camera focus changes, the onFocusChange method is never called also the Log messages inside the setOnFocusChangeListener are never called as well.

please let me know why the setOnFocusChangeListener is not getting called

code:

mOpenCvCameraView.enableView();

mOpenCvCameraView.setOnFocusChangeListener(new View.OnFocusChangeListener() {

@Override

public void onFocusChange(View v, boolean hasFocus) {

Log.w(TAG, "hasFocus: " + hasFocus);

if (hasFocus) {

Log.w(TAG, "hasFocus: " + hasFocus);

mCornersCord = mCornerDetector.findCornersCords(mMatInputFrame);

}

}

});

layout:

<org.opencv.android.JavaCameraView

android:id="@+id/surfaceView"

android:layout_width="match_parent"

android:layout_height="0dp"

android:layout_weight=".3"

android:visibility="visible"

opencv:camera_id="any"

opencv:show_fps="true" />

<ImageView

android:id="@+id/fragOpenCvCam_imageView_edges"

android:layout_width="match_parent"

android:layout_height="0dp"

android:layout_weight=".3"

android:padding="7dp" />

相关阅读:
Top