Java Code Examples for org.opencv.android.CameraBridgeViewBase#setCvCameraViewListener()
The following examples show how to use
org.opencv.android.CameraBridgeViewBase#setCvCameraViewListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From MOAAP with MIT License | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "called onCreate"); super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_main); if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { Log.i("permission", "request READ_EXTERNAL_STORAGE"); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CAMERA}, REQUEST_CAMERA); }else { Log.i("permission", "READ_EXTERNAL_STORAGE already granted"); camera_granted = true; } mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.main_activity_surface_view); mOpenCvCameraView.setCvCameraViewListener(this); }
Example 2
Source File: MainActivity.java From MOAAP with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { Log.i(TAG, "called onCreate"); super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_main); if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { Log.i("permission", "request READ_EXTERNAL_STORAGE"); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CAMERA}, REQUEST_CAMERA); }else { Log.i("permission", "READ_EXTERNAL_STORAGE already granted"); camera_granted = true; } mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.java_surface_view); mOpenCvCameraView.setCvCameraViewListener(this); }
Example 3
Source File: MainActivity.java From OpenCV-Android-Object-Detection with MIT License | 6 votes |
/** * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "called onCreate"); super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.layout); if(ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, REQUEST_PERMISSION); } mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial1_activity_java_surface_view); mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE); mOpenCvCameraView.setCvCameraViewListener(this); tvName = (TextView) findViewById(R.id.text1); }
Example 4
Source File: GabrielClientActivity.java From faceswap with Apache License 2.0 | 6 votes |
private void init_once() { Log.d(DEBUG_TAG, "on init once"); renderer = new CVRenderer(this); mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.cv_camera_view); mOpenCvCameraView.setVisibility(CameraBridgeViewBase.VISIBLE); mOpenCvCameraView.setCvCameraViewListener(renderer); // cameraOverlay = (CameraOverlay) findViewById(R.id.display_surface); // cameraOverlay.bringToFront(); // mPreview = (CameraPreview) findViewById(R.id.camera_preview); // if (Const.DISPLAY_PREVIEW_ONLY) { // RelativeLayout.LayoutParams invisibleLayout = new RelativeLayout.LayoutParams(0, 0); // mDisplay.setLayoutParams(invisibleLayout); // mDisplay.setVisibility(View.INVISIBLE); // mDisplay.setZOrderMediaOverlay(false); // } // mPreview.setPreviewCallback(previewCallback); // cameraOverlay.setImageSize(mPreview.imageSize); Const.ROOT_DIR.mkdirs(); Const.LATENCY_DIR.mkdirs(); hasStarted = true; }
Example 5
Source File: CameraActivity.java From Android-Car-duino with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { Log.i(TAG, "called onCreate"); super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.camera_activity); mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.CameraView); //mOpenCvCameraView.setMaxFrameSize(240,135); mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE); mOpenCvCameraView.setCvCameraViewListener(this); detector = new GestureDetector(this); debugConsole = (TextView) findViewById(R.id.debugConsole); if(blue.btEnabled) { try { bt.runBT(); } catch (IOException e) { e.printStackTrace(); } } }
Example 6
Source File: MainActivity.java From opencv-android-sample with MIT License | 6 votes |
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "called onCreate"); super.onCreate(savedInstanceState); // Load ndk built module, as specified // in moduleName in build.gradle System.loadLibrary("native"); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_main); mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.camera_view); mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE); mOpenCvCameraView.setCvCameraViewListener(this); }
Example 7
Source File: Tutorial2Activity.java From OpenCV-AndroidSamples with MIT License | 6 votes |
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "called onCreate"); super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_tutorial2); mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial2_activity_surface_view); mOpenCvCameraView.setCvCameraViewListener(this); }
Example 8
Source File: FaceDetectionActivity.java From OpenCV-AndroidSamples with MIT License | 5 votes |
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "called onCreate"); super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_face_detection); mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.fd_activity_surface_view); mOpenCvCameraView.setCvCameraViewListener(this); }
Example 9
Source File: Tutorial1Activity.java From OpenCV-AndroidSamples with MIT License | 5 votes |
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "called onCreate"); super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_tutorial1); mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial1_activity_java_surface_view); mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE); mOpenCvCameraView.setCvCameraViewListener(this); }
Example 10
Source File: CameraCalibrationActivity.java From OpenCV-AndroidSamples with MIT License | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "called onCreate"); super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_camera_calibration); mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.camera_calibration_java_surface_view); mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE); mOpenCvCameraView.setCvCameraViewListener(this); }
Example 11
Source File: ColorBlobDetectionActivity.java From OpenCV-AndroidSamples with MIT License | 5 votes |
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "called onCreate"); super.onCreate(savedInstanceState); //requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_color_blob_detection); mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.color_blob_detection_activity_surface_view); mOpenCvCameraView.setCvCameraViewListener(this); }
Example 12
Source File: Puzzle15Activity.java From OpenCV-AndroidSamples with MIT License | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); Log.d(TAG, "Creating and setting view"); mOpenCvCameraView = (CameraBridgeViewBase) new JavaCameraView(this, -1); setContentView(mOpenCvCameraView); mOpenCvCameraView.setCvCameraViewListener(this); mPuzzle15 = new Puzzle15Processor(); mPuzzle15.prepareNewGame(); }
Example 13
Source File: ImageManipulationsActivity.java From OpenCV-AndroidSamples with MIT License | 5 votes |
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "called onCreate"); super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_image_manipulations); mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.image_manipulations_activity_surface_view); mOpenCvCameraView.setCvCameraViewListener(this); }
Example 14
Source File: VisionEnabledActivity.java From FTCVision with MIT License | 5 votes |
protected final void initializeVision(int framePreview, TestableVisionOpMode opMode) { openCVCamera = (CameraBridgeViewBase) findViewById(framePreview); openCVCamera.setVisibility(SurfaceView.VISIBLE); openCVCamera.setCvCameraViewListener(this); this.opMode = opMode; opMode.sensors = new Sensors(); opMode.fps = new FPS(); //FIXME this is the line that causes glitchiness TestableVisionOpMode.openCVCamera = (JavaCameraView) openCVCamera; }
Example 15
Source File: MainActivity.java From MOAAP with MIT License | 5 votes |
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_main); if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { Log.i("permission", "request CAMERA"); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CAMERA}, REQUEST_CAMERA); }else { Log.i("permission", "CAMERA already granted"); camera_granted = true; } if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { Log.i("permission", "request EXTERNAL_STROAGE"); ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, REQUEST_EXTERNAL_STROAGE); }else { Log.i("permission", "EXTERNAL_STROAGE already granted"); read_external_storage_granted = true; } OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_2_0, this, mLoaderCallback); mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.java_surface_view); mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE); mOpenCvCameraView.setCvCameraViewListener(this); Log.d("OCR", "onCreate done"); }
Example 16
Source File: DetectActivity.java From FaceDetectDemo with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initWindowSettings(); setContentView(R.layout.activity_detect); cameraView = (CameraBridgeViewBase) findViewById(R.id.camera_view); cameraView.setCvCameraViewListener(this); // 设置相机监听 initClassifier(); cameraView.enableView(); Button switchCamera = (Button) findViewById(R.id.switch_camera); switchCamera.setOnClickListener(this); // 切换相机镜头,默认后置 }
Example 17
Source File: FDOpenCVPresenter.java From Image-Detection-Samples with Apache License 2.0 | 4 votes |
public void setCamera(CameraBridgeViewBase openCvCameraView) { openCvCameraView.setVisibility(SurfaceView.VISIBLE); openCvCameraView.setMaxFrameSize(MAX_WIDTH, MAX_HEIGHT); openCvCameraView.setCvCameraViewListener(this); }