Merge pull request #759 from asmorkalov:android_common_fixes
This commit is contained in:
commit
7c402d1e15
@ -278,6 +278,7 @@ macro(add_android_project target path)
|
|||||||
if (NATIVE_APP_GLUE)
|
if (NATIVE_APP_GLUE)
|
||||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||||
list(APPEND android_proj_jni_files ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
list(APPEND android_proj_jni_files ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||||
|
ocv_warnings_disable(CMAKE_C_FLAGS -Wstrict-prototypes -Wunused-parameter -Wmissing-prototypes)
|
||||||
set(android_proj_NATIVE_DEPS ${android_proj_NATIVE_DEPS} android)
|
set(android_proj_NATIVE_DEPS ${android_proj_NATIVE_DEPS} android)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -54,6 +54,9 @@ public abstract class CameraBridgeViewBase extends SurfaceView implements Surfac
|
|||||||
public CameraBridgeViewBase(Context context, int cameraId) {
|
public CameraBridgeViewBase(Context context, int cameraId) {
|
||||||
super(context);
|
super(context);
|
||||||
mCameraIndex = cameraId;
|
mCameraIndex = cameraId;
|
||||||
|
getHolder().addCallback(this);
|
||||||
|
mMaxWidth = MAX_UNSPECIFIED;
|
||||||
|
mMaxHeight = MAX_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CameraBridgeViewBase(Context context, AttributeSet attrs) {
|
public CameraBridgeViewBase(Context context, AttributeSet attrs) {
|
||||||
|
@ -60,7 +60,6 @@ public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallb
|
|||||||
|
|
||||||
public JavaCameraView(Context context, AttributeSet attrs) {
|
public JavaCameraView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
Log.d(TAG, "Java camera view ctor");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean initializeCamera(int width, int height) {
|
protected boolean initializeCamera(int width, int height) {
|
||||||
@ -237,10 +236,8 @@ public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallb
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onPreviewFrame(byte[] frame, Camera arg1) {
|
public void onPreviewFrame(byte[] frame, Camera arg1) {
|
||||||
Log.i(TAG, "Preview Frame received. Need to create MAT and deliver it to clients");
|
Log.d(TAG, "Preview Frame received. Frame size: " + frame.length);
|
||||||
Log.i(TAG, "Frame size is " + frame.length);
|
synchronized (this) {
|
||||||
synchronized (this)
|
|
||||||
{
|
|
||||||
mFrameChain[1 - mChainIdx].put(0, 0, frame);
|
mFrameChain[1 - mChainIdx].put(0, 0, frame);
|
||||||
this.notify();
|
this.notify();
|
||||||
}
|
}
|
||||||
@ -248,8 +245,7 @@ public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallb
|
|||||||
mCamera.addCallbackBuffer(mBuffer);
|
mCamera.addCallbackBuffer(mBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class JavaCameraFrame implements CvCameraViewFrame
|
private class JavaCameraFrame implements CvCameraViewFrame {
|
||||||
{
|
|
||||||
public Mat gray() {
|
public Mat gray() {
|
||||||
return mYuvFrameData.submat(0, mHeight, 0, mWidth);
|
return mYuvFrameData.submat(0, mHeight, 0, mWidth);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user