.net - How to crop a large image to scan for barcode -


i'm developing wp8 app scan barcode using zxing. can scan barcode if image contains itf barcode. however, not working if barcode inside large image.

so guess have crop large image smaller ones apply process of scanning. correct?

so, question is: there best practice that, or need apply algorithm pick portions of large image randomly?

bellow code:

        storagefolder folder = await windows.applicationmodel.package.current.installedlocation.getfolderasync("assets");          bitmapimage bitmapimage = await getbitmapimage(folder, "largeimage.png");          writeablebitmap btmmap = new writeablebitmap(bitmapimage);         var rgb = new bitmapluminancesource(btmmap);          var hybrid = new hybridbinarizer(rgb);         binarybitmap binbitmap = new binarybitmap(hybrid);          dictionary<decodehinttype, object> zxinghints             = new dictionary<decodehinttype, object>() { { decodehinttype.try_harder, true } };          reader reader = new zxing.oned.multiformatonedreader(zxinghints);          try         {             result result = reader.decode(binbitmap);             if (result != null)             {                 this.resulttext = result.text;             }         }         catch (exception ex)         {             this.resulttext = ex.message;         } 

i suggest using lumia imaging sdk (former nokia imaging sdk) give hardware accelerated filters, cropfilter example taken page: https://msdn.microsoft.com/en-us/library/lumia.imaging.transforms.cropfilter.aspx

using (var filtereffect = new filtereffect(source)) {     // initialize filter , add filter filtereffect collection     var filter = new cropfilter(new windows.foundation.rect( 260, 210, 670, 446));      filtereffect.filters = new ifilter[] { filter };      // create target filtered image rendered     var target = new writeablebitmap(width, height);      // create new renderer outputs writeablebitmaps     using (var renderer = new writeablebitmaprenderer(filtereffect, target))     {         // render image filter(s)         await renderer.renderasync();          // set output image image control source         imagecontrol.source = target;     }      await saveeffectasync(filtereffect, "cropfilter.jpg", outputimagesize); } 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -