| API Reference > Accusoft.BarcodeXpress.Nodejs > Functions > analyze |
Performs barcode analyzing on an image.
|
Copy Code
|
|
|---|---|
var bx = require('barcode-js'); bx.analyze(params, function(err, results) { /* ... */ }); |
|
| params | A set of options that are used to tune the barcode analysis process. |
| err | Either undefined or an error message describing an error that occurred with recognition. |
| results | Results object representing recognized barcode results. |
|
Copy Code
|
|
|---|---|
// call bx.analyze to detect barcodes in the image // all detected barcodes will be returned to the // result object array. var bx = require('barcode-js'); var params = { input: 'path/filename.ext', type: [ 'code128', 'code39'] } bx.analyze(params, function(err, results) { if(err) { console.error("There was an error analyzing the barcode", err); return; } else { results.forEach(function(item){ console.log("area: x=%d, y=%d, width=%d, height=%d", item.area.x, item.area.y, item.area.width, item.area.height ); console.log("type: %s", item.type); console.log("value: %s", item.value); console.log("corners: topLeftPoint(%d, %d), topRightPoint(%d, %d), bottomRightPoint(%d, %d), bottomLeftPoint(%d, %d)", item.corners[0].x, item.corners[0].y, item.corners[1].x, item.corners[1].y,item.corners[2].x, item.corners[2].y,item.corners[3].x, item.corners[3].y); console.log("confidence: %d", item.confidence); }) } }); |
|