From 8782914fc813e17d6941c77026bf468e29f0346a Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Thu, 21 Jul 2011 09:57:46 +0000 Subject: [PATCH] Aded setPreviewDisplay call to java camera samples --- .../src/org/opencv/samples/tutorial0/SampleViewBase.java | 6 ++++++ .../src/org/opencv/samples/tutorial1/SampleViewBase.java | 6 ++++++ .../src/org/opencv/samples/tutorial3/SampleViewBase.java | 6 ++++++ .../src/org/opencv/samples/tutorial4/SampleViewBase.java | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/samples/android/tutorial-0-androidcamera/src/org/opencv/samples/tutorial0/SampleViewBase.java b/samples/android/tutorial-0-androidcamera/src/org/opencv/samples/tutorial0/SampleViewBase.java index 837f9f118f..05800baff5 100644 --- a/samples/android/tutorial-0-androidcamera/src/org/opencv/samples/tutorial0/SampleViewBase.java +++ b/samples/android/tutorial-0-androidcamera/src/org/opencv/samples/tutorial0/SampleViewBase.java @@ -1,5 +1,6 @@ package org.opencv.samples.tutorial0; +import java.io.IOException; import java.util.List; import android.content.Context; @@ -58,6 +59,11 @@ public abstract class SampleViewBase extends SurfaceView implements SurfaceHolde params.setPreviewSize(getFrameWidth(), getFrameHeight()); mCamera.setParameters(params); + try { + mCamera.setPreviewDisplay(null); + } catch (IOException e) { + Log.e(TAG, "mCamera.setPreviewDisplay fails: " + e); + } mCamera.startPreview(); } } diff --git a/samples/android/tutorial-1-addopencv/src/org/opencv/samples/tutorial1/SampleViewBase.java b/samples/android/tutorial-1-addopencv/src/org/opencv/samples/tutorial1/SampleViewBase.java index e424859e96..45f39d0ca4 100644 --- a/samples/android/tutorial-1-addopencv/src/org/opencv/samples/tutorial1/SampleViewBase.java +++ b/samples/android/tutorial-1-addopencv/src/org/opencv/samples/tutorial1/SampleViewBase.java @@ -1,5 +1,6 @@ package org.opencv.samples.tutorial1; +import java.io.IOException; import java.util.List; import android.content.Context; @@ -58,6 +59,11 @@ public abstract class SampleViewBase extends SurfaceView implements SurfaceHolde params.setPreviewSize(getFrameWidth(), getFrameHeight()); mCamera.setParameters(params); + try { + mCamera.setPreviewDisplay(null); + } catch (IOException e) { + Log.e(TAG, "mCamera.setPreviewDisplay fails: " + e); + } mCamera.startPreview(); } } diff --git a/samples/android/tutorial-3-native/src/org/opencv/samples/tutorial3/SampleViewBase.java b/samples/android/tutorial-3-native/src/org/opencv/samples/tutorial3/SampleViewBase.java index 962fe693ea..83af4ca72b 100644 --- a/samples/android/tutorial-3-native/src/org/opencv/samples/tutorial3/SampleViewBase.java +++ b/samples/android/tutorial-3-native/src/org/opencv/samples/tutorial3/SampleViewBase.java @@ -1,5 +1,6 @@ package org.opencv.samples.tutorial3; +import java.io.IOException; import java.util.List; import android.content.Context; @@ -58,6 +59,11 @@ public abstract class SampleViewBase extends SurfaceView implements SurfaceHolde params.setPreviewSize(getFrameWidth(), getFrameHeight()); mCamera.setParameters(params); + try { + mCamera.setPreviewDisplay(null); + } catch (IOException e) { + Log.e(TAG, "mCamera.setPreviewDisplay fails: " + e); + } mCamera.startPreview(); } } diff --git a/samples/android/tutorial-4-mixed/src/org/opencv/samples/tutorial4/SampleViewBase.java b/samples/android/tutorial-4-mixed/src/org/opencv/samples/tutorial4/SampleViewBase.java index fb18441413..a0d474c549 100644 --- a/samples/android/tutorial-4-mixed/src/org/opencv/samples/tutorial4/SampleViewBase.java +++ b/samples/android/tutorial-4-mixed/src/org/opencv/samples/tutorial4/SampleViewBase.java @@ -1,5 +1,6 @@ package org.opencv.samples.tutorial4; +import java.io.IOException; import java.util.List; import android.content.Context; @@ -58,6 +59,11 @@ public abstract class SampleViewBase extends SurfaceView implements SurfaceHolde params.setPreviewSize(getFrameWidth(), getFrameHeight()); mCamera.setParameters(params); + try { + mCamera.setPreviewDisplay(null); + } catch (IOException e) { + Log.e(TAG, "mCamera.setPreviewDisplay fails: " + e); + } mCamera.startPreview(); } }