Skip to content

Commit

Permalink
Release 24.4 (#87)
Browse files Browse the repository at this point in the history
* Add ScanBarcode endpoint

* Version 24.4.0
  • Loading branch information
Denis-Averin authored Apr 29, 2024
1 parent dd19e2f commit 63c5cd2
Show file tree
Hide file tree
Showing 14 changed files with 439 additions and 197 deletions.
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![npm](https://img.shields.io/npm/v/aspose-barcode-cloud-node)](https://www.npmjs.com/package/aspose-barcode-cloud-node)

+ API version: 3.0
+ Package version: 24.3.0
+ Package version: 24.4.0

## Demo applications

Expand Down Expand Up @@ -52,8 +52,8 @@ async function generateBarcode(api) {
const request = new Barcode.GetBarcodeGenerateRequest(
Barcode.EncodeBarcodeType.QR,
'Aspose.BarCode for Cloud Sample');
request.textLocation = "None";
request.textLocation = Barcode.CodeLocation.None;

const oneBarcode = await api.getBarcodeGenerate(request);

const fileName = 'QR.png'
Expand All @@ -62,14 +62,11 @@ async function generateBarcode(api) {
return fileName;
}

async function recognizeBarcode(api, fileName) {
const request = new Barcode.PostBarcodeRecognizeFromUrlOrContentRequest();
request.image = fs.readFileSync(fileName);
request.type = Barcode.DecodeBarcodeType.QR;
request.preset = Barcode.PresetType.HighPerformance;
request.fastScanOnly = true;
async function scanBarcode(api, fileName) {
const request = new Barcode.ScanBarcodeRequest(fs.readFileSync(fileName));
request.decodeTypes = [Barcode.DecodeBarcodeType.QR];

const result = await api.postBarcodeRecognizeFromUrlOrContent(request);
const result = await api.scanBarcode(request);

return result.body.barcodes;
}
Expand All @@ -82,7 +79,7 @@ generateBarcode(api)
console.log('Barcode saved to ' + fileName);

console.log('Trying to recognize barcode...');
recognizeBarcode(api, fileName)
scanBarcode(api, fileName)
.then(barcodes => {
console.log('Recognized barcodes are:');
console.log(JSON.stringify(barcodes, null, 2));
Expand Down Expand Up @@ -122,6 +119,7 @@ BarcodeApi | [**postGenerateMultiple**](docs/index.md#postgeneratemultiple) | **
BarcodeApi | [**putBarcodeGenerateFile**](docs/index.md#putbarcodegeneratefile) | **PUT** /barcode/{name}/generate | Generate barcode and save on server (from query params or from file with json or xml content)
BarcodeApi | [**putBarcodeRecognizeFromBody**](docs/index.md#putbarcoderecognizefrombody) | **PUT** /barcode/{name}/recognize | Recognition of a barcode from file on server with parameters in body.
BarcodeApi | [**putGenerateMultiple**](docs/index.md#putgeneratemultiple) | **PUT** /barcode/{name}/generateMultiple | Generate image with multiple barcodes and put new file on server
BarcodeApi | [**scanBarcode**](docs/index.md#scanbarcode) | **POST** /barcode/scan | Quickly scan a barcode from an image.
FileApi | [**copyFile**](docs/index.md#copyfile) | **PUT** /barcode/storage/file/copy/{srcPath} | Copy file
FileApi | [**deleteFile**](docs/index.md#deletefile) | **DELETE** /barcode/storage/file/{path} | Delete file
FileApi | [**downloadFile**](docs/index.md#downloadfile) | **GET** /barcode/storage/file/{path} | Download file
Expand Down
26 changes: 24 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Name | Type | Description | Notes
**allowAdditionalRestorations** | **boolean**| Allows engine using additional image restorations to recognize corrupted barcodes. At this time, it is used only in MicroPdf417 barcode type. Default value: False. | [optional]
**regionLikelihoodThresholdPercent** | **number**| Sets threshold for detected regions that may contain barcodes. Value 0.7 means that bottom 70% of possible regions are filtered out and not processed further. Region likelihood threshold must be between [0.05, 0.9] Use high values for clear images with few barcodes. Use low values for images with many barcodes or for noisy images. Low value may lead to a bigger recognition time. | [optional]
**scanWindowSizes** | **Array<number>**| Scan window sizes in pixels. Allowed sizes are 10, 15, 20, 25, 30. Scanning with small window size takes more time and provides more accuracy but may fail in detecting very big barcodes. Combining of several window sizes can improve detection quality. | [optional]
**similarity** | **number**| Similarity coefficient depends on how homogeneous barcodes are. Use high value for for clear barcodes. Use low values to detect barcodes that ara partly damaged or not lighten evenly. Similarity coefficient must be between [0.5, 0.9] | [optional]
**similarity** | **number**| Similarity coefficient depends on how homogeneous barcodes are. Use high value for clear barcodes. Use low values to detect barcodes that ara partly damaged or not lighten evenly. Similarity coefficient must be between [0.5, 0.9] | [optional]
**skipDiagonalSearch** | **boolean**| Allows detector to skip search for diagonal barcodes. Setting it to false will increase detection time but allow to find diagonal barcodes that can be missed otherwise. Enabling of diagonal search leads to a bigger detection time. | [optional]
**readTinyBarcodes** | **boolean**| Allows engine to recognize tiny barcodes on large images. Ignored if AllowIncorrectBarcodes is set to True. Default value: False. | [optional]
**australianPostEncodingTable** | 'CTable', 'NTable', 'Other' | Interpreting Type for the Customer Information of AustralianPost BarCode.Default is CustomerInformationInterpretingType.Other. | [optional]
Expand Down Expand Up @@ -158,7 +158,7 @@ Name | Type | Description | Notes
**allowAdditionalRestorations** | **boolean**| Allows engine using additional image restorations to recognize corrupted barcodes. At this time, it is used only in MicroPdf417 barcode type. Default value: False. | [optional]
**regionLikelihoodThresholdPercent** | **number**| Sets threshold for detected regions that may contain barcodes. Value 0.7 means that bottom 70% of possible regions are filtered out and not processed further. Region likelihood threshold must be between [0.05, 0.9] Use high values for clear images with few barcodes. Use low values for images with many barcodes or for noisy images. Low value may lead to a bigger recognition time. | [optional]
**scanWindowSizes** | **Array<number>**| Scan window sizes in pixels. Allowed sizes are 10, 15, 20, 25, 30. Scanning with small window size takes more time and provides more accuracy but may fail in detecting very big barcodes. Combining of several window sizes can improve detection quality. | [optional]
**similarity** | **number**| Similarity coefficient depends on how homogeneous barcodes are. Use high value for for clear barcodes. Use low values to detect barcodes that ara partly damaged or not lighten evenly. Similarity coefficient must be between [0.5, 0.9] | [optional]
**similarity** | **number**| Similarity coefficient depends on how homogeneous barcodes are. Use high value for clear barcodes. Use low values to detect barcodes that ara partly damaged or not lighten evenly. Similarity coefficient must be between [0.5, 0.9] | [optional]
**skipDiagonalSearch** | **boolean**| Allows detector to skip search for diagonal barcodes. Setting it to false will increase detection time but allow to find diagonal barcodes that can be missed otherwise. Enabling of diagonal search leads to a bigger detection time. | [optional]
**readTinyBarcodes** | **boolean**| Allows engine to recognize tiny barcodes on large images. Ignored if AllowIncorrectBarcodes is set to True. Default value: False. | [optional]
**australianPostEncodingTable** | 'CTable', 'NTable', 'Other' | Interpreting Type for the Customer Information of AustralianPost BarCode.Default is CustomerInformationInterpretingType.Other. | [optional]
Expand Down Expand Up @@ -299,6 +299,28 @@ Name | Type | Description | Notes

---

### scanBarcode

Quickly scan a barcode from an image.

```ts
scanBarcode(imageFile: Buffer): BarcodeResponseList;
```

#### BarcodeApi.scanBarcode parameters

Name | Type | Description | Notes
---- | ---- | ------------ | -----
**imageFile** | **Buffer**| Image as file |
**decodeTypes** | **Array<DecodeBarcodeType>**| Types of barcode to recognize | [optional]
**timeout** | **number**| Timeout of recognition process in milliseconds. Default value is 15_000 (15 seconds). Maximum value is 30_000 (1/2 minute). In case of a timeout RequestTimeout (408) status will be returned. Try reducing the image size to avoid timeout. | [optional]

#### BarcodeApi.scanBarcode return type

[**BarcodeResponseList**](models.md#BarcodeResponseList)

---

## class FileApi

### copyFile
Expand Down
4 changes: 2 additions & 2 deletions docs/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ AustralianPost barcode parameters.
interface AustralianPostParams {

/**
* Interpreting type for the Customer Information of AustralianPost, default to CustomerInformationInterpretingType.Other\"
* Interpreting type for the Customer Information of AustralianPost, default to CustomerInformationInterpretingType.Other
*/
encodingTable?: CustomerInformationInterpretingType;

Expand Down Expand Up @@ -2213,7 +2213,7 @@ interface ReaderParams {
scanWindowSizes?: Array<number>;

/**
* Similarity coefficient depends on how homogeneous barcodes are. Use high value for for clear barcodes. Use low values to detect barcodes that ara partly damaged or not lighten evenly. Similarity coefficient must be between [0.5, 0.9]
* Similarity coefficient depends on how homogeneous barcodes are. Use high value for clear barcodes. Use low values to detect barcodes that ara partly damaged or not lighten evenly. Similarity coefficient must be between [0.5, 0.9]
*/
similarity?: number;

Expand Down
15 changes: 7 additions & 8 deletions example.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ async function generateBarcode(api) {
const request = new Barcode.GetBarcodeGenerateRequest(
Barcode.EncodeBarcodeType.QR,
'Aspose.BarCode for Cloud Sample');
request.textLocation = Barcode.CodeLocation.None;

const oneBarcode = await api.getBarcodeGenerate(request);

const fileName = 'QR.png'
Expand All @@ -20,14 +22,11 @@ async function generateBarcode(api) {
return fileName;
}

async function recognizeBarcode(api, fileName) {
const request = new Barcode.PostBarcodeRecognizeFromUrlOrContentRequest();
request.image = fs.readFileSync(fileName);
request.type = Barcode.DecodeBarcodeType.QR;
request.preset = Barcode.PresetType.HighPerformance;
request.fastScanOnly = true;
async function scanBarcode(api, fileName) {
const request = new Barcode.ScanBarcodeRequest(fs.readFileSync(fileName));
request.decodeTypes = [Barcode.DecodeBarcodeType.QR];

const result = await api.postBarcodeRecognizeFromUrlOrContent(request);
const result = await api.scanBarcode(request);

return result.body.barcodes;
}
Expand All @@ -40,7 +39,7 @@ generateBarcode(api)
console.log('Barcode saved to ' + fileName);

console.log('Trying to recognize barcode...');
recognizeBarcode(api, fileName)
scanBarcode(api, fileName)
.then(barcodes => {
console.log('Recognized barcodes are:');
console.log(JSON.stringify(barcodes, null, 2));
Expand Down
Loading

0 comments on commit 63c5cd2

Please sign in to comment.