Search code examples
androidocrandroid-augmented-reality

ARcore and mobile-vision


I need to create an android app doing mainly two things.

1) Detect price and barcode

2) Creating AR content around the detected price/barcode

For the detection part, I use google mobile-vision and for the AR part I use ARcore. The problem I have is that Arcore doesnt allow auto focus so I dont have a good enough resolution to read the prices or bar codes.

So I was wondering if there was a standard way to do text recognition and AR in the same app.

Thank you.


Solution

  • You can implement them in the same app, on different activities. if you are using the mobile vision API. you can set the start the intent for detection with startActivityForResult and when the result is returned. you can Implement a transistion in the onActivityResult part. Since the AR depends on the detected data you can pass the information to the AR activity using putExtra. use this as a template

     fab.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Intent i = new Intent(DetectActivity.this, ScanActivity.class);
                        startActivityForResult(i, REQUEST_CODE);
    
                    }
                });
    
         @Override
            protected void onActivityResult(int requestCode, int resultCode, Intent data) {
                if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
                    if (data != null) {
    
                        final Barcode barcode = data.getParcelableExtra("barcode");
                        String rslt=barcode.displayValue;
    
    Intent intent =new Intent(DetectActivity.this, ArActivity.class);
                        intent.putExtra("link", rslt);
                        startActivity(intent);
                        finish();
    

    Hope this helps, ScanActivity is the normal Camera View SurfaceView activity that mobile vision uses