sonic-widget 2.6.2 → 2.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  Use this script tag to get access to the widget:
13
13
 
14
14
  ```html
15
- <script src="https://cdn.jsdelivr.net/npm/sonic-widget@2.6.2/dist/index.min.js"></script>
15
+ <script src="https://cdn.jsdelivr.net/npm/sonic-widget@2.6.6/dist/index.min.js"></script>
16
16
  ```
17
17
 
18
18
  or
@@ -39,7 +39,7 @@ and adding path in `angular.json`
39
39
  2. Use this script tag to get access to the widget at initial html page:
40
40
 
41
41
  ```html
42
- <script src="https://cdn.jsdelivr.net/npm/sonic-widget@2.6.2/dist/index.min.js"></script>
42
+ <script src="https://cdn.jsdelivr.net/npm/sonic-widget@2.6.6/dist/index.min.js"></script>
43
43
  ```
44
44
 
45
45
  or
@@ -99,6 +99,7 @@ ngOnInit(): void {
99
99
  blinkThreshold: number, // used for blink threshold
100
100
  objectPersonThreshold: number, // used for object Person score threshold
101
101
  objectPhoneThreshold: number, // used for object Phone score threshold
102
+ grayscalePercentageThreshold: number, // used for black&white percentage score threshold
102
103
  onMessage: function (data) {}, // callback function, when api response message or error or any other actions
103
104
  };
104
105
 
@@ -233,7 +234,7 @@ it can be added in `angular.json` by installing the npm package
233
234
  4. Add a Script tag to the head tag or body tag. And use the latest version.
234
235
 
235
236
  ```html
236
- <script src="https://cdn.jsdelivr.net/npm/sonic-widget@2.6.2/dist/index.min.js"></script>
237
+ <script src="https://cdn.jsdelivr.net/npm/sonic-widget@2.6.6/dist/index.min.js"></script>
237
238
  ```
238
239
 
239
240
  5. Next, add the script tag at a necessary place. But add below the widget script.
@@ -266,6 +267,7 @@ it can be added in `angular.json` by installing the npm package
266
267
  blinkThreshold: number, // threshold used to calculate the user blinked or not, with range limit 0-1(default value is 0.4)
267
268
  objectPersonThreshold: number, // used for object Person score threshold with range limit 0-1(default value is 0.925)
268
269
  objectPhoneThreshold: number, // used for object Phone score threshold with range limit 0-1(default value is 0.5)
270
+ grayscalePercentageThreshold: number, // used for black&white percentage score threshold with range limit 0-100(default value is 90)
269
271
  onMessage: function (data) {}, // callback function, when api response message or error or any other actions
270
272
  };
271
273
  // get the element used in the action button
@@ -318,7 +320,27 @@ Check with **`data.code`**_
318
320
  - _**`blinkThreshold`** is used to pass a numerical value. It is used to check the user blinks (range 0-1 and default 0.5)._
319
321
  - _**`objectPersonThreshold`** is used to pass a numerical value. It is used to check the image person as object found with required score as threshold (range 0-1 and default 0.925)._
320
322
  - _**`objectPhoneThreshold`** is used to pass a numerical value. It is used to check the image phone/laptop as object found with required score as threshold (range 0-1 and default 0.5)._
323
+ - _**`grayscalePercentageThreshold`** is used to pass a numerical value for percentage. It is used to check the image color as black&white found with required percentage as threshold (range 0-100 and default 90)._
321
324
  - _**`onMessage`** is a callback function. It is getting called when the API gives a message or at any configuration error. Return data is an object with its API endpoint and result._
322
325
 
323
326
 
324
327
  <!-- use node 18 and install packages using yarn and do yarn dev -->
328
+
329
+
330
+ <!-- GrayScale Suggestions
331
+
332
+ 1. RGB Difference Threshold for Grayscale Detection:
333
+
334
+ Low Threshold: A low threshold (e.g., 5-10) is good if you want to consider any slight variation in color as an indication that the image is colored. This is more sensitive to minor color differences.
335
+
336
+ Moderate Threshold: A threshold of around 10-20 is a more balanced approach. It allows for small variations due to noise or minor imperfections in grayscale images but still classifies them as black and white.
337
+
338
+ High Threshold: A higher threshold (e.g., 20-50) will classify images as grayscale even if there are noticeable color variations, which might be acceptable for images that are predominantly black and white but have some color noise or artifacts.
339
+
340
+ 2. Percentage of Grayscale Pixels:
341
+
342
+ After detecting grayscale pixels, you need to determine the percentage of grayscale pixels required to classify the image as black and white.
343
+
344
+ 80-90% Grayscale Pixels: This threshold means that if 80-90% of the pixels are grayscale, the image will be classified as black and white. This works well for documents and images that are mostly grayscale but may have some minor color elements (e.g., stamps, logos).
345
+
346
+ 90-100% Grayscale Pixels: This is a stricter threshold, ensuring that the image is classified as black and white only if nearly all pixels are grayscale. -->