Android Question Add bitmap feature to MobileVision library?

Syd Wright

Well-Known Member
Licensed User
I am now experimenting with the Barcode feature of MobileVision (excellent library by Don Manfred)
Would it be possible to also create a means to derive a Barcode from a bitmap?
Like with the OCR I want to use my own Camera routines in stead of Google Vision's camera that cannot be controlled by B4A code.

The ultimate aim is to make a speaking Barcode reader for blind users.
A good online database to convert barcodes to product descriptions is:
https://barcodesdatabase.org/ and: https://www.buycott.com/upc/
 

DonManfred

Expert
Licensed User
Check V1.24 of the library. I added a scanbitmap to the barcode-detector too.
And a new result-event with a List of all Barcodes (each one in a Map).
 
Upvote 0

Syd Wright

Well-Known Member
Licensed User
Here is the code that I am now using:
B4X:
Sub DOE_BARCODE1
    ZegText = "Start Barcode"
    TTS1.Stop
    TTS1.Speak(ZegText,True)
 
    If barcode.isOperational Then
      'barcode.takePicture
      Dim bmp As Bitmap
      bmp.Initialize(File.DirInternal,PicName1)
      If Orient1=1 Then bmp = BitmapExt1.rotateBitmap(bmp,90)   'Dit werkt!

      Xscale1 = bmp.Width/LayOutVal1.Width
      Yscale1 = bmp.Height/LayOutVal1.Height
      barcode.scanBitmap(bmp)
    End If
End Sub

Sub Barcode_Result(info As String, scanresults As List)
    Log(info)
   Try
    For i = 0 To scanresults.Size-1
      Log(scanresults.Get(i))
    Next
   Catch
        Log("Error in Barcode_Result")
   End Try
End Sub
Similar to the TXT version, the Barcode_Results sub needs Try-Catch-End Try because in the first instance a "scanlist not initialized" error occurs.

PS: To find the structure of this event I had to look in the MobileVision.xml file.

The Rect (barcode positions) are not reported. Maybe that can be added?
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
The Rect (barcode positions) are not reported. Maybe that can be added?
It is there. Is is the Value cornerPoints of the Map.
But i changed it now to be a List of Maps. This is probably easier to use in B4A.
Watch out for V1.5+ (not yet uploaded)
 
Upvote 0
Top