java - Barcode location while scanning -


i'm using app redlaser library barcode scanning (which built off zxing, believe). working fine, while in scanning mode, barcode comes within view scanned, don't want that, want barcodes aligned in scanning area considered , rest ignored.

the redlaser sample app, after implemented library in own app, had rectangle on layout of scanning activiy, ignored, barcodes part of screen scanned , taken account sample app.

bottom line: want scanning activity compare location of detected barcode , see if within bounds of "scanning area", if not won't read.

barcode scanning

here code adjustment of "scanning area":

     viewfinderview = findviewbyid(r.id.view_finder);         layoutparams params = new layoutparams((int)(mdisplay.getwidth() * .75f),                  (int)(mdisplay.getheight() * .33f));         params.gravity = gravity.center;         viewfinderview.setlayoutparams(params); 

the following code doesn't anything, wrote exemplify how works (since don't have source files redlaser library), barcodelocation.

            set<barcoderesult> allresults = (set<barcoderesult>) scanstatus.get(status.status_found_barcodes);             for( barcoderesult  s : allresults)             {                 arraylist<pointf> barcodelocation = s.barcodelocation;                 float x = barcodelocation.get(0).x;                 float y = barcodelocation.get(0).y; //there 4 points each scanned barcode => 8 float's/barcode             } 

sorry long post, i've been on issue while , i'm stuck.

any appreciated!

managed find solution on redlaser site: turning view rect comparing barcode location using .contain :

rect scanningarea = new rect(viewfinderview.getleft(), viewfinderview.gettop(), viewfinderview.getright(), viewfinderview.getbottom()); if(latestresult.iterator().hasnext())         {              boolean isinside = true;             arraylist<pointf> barcodelocation = latestresult.iterator().next().barcodelocation;             (int = 0; < barcodelocation.size(); i++)              {                 int x = (int) barcodelocation.get(i).x;                 int y = (int) barcodelocation.get(i).y;                 if (!scanningarea.contains(x, y))                  {                     isinside = false;                 }             }             if (isinside)              {             //do stuff here              }          } 

i'm still working on few issues, question answered now. gonna go ahead , give myself pat on back. :)


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -