Feb 18, 2018 Replies: 46 Better solution: https://www.b4x.com/android/forum/threads/160725/#content This is not really a library. It is a modification to CameraEx example that adds barcode detection based on Google Play Services Vision. It uses JavaObject to create the detector and detect barcodes in the Preview event. You should call CreateDetector with the formats you want to detect. Fewer codes will yield faster detections. List of formats is available here: https://developers.google.com/andro...d/gms/vision/barcode/Barcode#constant-summary The implementation is quite simplistic as it is done on the main thread. It works good on Nexus 5X. I haven't tested it on low end devices. Note that you should add this code to the manifest editor: Code: <meta-data android:name="com.google.android.gms.vision.DEPENDENCIES" android:value="barcode" /> Attachments BarcodeCamera.zip BarcodeCamera.zip 13.6 KB · Views: 3,606 Last edited: Jul 18, 2024 Click to expand...
Better solution: https://www.b4x.com/android/forum/threads/160725/#content This is not really a library. It is a modification to CameraEx example that adds barcode detection based on Google Play Services Vision. It uses JavaObject to create the detector and detect barcodes in the Preview event. You should call CreateDetector with the formats you want to detect. Fewer codes will yield faster detections. List of formats is available here: https://developers.google.com/andro...d/gms/vision/barcode/Barcode#constant-summary The implementation is quite simplistic as it is done on the main thread. It works good on Nexus 5X. I haven't tested it on low end devices. Note that you should add this code to the manifest editor: Code: <meta-data android:name="com.google.android.gms.vision.DEPENDENCIES" android:value="barcode" />
Micholl Member Licensed User Longtime User Feb 28, 2018 #21 Hello Erel, sorry - just discovered another strange behaviour: It seems that the result array of barcodes in Camera1_Preview always returns all recognised barcodes - not necessary only those which are currently seen (when I cover 1 of 3 barcodes I always get the payload of 3 barcodes back). Should this array be new initialized from preview to preview? Thank you, Michael
Hello Erel, sorry - just discovered another strange behaviour: It seems that the result array of barcodes in Camera1_Preview always returns all recognised barcodes - not necessary only those which are currently seen (when I cover 1 of 3 barcodes I always get the payload of 3 barcodes back). Should this array be new initialized from preview to preview? Thank you, Michael
Erel B4X founder Staff member Licensed User Longtime User Mar 1, 2018 #22 Micholl said: Should this array be new initialized from preview to preview? Click to expand... No. It is returned from the detector. I don't see this behavior here. It only returns the currently detected barcodes.
Micholl said: Should this array be new initialized from preview to preview? Click to expand... No. It is returned from the detector. I don't see this behavior here. It only returns the currently detected barcodes.
Erel B4X founder Staff member Licensed User Longtime User Mar 1, 2018 #23 New version was uploaded. The detected rectangle is drawn. I've locked the orientation to landscape to make it simpler.
New version was uploaded. The detected rectangle is drawn. I've locked the orientation to landscape to make it simpler.
J john1in2 Member Licensed User Mar 2, 2018 #24 Hi, I am very new to this- I can successfully use this to read bar codes, but the image/scanning window stays on all the time. How to you exit from the image/preview panel to another screen after a successful detection? For example after a bar code is detected, add it to a list and switch to another panel that shows the list of bar codes that you have captured, with a button which allows you back to the bar code detection preview Last edited: Mar 2, 2018
Hi, I am very new to this- I can successfully use this to read bar codes, but the image/scanning window stays on all the time. How to you exit from the image/preview panel to another screen after a successful detection? For example after a bar code is detected, add it to a list and switch to another panel that shows the list of bar codes that you have captured, with a button which allows you back to the bar code detection preview
Erel B4X founder Staff member Licensed User Longtime User Mar 4, 2018 #25 Please start a new thread for this question.
J Juanmavalero Member Licensed User Longtime User Mar 21, 2018 #26 Hello, the proyect sample put me this library error: Artefacto de Maven no encontrado: com.google.android.gms/play-services-vision
Hello, the proyect sample put me this library error: Artefacto de Maven no encontrado: com.google.android.gms/play-services-vision
Erel B4X founder Staff member Licensed User Longtime User Mar 22, 2018 #27 Make sure to use B4A Sdk Manager to manage Android SDK. It will work.
J Juanmavalero Member Licensed User Longtime User Mar 22, 2018 #28 Erel said: Make sure to use B4A Sdk Manager to manage Android SDK. It will work. Click to expand... Thanks you, I did It and It work ok, excuse my inexperience
Erel said: Make sure to use B4A Sdk Manager to manage Android SDK. It will work. Click to expand... Thanks you, I did It and It work ok, excuse my inexperience
Beja Expert Licensed User Longtime User May 16, 2018 #29 Hi Erel, Back to this post.. today I tried it and I found it the same as the camera example.. it didn't raise an event or returned the detected barcode value. am I missing something? Is it possible that you limit the example just to the barcode.. Thank you
Hi Erel, Back to this post.. today I tried it and I found it the same as the camera example.. it didn't raise an event or returned the detected barcode value. am I missing something? Is it possible that you limit the example just to the barcode.. Thank you
DonManfred Expert Licensed User Longtime User May 16, 2018 #30 Beja said: Is it possible that you limit the example just to the barcode.. Click to expand... The Example is configured for Code: Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("1") If FirstTime Then CreateDetector (Array("CODE_128", "CODE_93")) End If cvs.Initialize(pnlDrawing) End Sub CODE_128 and CODE_93 Barcodes. You may add other possible Values to the Array. Check the Google Documentation for a list Edit to Add: RTFM In #1 is a Link: https://developers.google.com/andro...d/gms/vision/barcode/Barcode#constant-summary
Beja said: Is it possible that you limit the example just to the barcode.. Click to expand... The Example is configured for Code: Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("1") If FirstTime Then CreateDetector (Array("CODE_128", "CODE_93")) End If cvs.Initialize(pnlDrawing) End Sub CODE_128 and CODE_93 Barcodes. You may add other possible Values to the Array. Check the Google Documentation for a list Edit to Add: RTFM In #1 is a Link: https://developers.google.com/andro...d/gms/vision/barcode/Barcode#constant-summary
uniplan Active Member Licensed User Longtime User Jun 26, 2018 #31 I try it but I have: "Is detector operational: false" and I'm not able to scan barcode.
Erel B4X founder Staff member Licensed User Longtime User Jun 27, 2018 #32 Which formats have you passed to CreateDetector? Was the device connected to the internet when you tested it? It might need to download some data. https://developers.google.com/andro...ector.Detections.html#detectorIsOperational()
Which formats have you passed to CreateDetector? Was the device connected to the internet when you tested it? It might need to download some data. https://developers.google.com/andro...ector.Detections.html#detectorIsOperational()
uniplan Active Member Licensed User Longtime User Jun 27, 2018 #33 Erel said: Which formats have you passed to CreateDetector? Was the device connected to the internet when you tested it? It might need to download some data. https://developers.google.com/andro...ector.Detections.html#detectorIsOperational() Click to expand... I try: Code: CreateDetector (Array("CODE_128", "CODE_93")) CreateDetector (Array("ALL_FORMATS")) CreateDetector (Array("EAN_13")) but I have all the same result. Yes the device was connected to the internet when I tested.
Erel said: Which formats have you passed to CreateDetector? Was the device connected to the internet when you tested it? It might need to download some data. https://developers.google.com/andro...ector.Detections.html#detectorIsOperational() Click to expand... I try: Code: CreateDetector (Array("CODE_128", "CODE_93")) CreateDetector (Array("ALL_FORMATS")) CreateDetector (Array("EAN_13")) but I have all the same result. Yes the device was connected to the internet when I tested.
Roberto P. Well-Known Member Licensed User Longtime User Jul 5, 2018 #34 Hello to all why this example does not work with a Samsung Tab S4 tablet? thank you roberto
Erel B4X founder Staff member Licensed User Longtime User Jul 5, 2018 #35 What happens when you run it?
Roberto P. Well-Known Member Licensed User Longtime User Jul 5, 2018 #36 Nothing is happening. With the smartphone it reads the barcodes automatically.
Erel B4X founder Staff member Licensed User Longtime User Jul 5, 2018 #37 Have you checked the logs for any error?
Roberto P. Well-Known Member Licensed User Longtime User Jul 5, 2018 #38 of course. does nothing. It almost seems like you do not hear the camera. while, if I click the photo works.
of course. does nothing. It almost seems like you do not hear the camera. while, if I click the photo works.
Erel B4X founder Staff member Licensed User Longtime User Jul 5, 2018 #39 If you are not seeing the preview feed then the problem is related to the camera. Worth trying the default camera example. See if it works.
If you are not seeing the preview feed then the problem is related to the camera. Worth trying the default camera example. See if it works.
Roberto P. Well-Known Member Licensed User Longtime User Jul 5, 2018 #40 I see the video, but the event that intercepts the reading of the bar code does not start. I ran the same app on both smartphones and tablets. only difference I see is that the app asks me to confirm access to the camera the tablet no.
I see the video, but the event that intercepts the reading of the bar code does not start. I ran the same app on both smartphones and tablets. only difference I see is that the app asks me to confirm access to the camera the tablet no.