Example usage for org.opencv.android OpenCVLoader OPENCV_VERSION_2_4_3

List of usage examples for org.opencv.android OpenCVLoader OPENCV_VERSION_2_4_3

Introduction

In this page you can find the example usage for org.opencv.android OpenCVLoader OPENCV_VERSION_2_4_3.

Prototype

String OPENCV_VERSION_2_4_3

To view the source code for org.opencv.android OpenCVLoader OPENCV_VERSION_2_4_3.

Click Source Link

Document

OpenCV Library version 2.4.3.

Usage

From source file:com.example.evodisp.MainActivity.java

License:Apache License

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
    setContentView(R.layout.video);/*from  w w  w  . ja  va 2  s.  c  o  m*/
    preview = (SurfaceView) findViewById(R.id.surface);
    text = (TextView) findViewById(R.id.text);
    holder = preview.getHolder();
    holder.addCallback(this);
    holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}

From source file:com.example.imagetest.CustomClickActivity.java

License:Apache License

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
    setContentView(R.layout.video);/*  ww  w . j a v  a 2s  .c o  m*/
    preview = (SurfaceView) findViewById(R.id.surface);
    text = (TextView) findViewById(R.id.text);
    ClickButton = (ImageButton) findViewById(R.id.imageButton1);

    myTimer = new Timer();
    myTimer.schedule(new TimerTask() {
        @Override
        public void run() {
            TimerMethod();
        }

    }, 0, 5000);

    saveDirectory.delete();

    saveDirectory.mkdirs();

    imageNumber++;

    holder = preview.getHolder();
    holder.addCallback(this);
    holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}

From source file:com.nekomeshi312.whiteboardcorrection.WhiteBoardCorrectionActivity.java

License:Open Source License

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    // TODO Auto-generated method stub
    super.onWindowFocusChanged(hasFocus);
    //view??????/*from  www. j  av  a  2s . c  o  m*/
    if (hasFocus) {
        if (mFragCameraView == null || mFragCameraView.isDetached()) {
            transitToCameraViewFragment();
            OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
        }
    }
}

From source file:com.wallerlab.compcellscope.MultiModeViewActivity.java

License:BSD License

@Override
public void onResume() {
    super.onResume();
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
}

From source file:edu.ucla.cs213a.whatwasyourname.HomeActivity.java

License:Apache License

protected void onResume() {
    super.onResume();
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
}

From source file:in.fabinpaul.sixthsense.SixthSenseActivity.java

License:Apache License

@Override
public void onResume() {
    super.onResume();
    if (hasPermissions)
        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
}

From source file:in.fabinpaul.sixthsense.SixthSenseActivity.java

License:Apache License

@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
    switch (requestCode) {
    case REQUEST_CAMERA_PERMISSION: {
        if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

            OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);

        } else {/* ww w  .  ja v  a  2 s.  co m*/

            AlertDialog ad = new AlertDialog.Builder(this).create();
            ad.setCancelable(false); // This blocks the 'BACK' button
            ad.setMessage(
                    "It seems that you device does not support camera (or it is locked). Application will be closed.");
            ad.setButton(DialogInterface.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    finish();
                }
            });
            ad.show();
        }
        return;
    }

    // other 'case' lines to check for other
    // permissions this app might request
    }
}

From source file:org.ar.rubik.AndroidActivity.java

License:Open Source License

@Override
public void onResume() {
    super.onResume();
    if (gLSurfaceView != null)
        gLSurfaceView.onResume();//from  w  w w . j a  v  a2 s  .com
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
}

From source file:org.mixare.MixView.java

License:Open Source License

@Override
protected void onResume() {
    super.onResume();
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
    try {//from   ww  w.  j a va 2  s.c om
        this.getMixViewData().getmWakeLock().acquire();

        killOnError();
        getMixViewData().getMixContext().doResume(this);

        repaint();
        getDataView().doStart();
        getDataView().clearEvents();

        getMixViewData().getMixContext().getDataSourceManager().refreshDataSources();

        float angleX, angleY;

        int marker_orientation = -90;

        int rotation = Compatibility.getRotation(this);

        // display text from left to right and keep it horizontal
        angleX = (float) Math.toRadians(marker_orientation);
        getMixViewData().getM1().set(1f, 0f, 0f, 0f, (float) FloatMath.cos(angleX),
                (float) -FloatMath.sin(angleX), 0f, (float) FloatMath.sin(angleX),
                (float) FloatMath.cos(angleX));
        angleX = (float) Math.toRadians(marker_orientation);
        angleY = (float) Math.toRadians(marker_orientation);
        if (rotation == 1) {
            getMixViewData().getM2().set(1f, 0f, 0f, 0f, (float) FloatMath.cos(angleX),
                    (float) -FloatMath.sin(angleX), 0f, (float) FloatMath.sin(angleX),
                    (float) FloatMath.cos(angleX));
            getMixViewData().getM3().set((float) FloatMath.cos(angleY), 0f, (float) FloatMath.sin(angleY), 0f,
                    1f, 0f, (float) -FloatMath.sin(angleY), 0f, (float) FloatMath.cos(angleY));
        } else {
            getMixViewData().getM2().set((float) FloatMath.cos(angleX), 0f, (float) FloatMath.sin(angleX), 0f,
                    1f, 0f, (float) -FloatMath.sin(angleX), 0f, (float) FloatMath.cos(angleX));
            getMixViewData().getM3().set(1f, 0f, 0f, 0f, (float) FloatMath.cos(angleY),
                    (float) -FloatMath.sin(angleY), 0f, (float) FloatMath.sin(angleY),
                    (float) FloatMath.cos(angleY));

        }

        getMixViewData().getM4().toIdentity();

        for (int i = 0; i < getMixViewData().getHistR().length; i++) {
            getMixViewData().getHistR()[i] = new Matrix();
        }

        getMixViewData().setSensorMgr((SensorManager) getSystemService(SENSOR_SERVICE));

        getMixViewData().setSensors(getMixViewData().getSensorMgr().getSensorList(Sensor.TYPE_ACCELEROMETER));
        if (getMixViewData().getSensors().size() > 0) {
            getMixViewData().setSensorGrav(getMixViewData().getSensors().get(0));
        }

        getMixViewData().setSensors(getMixViewData().getSensorMgr().getSensorList(Sensor.TYPE_MAGNETIC_FIELD));
        if (getMixViewData().getSensors().size() > 0) {
            getMixViewData().setSensorMag(getMixViewData().getSensors().get(0));
        }

        getMixViewData().getSensorMgr().registerListener(this, getMixViewData().getSensorGrav(),
                SENSOR_DELAY_GAME);
        getMixViewData().getSensorMgr().registerListener(this, getMixViewData().getSensorMag(),
                SENSOR_DELAY_GAME);

        try {
            GeomagneticField gmf = getMixViewData().getMixContext().getLocationFinder().getGeomagneticField();
            angleY = (float) Math.toRadians(-gmf.getDeclination());
            getMixViewData().getM4().set((float) FloatMath.cos(angleY), 0f, (float) FloatMath.sin(angleY), 0f,
                    1f, 0f, (float) -FloatMath.sin(angleY), 0f, (float) FloatMath.cos(angleY));
        } catch (Exception ex) {
            Log.d("mixare", "GPS Initialize Error", ex);
        }

        getMixViewData().getMixContext().getDownloadManager().switchOn();
        getMixViewData().getMixContext().getLocationFinder().switchOn();
    } catch (Exception ex) {
        doError(ex);
        try {
            if (getMixViewData().getSensorMgr() != null) {
                getMixViewData().getSensorMgr().unregisterListener(this, getMixViewData().getSensorGrav());
                getMixViewData().getSensorMgr().unregisterListener(this, getMixViewData().getSensorMag());
                getMixViewData().setSensorMgr(null);
            }

            if (getMixViewData().getMixContext() != null) {
                getMixViewData().getMixContext().getLocationFinder().switchOff();
                getMixViewData().getMixContext().getDownloadManager().switchOff();
            }
        } catch (Exception ignore) {
        }
    }

    Log.d("-------------------------------------------", "resume");
    if (getDataView().isFrozen() && getMixViewData().getSearchNotificationTxt() == null) {
        getMixViewData().setSearchNotificationTxt(new TextView(this));
        getMixViewData().getSearchNotificationTxt().setWidth(getdWindow().getWidth());
        getMixViewData().getSearchNotificationTxt().setPadding(10, 2, 0, 0);
        getMixViewData().getSearchNotificationTxt().setText(getString(R.string.search_active_1) + " "
                + DataSourceList.getDataSourcesStringList() + getString(R.string.search_active_2));
        ;
        getMixViewData().getSearchNotificationTxt().setBackgroundColor(Color.DKGRAY);
        getMixViewData().getSearchNotificationTxt().setTextColor(Color.WHITE);

        getMixViewData().getSearchNotificationTxt().setOnTouchListener(this);
        addContentView(getMixViewData().getSearchNotificationTxt(),
                new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    } else if (!getDataView().isFrozen() && getMixViewData().getSearchNotificationTxt() != null) {
        getMixViewData().getSearchNotificationTxt().setVisibility(View.GONE);
        getMixViewData().setSearchNotificationTxt(null);
    }
}

From source file:tesis.ekfmonoslam.SplashActivity.java

License:Open Source License

@Override
protected void onResume() {
    super.onResume();

    if (!OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, _opencvLoaderCallback)) {
        Log.e(TAG, "No se pudo cargar la libreria OpenCV.");
        Toast.makeText(SplashActivity.this, "No se pudo cargar la libreria OpenCV.", Toast.LENGTH_LONG).show();
    }/*  ww w. j ava  2 s .c o  m*/
}