1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 07:13:02 +04:00

Fixed Android samples; Fixed bugs in cmake (java module).

This commit is contained in:
Andrey Kamaev
2011-07-19 17:07:01 +00:00
parent fd4fe3ef5a
commit 930b2995eb
17 changed files with 183 additions and 81 deletions
@@ -1,6 +1,13 @@
package org.opencv.samples.tutorial2;
import org.opencv.*;
import org.opencv.android;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.imgproc.Imgproc;
import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture;
import android.content.Context;
import android.graphics.Bitmap;
@@ -31,17 +38,17 @@ class Sample2View extends SampleCvViewBase {
protected Bitmap processFrame(VideoCapture capture) {
switch (Sample2NativeCamera.viewMode) {
case Sample2NativeCamera.VIEW_MODE_GRAY:
capture.retrieve(mGray, highgui.CV_CAP_ANDROID_GREY_FRAME);
imgproc.cvtColor(mGray, mRgba, imgproc.COLOR_GRAY2RGBA, 4);
capture.retrieve(mGray, Highgui.CV_CAP_ANDROID_GREY_FRAME);
Imgproc.cvtColor(mGray, mRgba, Imgproc.COLOR_GRAY2RGBA, 4);
break;
case Sample2NativeCamera.VIEW_MODE_RGBA:
capture.retrieve(mRgba, highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA);
core.putText(mRgba, "OpenCV + Android", new Point(10, 100), 3/* CV_FONT_HERSHEY_COMPLEX */, 2, new Scalar(255, 0, 0, 255), 3);
capture.retrieve(mRgba, Highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA);
Core.putText(mRgba, "OpenCV + Android", new Point(10, 100), 3/* CV_FONT_HERSHEY_COMPLEX */, 2, new Scalar(255, 0, 0, 255), 3);
break;
case Sample2NativeCamera.VIEW_MODE_CANNY:
capture.retrieve(mGray, highgui.CV_CAP_ANDROID_GREY_FRAME);
imgproc.Canny(mGray, mIntermediateMat, 80, 100);
imgproc.cvtColor(mIntermediateMat, mRgba, imgproc.COLOR_GRAY2BGRA, 4);
capture.retrieve(mGray, Highgui.CV_CAP_ANDROID_GREY_FRAME);
Imgproc.Canny(mGray, mIntermediateMat, 80, 100);
Imgproc.cvtColor(mIntermediateMat, mRgba, Imgproc.COLOR_GRAY2BGRA, 4);
break;
}
@@ -2,7 +2,9 @@ package org.opencv.samples.tutorial2;
import java.util.List;
import org.opencv.*;
import org.opencv.core.Size;
import org.opencv.highgui.VideoCapture;
import org.opencv.highgui.Highgui;
import android.content.Context;
import android.graphics.Bitmap;
@@ -46,15 +48,15 @@ public abstract class SampleCvViewBase extends SurfaceView implements SurfaceHol
}
}
mCamera.set(highgui.CV_CAP_PROP_FRAME_WIDTH, mFrameWidth);
mCamera.set(highgui.CV_CAP_PROP_FRAME_HEIGHT, mFrameHeight);
mCamera.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, mFrameWidth);
mCamera.set(Highgui.CV_CAP_PROP_FRAME_HEIGHT, mFrameHeight);
}
}
}
public void surfaceCreated(SurfaceHolder holder) {
Log.i(TAG, "surfaceCreated");
mCamera = new VideoCapture(highgui.CV_CAP_ANDROID);
mCamera = new VideoCapture(Highgui.CV_CAP_ANDROID);
if (mCamera.isOpened()) {
(new Thread(this)).start();
} else {