Scan barcode/qrcodes using Google Vision

KakeKake USMember ✭✭
edited August 2017 in Xamarin.Android

Have been using the zxing barcode reader up until recently, but have had some issues making use of the front camera. Therefore, we decided to switch to using the Google Vision API.
It is working but the scanning is less than good. It is not able to find barcodes on all devices. In addition, the preview has some ratio issues and is seemingly unable to focus.

Also have not found a xamarin implementation of how-to make a boxes showing/tracking the located barcodes ( https://developers.google.com/vision/android/multi-tracker-tutorial ).

The code we use is equal to this code: https://github.com/eddydn/XamarinQrCodeCamera

Any suggestions for how-to enhance the reader and implement tracking of the barcodes?

Tagged:

Answers

  • AlbertoCAlbertoC ITMember ✭✭

    @Kake

    Have you find the best way to read barcode, i have the same problem as you had.

  • SMModarresySMModarresy USMember ✭✭

    @Kake @AlbertoC
    Any luck?

  • AlbertoCAlbertoC ITMember ✭✭

    @SMModarresy

    I use this peace of code for reading the result of the scan

    namespace iMioDocPdaEntry.Droid
    {
    [BroadcastReceiver(Enabled = true, Exported = true)]
    [IntentFilter(new[] { "com.android.action.SEND_SCAN_RESULT" })]
    public class BarCodeChiper : BroadcastReceiver
    {
    public string result { get; set; }
    public override void OnReceive(Context context, Intent intent)
    {
    //Code generator 128
    string bvalue1 = intent.GetStringExtra("Decoder_Data").TrimEnd();

            try
            {
                result = bvalue1;
    
                if (!String.IsNullOrEmpty(result))
                    MessagingCenter.Send<string, string>("iMioDocPdaEntry.Android", "BARCODE_RECEIVED", result);
            }
            catch (Exception e)
            {
                result = "data encode failed";
            }
        }
    }
    

    }

    I hope this code can help you

    Alberto C.

  • StueyStuey USMember

    @Kake said:

    It is working but the scanning is less than good. It is not able to find barcodes on all devices. In addition, the preview has some ratio issues and is seemingly unable to focus.

    @Kake - On your camera builder statement add this
    .SetAutoFocusEnabled(true);

Sign In or Register to comment.