NewHandwave icon indicating copy to clipboard operation
NewHandwave copied to clipboard

Unable to set parameters

Open Zumbalamambo opened this issue 7 years ago • 1 comments

I have included the library as well as opencv to my app. Following is my MainActivity class file.

public class MainActivity extends AppCompatActivity implements CameraGestureSensor.Listener, ClickSensor.Listener {


    private String TAG = MainActivity.class.getSimpleName();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        if (PermissionUtility.checkCameraPermission(this)) {
            //The third passing in represents a separate click sensor which is not required if you just want the hand motions
            LocalOpenCV loader = new LocalOpenCV(MainActivity.this, MainActivity.this, MainActivity.this);
        }
    }

    /**
     * Called when an up gesture is triggered
     *
     * @param caller        the CameraGestureSensor object that made the call
     * @param gestureLength the amount of time the gesture took in milliseconds
     */
    @Override
    public void onGestureUp(CameraGestureSensor caller, long gestureLength) {
        Log.i(TAG, "Up");
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(MainActivity.this, "Hand Motion Up", Toast.LENGTH_SHORT).show();
            }
        });
    }

    /**
     * Called when a down gesture is triggered
     *
     * @param caller        the CameraGestureSensor object that made the call
     * @param gestureLength the amount of time the gesture took in milliseconds
     */
    @Override
    public void onGestureDown(CameraGestureSensor caller, long gestureLength) {
        Log.i(TAG, "Down");
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(MainActivity.this, "Hand Motion Down", Toast.LENGTH_SHORT).show();
            }
        });

    }

    /**
     * Called when a left gesture is triggered
     *
     * @param caller        the CameraGestureSensor object that made the call
     * @param gestureLength the amount of time the gesture took in milliseconds
     */
    @Override
    public void onGestureLeft(CameraGestureSensor caller, long gestureLength) {
        Log.i(TAG, "Left");
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(MainActivity.this, "Hand Motion Left", Toast.LENGTH_SHORT).show();
            }
        });
    }

    /**
     * Called when a right gesture is triggered
     *
     * @param caller        the CameraGestureSensor object that made the call
     * @param gestureLength the amount of time the gesture took in milliseconds
     */
    @Override
    public void onGestureRight(CameraGestureSensor caller, long gestureLength) {
        Log.i(TAG, "RIght");
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(MainActivity.this, "Hand Motion Right", Toast.LENGTH_SHORT).show();
            }
        });
    }

    @Override
    public void onResume() {
        super.onResume();
        if (PermissionUtility.checkCameraPermission(this)) {
            LocalOpenCV loader = new LocalOpenCV(MainActivity.this, MainActivity.this, MainActivity.this);
        }
    }

    /**
     * Called by a {@link ClickSensor} when a click is sensed.
     *
     * @param caller The <code>ClickSensor</code> that called the click.
     */
    @Override
    public void onSensorClick(ClickSensor caller) {
        Log.i(TAG, "Click");
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(MainActivity.this, "CLICK!", Toast.LENGTH_SHORT).show();
            }
        });
    }
}

But Im getting the following error,

at

edu.washington.cs.touchfreelibrary.sensors.CameraGestureSensor.setCameraSettings(CameraGestureSensor.java:373) at edu.washington.cs.touchfreelibrary.sensors.CameraGestureSensor.(CameraGestureSensor.java:394) at edu.washington.cs.touchfreelibrary.utilities.LocalOpenCV$1.onManagerConnected(LocalOpenCV.java:79) at edu.washington.cs.touchfreelibrary.utilities.LocalOpenCV.loadOpenCV(LocalOpenCV.java:105) at edu.washington.cs.touchfreelibrary.utilities.LocalOpenCV.doLoad(LocalOpenCV.java:54) at edu.washington.cs.touchfreelibrary.utilities.LocalOpenCV.(LocalOpenCV.java:46) at.myapplication.MainActivity.onCreate(MainActivity.java:24)

It points to the line LocalOpenCV loader = new LocalOpenCV(MainActivity.this, MainActivity.this, MainActivity.this);

Zumbalamambo avatar Jun 05 '17 10:06 Zumbalamambo

I also had similar issue better way to make it auto in below code . (CameraGestureSensor.java:373) ***params.set("iso", "auto"); ***

It Works :)

mohitmahi avatar Mar 31 '18 09:03 mohitmahi