Android OpenCV: Resource ID found for attribute 'camera_id' in package

I have OpenCV and Android installed in my Eclipse. Below is one of my layout files:

<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="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <org.opencv.android.JavaCameraView android:layout_width="fill_parent" android:layout_height="fill_parent" android:visibility="gone" android:id="@+id/hello" opencv:show_fps="true" opencv:camera_id="any" /> </LinearLayout> 

The Eclipse compiler complains:

 No resource identifier found for attribute 'show_fps' in package No resource identifier found for attribute 'camera_id' in package 
+6
source share
3 answers

Add the following resource file to the project values ​​file:

 attrs.xml 

with the following content:

 <?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name = "CameraBridgeViewBase" > <attr name="show_fps" format="boolean"/> <attr name="camera_id" format="integer" > <enum name="any" value="-1" /> <enum name="back" value="0" /> <enum name="front" value="1" /> </attr> </declare-styleable> </resources> 
+6
source

Two previously asked answers to this question, in my opinion, are bandids for a real problem. When I came across this error message, I needed to change some project properties.

  • Right-click the project and select "Properties"
  • Select "Android" in the tree
  • Make sure that the OpenCV library is present and there is a green checkmark next to it in the "Library" section (see image below).

Successfully linked OpenCV Library

If the OpenCV library is missing or there is a red X next to it, you need to fix the library dependency. For this:

  • Delete the broken library (if necessary)
  • Click "Add" and select "OpenCV Library"
  • If the OpenCV library is missing, you need to add the library to the project
+1
source

you did not give a value for these variables or did not declare in the opencv class.

  opencv { show_fps="true" camera_id="any" } First assign the those two variables globally with necessary values.... 
0
source

Source: https://habr.com/ru/post/951346/


All Articles