B4A Library Face detection with Google Mobile Vision API

The attached project (partially) wraps this Github project. In order to set it up you must follow this post (https://www.b4x.com/android/forum/threads/android-vision-barcode-reader-scan-qr-codes-and-other-1d-2d-barcodes.66408/) BUT use the attached B4A library files and B4A sample project:


You will initially need an internet connection as some "downloading" needs to take place before the face detection artefacts becomes visible. Note that it will not show immediately when you start the project - give it a minute or so after you have started the project and the detector artefacts will start showing.

Set the paths to the below correctly (inside the B4A project) to reflect your setup:
B4X:
#AdditionalRes: C:\Users\----------2\Documents\Basic 4 Android\JOHAN APPS\JHS LIBS\resource\b4a_appcompat, de.amberhome.objects.appcompat
#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\android\support\design\res, android.support.design

Also posting the java code as it stands at present. Change it to your liking...

You can also try the Google Mobile Vision API barcode scanner that I have posted HERE

You can download and test it but if you want to use it then you need to

1.png



2.png



NOTE THE DETECTED HAPPINESS INDEX....:)
3.png
 

Attachments

  • TheJavaCode.zip
    42.4 KB · Views: 513
  • AndroidVisionFaceTrackerLibFiles.zip
    17.5 KB · Views: 629
  • b4aAndroidVisionFaceTracker.zip
    34.8 KB · Views: 657
Last edited:

Johan Schoeman

Expert
Licensed User
it is been several days trying to run the project
my question is
when i run it i get

B4A version: 5.80
Parsing code. (0.00s)
Compiling code. (0.07s)
Compiling layouts code. (0.00s)
Generating R file. Error
ERROR: resource directory 'c:\andriod_sdk_tools\extras\android\support\design\res' does not exist
when i comment out the following lines

#AdditionalRes: C:\Users\----------2\Documents\Basic 4 Android\JOHAN APPS\JHS LIBS\resource\b4a_appcompat, de.amberhome.objects.appcompat
#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\android\support\design\res, android.support.design
i get
B4A version: 5.80
Parsing code. (0.01s)
Compiling code. (0.03s)
Compiling layouts code. (0.01s)
Generating R file. Error
..\resource\values\themes.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat'.
..\resource\values\themes.xml:6: error: Error: No resource found that matches the given name: attr 'colorAccent'.
..\resource\values\themes.xml:4: error: Error: No resource found that matches the given name: attr 'colorPrimary'.
..\resource\values\themes.xml:5: error: Error: No resource found that matches the given name: attr 'colorPrimaryDark'.
and finaly when i coment out
'#AdditionalRes: ..\resource
i get
B4A version: 5.80
Parsing code. (0.00s)
Compiling code. (0.04s)
Compiling layouts code. (0.00s)
Generating R file. Error
AndroidManifest.xml:22: error: Error: No resource found that matches the given name (at 'theme' with value '@style/MyAppTheme').
AndroidManifest.xml:27: error: Error: No resource found that matches the given name (at 'value' with value '@@Integer/google_play_services_version').
can you give me some guide lines how to run it?
See my answer in the PM that you have sent me - you need to update your SDK
 

rscheel

Well-Known Member
Licensed User
Hello dear, how can I get the data values of eyes to know if they are closed or open, so I can make a sound if the eyes are closed.
 

coslad

Well-Known Member
Licensed User
Hi, is there any way to detect children face to obscure them for privacy reasons? Thanks
 

Johan Schoeman

Expert
Licensed User
Hi, is there any way to detect children face to obscure them for privacy reasons? Thanks
It finds faces. It does not discriminate between adult and children faces.
 
Last edited:

sasidhar

Active Member
Licensed User
OK - I have zipped the complete folder that I have been working with. It includes:
1. The Java Code
2. The B4A project
3. All the required library files
4. The source folder that needs to be in the B4A project (it should now be there by default)

The only other folder that is required is the attached folder than needs to be copied to the root of your additional library folder.

You can download the complete zipped project from here: https://www.dropbox.com/s/2btbfl3dgakgu7x/FaceTracker.zip?dl=0

Hi @Johan Schoeman,

I have downloaded code, followed steps, while compiling i am getting this error. can anyone help.


B4A Version: 9.80
Java Version: 8
Parsing code. (0.01s)
Building folders structure. (0.03s)
Compiling code. (0.23s)
Compiling layouts code. (0.10s)
Organizing libraries. (0.00s)
(Android Support Library)
Generating R file. Error
c:\android\extras\android\support\v7\appcompat\res\values-v23\styles_base.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
c:\android\extras\android\support\v7\appcompat\res\values-v23\styles_base_text.xml:19: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.


thanks
Sasidhar.M
 

DonManfred

Expert
Licensed User
1. You always should create a new thread for any Issue.
Posting to existing threads is a mistake.

2. I guess you need to switch to AndroidX. Android Support Libraries are deprecated for some time.

 

Zkshazly

Member
Licensed User
Hello,
Sorry, I am very new for B4a
Where Can I find the folder of <ANDRIOD_SDK_TOOLS> or its Alternative for below files



Set the paths to the below correctly (inside the B4A project) to reflect your setup:
B4X:
#AdditionalRes: C:\Users\----------2\Documents\Basic 4 Android\JOHAN APPS\JHS LIBS\resource\b4a_appcompat, de.amberhome.objects.appcompat
#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\android\support\design\res, android.support.design
 
Top