image-js 0.35.2 → 0.35.3

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.
Files changed (169) hide show
  1. package/index.d.ts +2 -9
  2. package/lib/browser/environment.js +0 -6
  3. package/lib/browser/worker/extend.js +0 -3
  4. package/lib/browser/worker/process/background.js +0 -12
  5. package/lib/browser/worker/worker.js +0 -17
  6. package/lib/image/Image.js +18 -51
  7. package/lib/image/compute/colorHistogram.js +0 -8
  8. package/lib/image/compute/countAlphaPixels.js +0 -3
  9. package/lib/image/compute/extendedPoints.js +2 -7
  10. package/lib/image/compute/histogram.js +6 -25
  11. package/lib/image/compute/localMaxima.js +2 -10
  12. package/lib/image/compute/max.js +0 -5
  13. package/lib/image/compute/mean.js +0 -4
  14. package/lib/image/compute/median.js +0 -4
  15. package/lib/image/compute/min.js +0 -5
  16. package/lib/image/compute/minimalBoundingRectangle.js +5 -18
  17. package/lib/image/compute/moment.js +0 -3
  18. package/lib/image/compute/monotoneChainConvexHull.js +0 -3
  19. package/lib/image/compute/points.js +0 -3
  20. package/lib/image/compute/relativePosition.js +2 -8
  21. package/lib/image/compute/sum.js +0 -5
  22. package/lib/image/core/bitMethods.js +0 -11
  23. package/lib/image/core/checkProcessable.js +0 -13
  24. package/lib/image/core/environment.js +0 -8
  25. package/lib/image/core/export.js +0 -38
  26. package/lib/image/core/extend.js +0 -13
  27. package/lib/image/core/getRGBAData.js +0 -15
  28. package/lib/image/core/kind.js +4 -28
  29. package/lib/image/core/kindNames.js +1 -0
  30. package/lib/image/core/load.js +1 -53
  31. package/lib/image/core/mediaTypes.js +0 -2
  32. package/lib/image/core/valueMethods.js +0 -13
  33. package/lib/image/extend.js +7 -83
  34. package/lib/image/filter/abs.js +0 -3
  35. package/lib/image/filter/add.js +2 -8
  36. package/lib/image/filter/background.js +0 -9
  37. package/lib/image/filter/blurFilter.js +0 -6
  38. package/lib/image/filter/divide.js +0 -8
  39. package/lib/image/filter/flipX.js +0 -5
  40. package/lib/image/filter/flipY.js +0 -4
  41. package/lib/image/filter/gaussianFilter.js +0 -5
  42. package/lib/image/filter/gradientFilter.js +0 -10
  43. package/lib/image/filter/hypotenuse.js +0 -13
  44. package/lib/image/filter/invert.js +0 -9
  45. package/lib/image/filter/level.js +1 -19
  46. package/lib/image/filter/medianFilter.js +0 -15
  47. package/lib/image/filter/multiply.js +0 -10
  48. package/lib/image/filter/scharrFilter.js +0 -4
  49. package/lib/image/filter/sobelFilter.js +0 -4
  50. package/lib/image/filter/subtract.js +0 -8
  51. package/lib/image/filter/subtractImage.js +0 -10
  52. package/lib/image/internal/checks.js +1 -9
  53. package/lib/image/internal/clamp.js +0 -1
  54. package/lib/image/internal/copy.js +0 -2
  55. package/lib/image/internal/copyAlphaChannel.js +0 -1
  56. package/lib/image/internal/getImageParameters.js +0 -1
  57. package/lib/image/internal/getOutputImage.js +1 -13
  58. package/lib/image/model/model.js +1 -1
  59. package/lib/image/morphology/blackHat.js +0 -5
  60. package/lib/image/morphology/close.js +0 -5
  61. package/lib/image/morphology/dilate.js +0 -40
  62. package/lib/image/morphology/erode.js +0 -40
  63. package/lib/image/morphology/morphologicalGradient.js +0 -5
  64. package/lib/image/morphology/open.js +0 -5
  65. package/lib/image/morphology/topHat.js +0 -5
  66. package/lib/image/operator/cannyEdge.js +0 -3
  67. package/lib/image/operator/convolution.js +9 -34
  68. package/lib/image/operator/convolutionSeparable.js +0 -10
  69. package/lib/image/operator/extract.js +4 -13
  70. package/lib/image/operator/floodFill.js +2 -15
  71. package/lib/image/operator/getSeparatedKernel.js +0 -2
  72. package/lib/image/operator/paintLabels.js +2 -13
  73. package/lib/image/operator/paintMasks.js +2 -12
  74. package/lib/image/operator/paintPoints.js +0 -9
  75. package/lib/image/operator/paintPolygon.js +0 -14
  76. package/lib/image/operator/paintPolygons.js +0 -4
  77. package/lib/image/operator/paintPolyline.js +0 -7
  78. package/lib/image/operator/paintPolylines.js +0 -4
  79. package/lib/image/roi/Roi.js +27 -207
  80. package/lib/image/roi/RoiLayer.js +1 -22
  81. package/lib/image/roi/RoiMap.js +5 -38
  82. package/lib/image/roi/creator/fromMask.js +4 -22
  83. package/lib/image/roi/creator/fromMaskConnectedComponentLabelingAlgorithm.js +2 -20
  84. package/lib/image/roi/creator/fromMaxima.js +10 -43
  85. package/lib/image/roi/creator/fromPoints.js +2 -10
  86. package/lib/image/roi/creator/fromWaterShed.js +6 -17
  87. package/lib/image/roi/feretDiameters.js +9 -21
  88. package/lib/image/roi/manager.js +30 -119
  89. package/lib/image/roi/util/commonBorderLength.js +5 -16
  90. package/lib/image/roi/util/mergeRoi.js +2 -21
  91. package/lib/image/transform/cmyk.js +0 -9
  92. package/lib/image/transform/colorDepth.js +0 -12
  93. package/lib/image/transform/crop.js +0 -20
  94. package/lib/image/transform/cropAlpha.js +0 -11
  95. package/lib/image/transform/grey.js +0 -16
  96. package/lib/image/transform/greyAlgorithms.js +1 -24
  97. package/lib/image/transform/hsl.js +0 -16
  98. package/lib/image/transform/hsv.js +0 -15
  99. package/lib/image/transform/insert.js +0 -6
  100. package/lib/image/transform/mask/huang.js +3 -18
  101. package/lib/image/transform/mask/intermodes.js +3 -14
  102. package/lib/image/transform/mask/isodata.js +0 -14
  103. package/lib/image/transform/mask/li.js +12 -42
  104. package/lib/image/transform/mask/mask.js +1 -13
  105. package/lib/image/transform/mask/maxEntropy.js +8 -25
  106. package/lib/image/transform/mask/mean.js +1 -3
  107. package/lib/image/transform/mask/minError.js +10 -21
  108. package/lib/image/transform/mask/minimum.js +0 -20
  109. package/lib/image/transform/mask/moments.js +4 -17
  110. package/lib/image/transform/mask/otsu.js +1 -7
  111. package/lib/image/transform/mask/percentile.js +0 -8
  112. package/lib/image/transform/mask/renyiEntropy.js +8 -34
  113. package/lib/image/transform/mask/shanbhag.js +8 -25
  114. package/lib/image/transform/mask/thresholdAlgorithms.js +1 -17
  115. package/lib/image/transform/mask/triangle.js +13 -29
  116. package/lib/image/transform/mask/yen.js +2 -14
  117. package/lib/image/transform/pad.js +0 -20
  118. package/lib/image/transform/resize/nearestNeighbor.js +0 -6
  119. package/lib/image/transform/resize/resize.js +0 -16
  120. package/lib/image/transform/rgba.js +0 -9
  121. package/lib/image/transform/rgba8.js +0 -3
  122. package/lib/image/transform/rotate.js +0 -29
  123. package/lib/image/transform/rotateFree.js +0 -31
  124. package/lib/image/transform/warping.js +2 -35
  125. package/lib/image/utility/combineChannels.js +0 -11
  126. package/lib/image/utility/getBestMatch.js +2 -13
  127. package/lib/image/utility/getChannel.js +0 -10
  128. package/lib/image/utility/getClosestCommonParent.js +6 -23
  129. package/lib/image/utility/getColumn.js +0 -4
  130. package/lib/image/utility/getIntersection.js +2 -18
  131. package/lib/image/utility/getMatrix.js +0 -7
  132. package/lib/image/utility/getPixelsArray.js +0 -5
  133. package/lib/image/utility/getPixelsGrid.js +0 -11
  134. package/lib/image/utility/getRow.js +0 -4
  135. package/lib/image/utility/getSimilarity.js +3 -17
  136. package/lib/image/utility/getThreshold.js +0 -4
  137. package/lib/image/utility/setBorder.js +0 -16
  138. package/lib/image/utility/setChannel.js +0 -6
  139. package/lib/image/utility/setMatrix.js +0 -6
  140. package/lib/image/utility/split.js +2 -15
  141. package/lib/index.js +0 -12
  142. package/lib/kernel/kernel.js +0 -3
  143. package/lib/kernel/laplacianOfGaussian.js +1 -7
  144. package/lib/node_modules/test/binary.js +0 -3
  145. package/lib/node_modules/test/oneRoi.js +0 -2
  146. package/lib/stack/Stack.js +2 -35
  147. package/lib/stack/compute/histogram.js +0 -4
  148. package/lib/stack/compute/histograms.js +0 -4
  149. package/lib/stack/compute/max.js +0 -3
  150. package/lib/stack/compute/median.js +0 -4
  151. package/lib/stack/compute/min.js +0 -3
  152. package/lib/stack/extend.js +1 -11
  153. package/lib/stack/transform/matchAndCrop.js +6 -19
  154. package/lib/stack/utility/averageImage.js +0 -9
  155. package/lib/stack/utility/maxImage.js +0 -7
  156. package/lib/stack/utility/minImage.js +0 -7
  157. package/lib/util/Shape.js +3 -40
  158. package/lib/util/base64.js +3 -14
  159. package/lib/util/channel.js +1 -35
  160. package/lib/util/color.js +1 -25
  161. package/lib/util/converter.js +1 -13
  162. package/lib/util/deepValue.js +0 -3
  163. package/lib/util/histogram.js +1 -12
  164. package/lib/util/kernel.js +2 -12
  165. package/lib/util/matrix.js +0 -13
  166. package/lib/util/points.js +12 -35
  167. package/lib/util/value.js +0 -7
  168. package/lib/util/zerosMatrix.js +0 -3
  169. package/package.json +1 -1
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.mean = mean;
7
7
  exports.median = median;
8
-
9
8
  /**
10
9
  * Returns the median of an histogram
11
10
  * @param {number[]} histogram
@@ -14,54 +13,44 @@ exports.median = median;
14
13
  */
15
14
  function median(histogram) {
16
15
  let total = histogram.reduce((sum, x) => sum + x);
17
-
18
16
  if (total === 0) {
19
17
  throw new Error('unreachable');
20
18
  }
21
-
22
19
  let position = 0;
23
20
  let currentTotal = 0;
24
21
  let middle = total / 2;
25
22
  let previous;
26
-
27
23
  while (true) {
28
24
  if (histogram[position] > 0) {
29
25
  if (previous !== undefined) {
30
26
  return (previous + position) / 2;
31
27
  }
32
-
33
28
  currentTotal += histogram[position];
34
-
35
29
  if (currentTotal > middle) {
36
30
  return position;
37
31
  } else if (currentTotal === middle) {
38
32
  previous = position;
39
33
  }
40
34
  }
41
-
42
35
  position++;
43
36
  }
44
37
  }
38
+
45
39
  /**
46
40
  * Retuns the mean of an histogram
47
41
  * @param {number[]} histogram
48
42
  * @return {number}
49
43
  * @private
50
44
  */
51
-
52
-
53
45
  function mean(histogram) {
54
46
  let total = 0;
55
47
  let sum = 0;
56
-
57
48
  for (let i = 0; i < histogram.length; i++) {
58
49
  total += histogram[i];
59
50
  sum += histogram[i] * i;
60
51
  }
61
-
62
52
  if (total === 0) {
63
53
  return 0;
64
54
  }
65
-
66
55
  return sum / total;
67
56
  }
@@ -4,14 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.validateKernel = validateKernel;
7
-
8
7
  var _isInteger = _interopRequireDefault(require("is-integer"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  function validateKernel(kernel) {
13
10
  let kHeight, kWidth;
14
-
15
11
  if (Array.isArray(kernel)) {
16
12
  if (Array.isArray(kernel[0])) {
17
13
  // 2D array
@@ -23,30 +19,24 @@ function validateKernel(kernel) {
23
19
  }
24
20
  } else {
25
21
  let kernelWidth = Math.sqrt(kernel.length);
26
-
27
22
  if ((0, _isInteger.default)(kernelWidth)) {
28
23
  kWidth = kHeight = Math.floor(Math.sqrt(kernel.length) / 2);
29
24
  } else {
30
25
  throw new RangeError('validateKernel: Kernel array should be a square');
31
- } // we convert the array to a matrix
32
-
33
-
26
+ }
27
+ // we convert the array to a matrix
34
28
  let newKernel = new Array(kernelWidth);
35
-
36
29
  for (let i = 0; i < kernelWidth; i++) {
37
30
  newKernel[i] = new Array(kernelWidth);
38
-
39
31
  for (let j = 0; j < kernelWidth; j++) {
40
32
  newKernel[i][j] = kernel[i * kernelWidth + j];
41
33
  }
42
34
  }
43
-
44
35
  kernel = newKernel;
45
36
  }
46
37
  } else {
47
38
  throw new Error(`validateKernel: Invalid Kernel: ${kernel}`);
48
39
  }
49
-
50
40
  return {
51
41
  kernel,
52
42
  kWidth,
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = Matrix;
7
-
8
7
  function Matrix(width, height, defaultValue) {
9
8
  const matrix = new Array(width);
10
-
11
9
  for (let x = 0; x < width; x++) {
12
10
  matrix[x] = new Array(height);
13
11
  }
14
-
15
12
  if (defaultValue) {
16
13
  for (let x = 0; x < width; x++) {
17
14
  for (let y = 0; y < height; y++) {
@@ -19,17 +16,14 @@ function Matrix(width, height, defaultValue) {
19
16
  }
20
17
  }
21
18
  }
22
-
23
19
  matrix.width = width;
24
20
  matrix.height = height;
25
21
  Object.setPrototypeOf(matrix, Matrix.prototype);
26
22
  return matrix;
27
23
  }
28
-
29
24
  Matrix.prototype.localMin = function (x, y) {
30
25
  let min = this[x][y];
31
26
  let position = [x, y];
32
-
33
27
  for (let i = Math.max(0, x - 1); i < Math.min(this.length, x + 2); i++) {
34
28
  for (let j = Math.max(0, y - 1); j < Math.min(this[0].length, y + 2); j++) {
35
29
  if (this[i][j] < min) {
@@ -38,17 +32,14 @@ Matrix.prototype.localMin = function (x, y) {
38
32
  }
39
33
  }
40
34
  }
41
-
42
35
  return {
43
36
  position: position,
44
37
  value: min
45
38
  };
46
39
  };
47
-
48
40
  Matrix.prototype.localMax = function (x, y) {
49
41
  let max = this[x][y];
50
42
  let position = [x, y];
51
-
52
43
  for (let i = Math.max(0, x - 1); i < Math.min(this.length, x + 2); i++) {
53
44
  for (let j = Math.max(0, y - 1); j < Math.min(this[0].length, y + 2); j++) {
54
45
  if (this[i][j] > max) {
@@ -57,16 +48,13 @@ Matrix.prototype.localMax = function (x, y) {
57
48
  }
58
49
  }
59
50
  }
60
-
61
51
  return {
62
52
  position: position,
63
53
  value: max
64
54
  };
65
55
  };
66
-
67
56
  Matrix.prototype.localSearch = function (x, y, value) {
68
57
  let results = [];
69
-
70
58
  for (let i = Math.max(0, x - 1); i < Math.min(this.length, x + 2); i++) {
71
59
  for (let j = Math.max(0, y - 1); j < Math.min(this[0].length, y + 2); j++) {
72
60
  if (this[i][j] === value) {
@@ -74,6 +62,5 @@ Matrix.prototype.localSearch = function (x, y, value) {
74
62
  }
75
63
  }
76
64
  }
77
-
78
65
  return results;
79
66
  };
@@ -14,7 +14,6 @@ exports.perimeter = perimeter;
14
14
  exports.rotate = rotate;
15
15
  exports.round = round;
16
16
  exports.surface = surface;
17
-
18
17
  /**
19
18
  * Rounds all the x and y values of an array of points
20
19
  * @param {Array<Array<number>>} points
@@ -26,9 +25,9 @@ function round(points) {
26
25
  points[i][0] = Math.round(points[i][0]);
27
26
  points[i][1] = Math.round(points[i][1]);
28
27
  }
29
-
30
28
  return points;
31
29
  }
30
+
32
31
  /**
33
32
  * Calculates a new point that is the difference p1 - p2
34
33
  * @param {Array<number>} p1
@@ -36,23 +35,21 @@ function round(points) {
36
35
  * @return {Array<number>}
37
36
  * @private
38
37
  */
39
-
40
-
41
38
  function difference(p1, p2) {
42
39
  return [p1[0] - p2[0], p1[1] - p2[1]];
43
40
  }
41
+
44
42
  /**
45
43
  * Normalize a point
46
44
  * @param {Array<number>} p
47
45
  * @return {Array<number>}
48
46
  * @private
49
47
  */
50
-
51
-
52
48
  function normalize(p) {
53
49
  let length = Math.sqrt(p[0] ** 2 + p[1] ** 2);
54
50
  return [p[0] / length, p[1] / length];
55
51
  }
52
+
56
53
  /**
57
54
  * We rotate an array of points
58
55
  * @param {number} radians
@@ -61,19 +58,16 @@ function normalize(p) {
61
58
  * @return {Array<Array<number>>}
62
59
  * @private
63
60
  */
64
-
65
-
66
61
  function rotate(radians, srcPoints, destPoints) {
67
62
  if (destPoints === undefined) destPoints = new Array(srcPoints.length);
68
63
  let cos = Math.cos(radians);
69
64
  let sin = Math.sin(radians);
70
-
71
65
  for (let i = 0; i < destPoints.length; ++i) {
72
66
  destPoints[i] = [cos * srcPoints[i][0] - sin * srcPoints[i][1], sin * srcPoints[i][0] + cos * srcPoints[i][1]];
73
67
  }
74
-
75
68
  return destPoints;
76
69
  }
70
+
77
71
  /**
78
72
  * Dot products of 2 points assuming vectors starting from (0,0)
79
73
  * @param {Array<number>} p1
@@ -81,11 +75,10 @@ function rotate(radians, srcPoints, destPoints) {
81
75
  * @return {number}
82
76
  * @private
83
77
  */
84
-
85
-
86
78
  function dot(p1, p2) {
87
79
  return p1[0] * p2[0] + p1[1] * p2[1];
88
80
  }
81
+
89
82
  /**
90
83
  * Returns the angle between 3 points. The first one is a common point
91
84
  * @param {Array<number>} origin
@@ -94,23 +87,20 @@ function dot(p1, p2) {
94
87
  * @return {number}
95
88
  * @private
96
89
  */
97
-
98
-
99
90
  function angle(origin, p1, p2) {
100
91
  let v1 = normalize(difference(p1, origin));
101
92
  let v2 = normalize(difference(p2, origin));
102
- let dotProduct = dot(v1, v2); // TODO this code is not correct because it may yield the opposite angle
103
-
93
+ let dotProduct = dot(v1, v2);
94
+ // TODO this code is not correct because it may yield the opposite angle
104
95
  return Math.acos(dotProduct);
105
96
  }
97
+
106
98
  /**
107
99
  * Returns the 4 points of an horizontal rectangle that includes all the points
108
100
  * @param {Array<Array<number>>} points
109
101
  * @return {Array<Array<number>>}
110
102
  * @private
111
103
  */
112
-
113
-
114
104
  function boundary(points) {
115
105
  let minMaxValues = minMax(points);
116
106
  let xMin = minMaxValues[0][0];
@@ -119,15 +109,13 @@ function boundary(points) {
119
109
  let yMax = minMaxValues[1][1];
120
110
  return [[xMin, yMin], [xMax, yMin], [xMax, yMax], [xMin, yMax]];
121
111
  }
112
+
122
113
  /**
123
114
  * Returns the perimeter represented by the points (a polygon)
124
115
  * @param {Array<Array<number>>} points
125
116
  */
126
-
127
-
128
117
  function perimeter(vertices) {
129
118
  let total = 0;
130
-
131
119
  for (let i = 0; i < vertices.length; i++) {
132
120
  let fromX = vertices[i][0];
133
121
  let fromY = vertices[i][1];
@@ -135,18 +123,15 @@ function perimeter(vertices) {
135
123
  let toY = vertices[i === vertices.length - 1 ? 0 : i + 1][1];
136
124
  total += Math.sqrt((toX - fromX) ** 2 + (toY - fromY) ** 2);
137
125
  }
138
-
139
126
  return total;
140
127
  }
128
+
141
129
  /**
142
130
  * Returns the surface represented by the points (a polygon)
143
131
  * @param {Array<Array<number>>} points
144
132
  */
145
-
146
-
147
133
  function surface(vertices) {
148
134
  let total = 0;
149
-
150
135
  for (let i = 0; i < vertices.length; i++) {
151
136
  let addX = vertices[i][0];
152
137
  let addY = vertices[i === vertices.length - 1 ? 0 : i + 1][1];
@@ -155,32 +140,29 @@ function surface(vertices) {
155
140
  total += addX * addY * 0.5;
156
141
  total -= subX * subY * 0.5;
157
142
  }
158
-
159
143
  return Math.abs(total);
160
144
  }
145
+
161
146
  /**
162
147
  * Returns 2 points with minimal and maximal XY
163
148
  * @param {Array<Array<number>>} points
164
149
  * @return {Array<Array<number>>}
165
150
  * @private
166
151
  */
167
-
168
-
169
152
  function minMax(points) {
170
153
  let xMin = +Infinity;
171
154
  let yMin = +Infinity;
172
155
  let xMax = -Infinity;
173
156
  let yMax = -Infinity;
174
-
175
157
  for (let i = 0; i < points.length; i++) {
176
158
  if (points[i][0] < xMin) xMin = points[i][0];
177
159
  if (points[i][0] > xMax) xMax = points[i][0];
178
160
  if (points[i][1] < yMin) yMin = points[i][1];
179
161
  if (points[i][1] > yMax) yMax = points[i][1];
180
162
  }
181
-
182
163
  return [[xMin, yMin], [xMax, yMax]];
183
164
  }
165
+
184
166
  /**
185
167
  * Moves the minX, minY to 0,0
186
168
  * All the points will be positive after this move
@@ -189,21 +171,16 @@ function minMax(points) {
189
171
  * @return {Array<Array<number>>}
190
172
  * @private
191
173
  */
192
-
193
-
194
174
  function moveToZeroZero(srcPoints, destPoints) {
195
175
  if (destPoints === undefined) {
196
176
  destPoints = new Array(srcPoints.length).fill(0).map(() => []);
197
177
  }
198
-
199
178
  let minMaxValues = minMax(srcPoints);
200
179
  let xMin = minMaxValues[0][0];
201
180
  let yMin = minMaxValues[0][1];
202
-
203
181
  for (let i = 0; i < srcPoints.length; i++) {
204
182
  destPoints[i][0] = srcPoints[i][0] - xMin;
205
183
  destPoints[i][1] = srcPoints[i][1] - yMin;
206
184
  }
207
-
208
185
  return destPoints;
209
186
  }
package/lib/util/value.js CHANGED
@@ -4,29 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.checkNumberArray = checkNumberArray;
7
-
8
7
  var _isArrayType = _interopRequireDefault(require("is-array-type"));
9
-
10
8
  var _Image = _interopRequireDefault(require("../image/Image"));
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
10
  function checkNumberArray(value) {
15
11
  if (!isNaN(value)) {
16
12
  if (value <= 0) {
17
13
  throw new Error('checkNumberArray: the value must be greater than 0');
18
14
  }
19
-
20
15
  return value;
21
16
  } else {
22
17
  if (value instanceof _Image.default) {
23
18
  return value.data;
24
19
  }
25
-
26
20
  if (!(0, _isArrayType.default)(value)) {
27
21
  throw new Error('checkNumberArray: the value should be either a number, array or Image');
28
22
  }
29
-
30
23
  return value;
31
24
  }
32
25
  }
@@ -4,13 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = zerosMatrix;
7
-
8
7
  function zerosMatrix(height, width) {
9
8
  let matrix = new Array(height);
10
-
11
9
  for (let i = 0; i < height; i++) {
12
10
  matrix[i] = new Array(width).fill(0);
13
11
  }
14
-
15
12
  return matrix;
16
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "image-js",
3
- "version": "0.35.2",
3
+ "version": "0.35.3",
4
4
  "description": "Image processing and manipulation in JavaScript",
5
5
  "keywords": [
6
6
  "image",