Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV android camera preview with custom layout?

I want to add a button to the opencvcamera preview, but the button isnt visible and the Preview still fills the whole screen. Is there a way to make a custom layout where the OpenCV camera preview does not fill the whole scrren to display an additional button?

<linearlayout 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" <="" p="">

    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="horizontal">

    <org.opencv.android.NativeCameraView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:id="@+id/HelloOpenCvView"
        opencv:show_fps="true"
        opencv:camera_id="any" />

   <Button
    android:id="@+id/takepicture"  
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text=" * Take Picture " 
    android:layout_gravity="bottom|right"
    android:layout_margin="10px"
    />

 </LinearLayout >

OpenCV android camera preview with custom layout?

I want to add a button to the opencvcamera preview, but the button isnt visible and the Preview still fills the whole screen. Is there a way to make a custom layout where the OpenCV camera preview does not fill the whole scrren to display an additional button?

<linearlayout 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" <="" p="">

 <LinearLayout  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" 
     android:orientation="horizontal">

     <org.opencv.android.NativeCameraView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:visibility="gone"
         android:id="@+id/HelloOpenCvView"
         opencv:show_fps="true"
         opencv:camera_id="any" />

    <Button
     android:id="@+id/takepicture"  
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text=" * Take Picture " 
     android:layout_gravity="bottom|right"
     android:layout_margin="10px"
     />

  </LinearLayout >