2014-07-20 4 views
-1

버튼으로 목록을 그리려고합니다. 그러나 내 앱 중 하나를 누르면 내 앱에 아무런 조치가 없습니다.onCameraFrame이 작동하지 않는 것 같습니다.

여기 내 코드입니다 :

public Mat onCameraFrame(CvCameraViewFrame inputFrame) { 
    final int viewMode = mViewMode; 
    Log.i("test", "onCameraFrame"); 
    switch (viewMode) { 
    case VIEW_MODE_GRAY: 
     title.setText("J"); 
     break; 
    case VIEW_MODE_RGBA: 
     break; 
} 
    return mRgba; 
} 

public boolean onOptionsItemSelected(MenuItem item) { 

     if (item == mItemMode1) { 
      mViewMode = VIEW_MODE_1; 
     } else if (item == mItemMode2) { 
      mViewMode = VIEW_MODE_2; 
     } else if (item == mItemMode3) { 
      mViewMode = VIEW_MODE_3; 
     } else if (item == mItemModeRTDemo) { 
      mViewMode = VIEW_MODE_RTDemo; 
     } 

     return true; 
    } 

는 사실, 내가 CamaraBridgeViewBase을 삭제 private CameraBridgeViewBase mOpenCvCameraView; .Before을 삭제, 내 목록은 문제가 내 작업을 함께 할 수있는 뭔가가 있는지 모르는 properly.I을했다.

아래는 Mat를 반환해야 내 xml 파일

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
xmlns:opencv="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" > 

<org.opencv.android.JavaCameraView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 

    opencv:show_fps="true" 
    opencv:camera_id="any" 
    android:id="@+id/tutorial2_activity_surface_view" /> 

<org.opencv.android.NativeCameraView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 

    android:id="@+id/tutorial1_activity_native_surface_view" 
    opencv:show_fps="true" 
    opencv:camera_id="any" /> 

<TextView 
    android:id="@+id/title" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentTop="true" 
    android:layout_marginLeft="39dp" 
    android:text="title" 
    android:textAppearance="?android:attr/textAppearanceMedium" /> 

답변

1

onCameraFrame()이지만, 코드하지 않습니다.

당신은

내가 반환 인수를 작성했습니다
public Mat onCameraFrame(CvCameraViewFrame inputFrame) { 
    final int viewMode = mViewMode; 
    Log.i("test", "onCameraFrame"); 
    switch (viewMode) 
    { 
    case VIEW_MODE_GRAY: 
     title.setText("J"); 
     return inputFrame.gray(); 
    case VIEW_MODE_RGBA: 
     return inputFrame.rgba(); 
    } 
} 
+0

같은 뭔가가 필요하지만, 마지막에 있습니다. 모든 경우 (4 가지 경우가 있지만 다른 2 가지는 현재 조치가 없음)가 끝났습니다. 모든 경우와 모든 경우에 수익을 올릴 수있는 차이점이 있습니까? – user4030969

관련 문제