java - Using ZBar (Android) SDK, My Application Is Getting Different ISBNs From The Same Book -


i creating application using zbar sdk on android scan books , isbn. have gotten work on physical side. press button, scanner window pops , scans bar code.

the problem comes when application gets isbn scanner, seems scanner either reading bar code incorrectly or not pulling in right data. know how fix issue? thanks. below relevant code, , few screens

    @override public void onclick(view v)  {     //todo add functionallity     if(v.getid() == r.id.scanbutton)     {         intent intent = new intent(this, zbarscanneractivity.class);         intent.putextra(zbarconstants.scan_modes, new int[]{symbol.isbn10, symbol.isbn13, symbol.ean8, symbol.ean13 });         startactivityforresult(intent, zbar_scanner_request);      }  } @override protected void onactivityresult(int requestcode, int resultcode, intent data) {         if (resultcode == result_ok)      {         // scan result available making call data.getstringextra(zbarconstants.scan_result)         // type of scan result available making call data.getstringextra(zbarconstants.scan_result_type)         contenttext.settext("isbn: " + data.getstringextra(zbarconstants.scan_result));         toast.maketext(this, "scan result = " + data.getstringextra(zbarconstants.scan_result), toast.length_short).show();          toast.maketext(this, "scan result type = " + data.getstringextra(zbarconstants.scan_result_type), toast.length_short).show();         // value of type indicates 1 of symbols listed in advanced options below.     }      else if(resultcode == result_canceled)      {         toast.maketext(this, "scanning cancelled", toast.length_short).show();     } } 

first screen

second screen

offending bar code

we have been using zbar in production in 1 of our desktop applications. in extract barcode image , use it. though different yours issue same extract barcode live stream.

the issue facing prevalent , error prone. , depends on picture. (in fact observe same behavior zxing, eymbarcode , other open source ones. stable 1 found this). had resort image taking guidelines. below quality factors use avoid it:

the following factors determine detection ability of application:

  1. resolution
  2. focus
  3. lighting , exposure
  4. noise

hence essential above 4 taken care of while picture taken.

  1. resolution: desired barcode occupy significant portion on image. long linear barcodes or dense 2-d symbols, 1 have increase resolution. if resolution decreases below 2 pixels, hard scan barcode.

  2. focus: blurred images highly undesired. portion of barcode consisting of blurry part lead inability of detection.

  3. lighting , exposure: image bright or overexposed can wash out barcodes. image dark or underexposed not provide sufficient contrast scanner. low light levels tend produce noisier images.

  4. noise: random variation of brightness/color can make difficult scan barcode.

  5. angle: preferred have barcode placed either horizontally or vertically placed.

  6. tilt: preferred if camera placed perpendicular image.

the above not solve problems, hope helps


Comments

Popular posts from this blog

ruby on rails - Is it the correct way to implement belongs_to relation with factory girl? -

geolocation - Windows Phone 8 - Keeping background location tracking active beyond four hours -

Uncaught TypeError: Cannot read property 'parentNode' of null javascript -