image-js 1.0.0-alpha.3 → 1.1.0
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/LICENSE +2 -2
- package/README.md +37 -0
- package/dist/image-js.esm.js +33847 -0
- package/dist/image-js.esm.js.map +1 -0
- package/dist/image-js.esm.min.js +3 -0
- package/dist/image-js.esm.min.js.map +1 -0
- package/dist/image-js.umd.js +33992 -0
- package/dist/image-js.umd.js.map +1 -0
- package/dist/image-js.umd.min.js +3 -0
- package/dist/image-js.umd.min.js.map +1 -0
- package/dist-types/image-js.d.ts +4259 -0
- package/lib/Image.d.ts +536 -179
- package/lib/Image.d.ts.map +1 -1
- package/lib/Image.js +867 -334
- package/lib/Image.js.map +1 -1
- package/lib/Mask.d.ts +378 -0
- package/lib/Mask.d.ts.map +1 -0
- package/lib/Mask.js +557 -0
- package/lib/Mask.js.map +1 -0
- package/lib/Stack.d.ts +127 -0
- package/lib/Stack.d.ts.map +1 -0
- package/lib/Stack.js +165 -0
- package/lib/Stack.js.map +1 -0
- package/lib/align/affineTransfrom/affineFitFunction.d.ts +10 -0
- package/lib/align/affineTransfrom/affineFitFunction.d.ts.map +1 -0
- package/lib/align/affineTransfrom/affineFitFunction.js +21 -0
- package/lib/align/affineTransfrom/affineFitFunction.js.map +1 -0
- package/lib/align/affineTransfrom/applyAffineTransform.d.ts +10 -0
- package/lib/align/affineTransfrom/applyAffineTransform.d.ts.map +1 -0
- package/lib/align/affineTransfrom/applyAffineTransform.js +19 -0
- package/lib/align/affineTransfrom/applyAffineTransform.js.map +1 -0
- package/lib/align/affineTransfrom/createAffineTransformModel.d.ts +10 -0
- package/lib/align/affineTransfrom/createAffineTransformModel.d.ts.map +1 -0
- package/lib/align/affineTransfrom/createAffineTransformModel.js +23 -0
- package/lib/align/affineTransfrom/createAffineTransformModel.js.map +1 -0
- package/lib/align/affineTransfrom/drawResult.d.ts +12 -0
- package/lib/align/affineTransfrom/drawResult.d.ts.map +1 -0
- package/lib/align/affineTransfrom/drawResult.js +38 -0
- package/lib/align/affineTransfrom/drawResult.js.map +1 -0
- package/lib/align/affineTransfrom/getAffineTransform.d.ts +97 -0
- package/lib/align/affineTransfrom/getAffineTransform.d.ts.map +1 -0
- package/lib/align/affineTransfrom/getAffineTransform.js +145 -0
- package/lib/align/affineTransfrom/getAffineTransform.js.map +1 -0
- package/lib/align/affineTransfrom/getEuclideanDistance.d.ts +9 -0
- package/lib/align/affineTransfrom/getEuclideanDistance.d.ts.map +1 -0
- package/lib/align/affineTransfrom/getEuclideanDistance.js +10 -0
- package/lib/align/affineTransfrom/getEuclideanDistance.js.map +1 -0
- package/lib/align/affineTransfrom/getMatrixFromPoints.d.ts +10 -0
- package/lib/align/affineTransfrom/getMatrixFromPoints.d.ts.map +1 -0
- package/lib/align/affineTransfrom/getMatrixFromPoints.js +17 -0
- package/lib/align/affineTransfrom/getMatrixFromPoints.js.map +1 -0
- package/lib/align/affineTransfrom/getPointsFromMatrix.d.ts +9 -0
- package/lib/align/affineTransfrom/getPointsFromMatrix.d.ts.map +1 -0
- package/lib/align/affineTransfrom/getPointsFromMatrix.js +13 -0
- package/lib/align/affineTransfrom/getPointsFromMatrix.js.map +1 -0
- package/lib/align/affineTransfrom/utils/getSourceWithoutMargins.d.ts +11 -0
- package/lib/align/affineTransfrom/utils/getSourceWithoutMargins.d.ts.map +1 -0
- package/lib/align/affineTransfrom/utils/getSourceWithoutMargins.js +17 -0
- package/lib/align/affineTransfrom/utils/getSourceWithoutMargins.js.map +1 -0
- package/lib/align/alignMinDifference.d.ts +25 -0
- package/lib/align/alignMinDifference.d.ts.map +1 -0
- package/lib/align/alignMinDifference.js +79 -0
- package/lib/align/alignMinDifference.js.map +1 -0
- package/lib/align/index.d.ts +3 -0
- package/lib/align/index.d.ts.map +1 -0
- package/lib/align/index.js +3 -0
- package/lib/align/index.js.map +1 -0
- package/lib/compare/add.d.ts +10 -0
- package/lib/compare/add.d.ts.map +1 -0
- package/lib/compare/add.js +32 -0
- package/lib/compare/add.js.map +1 -0
- package/lib/compare/computePsnr.d.ts +11 -0
- package/lib/compare/computePsnr.d.ts.map +1 -0
- package/lib/compare/computePsnr.js +14 -0
- package/lib/compare/computePsnr.js.map +1 -0
- package/lib/compare/computeRmse.d.ts +18 -0
- package/lib/compare/computeRmse.d.ts.map +1 -0
- package/lib/compare/computeRmse.js +30 -0
- package/lib/compare/computeRmse.js.map +1 -0
- package/lib/compare/divide.d.ts +22 -0
- package/lib/compare/divide.d.ts.map +1 -0
- package/lib/compare/divide.js +31 -0
- package/lib/compare/divide.js.map +1 -0
- package/lib/compare/index.d.ts +7 -0
- package/lib/compare/index.d.ts.map +1 -0
- package/lib/compare/index.js +7 -0
- package/lib/compare/index.js.map +1 -0
- package/lib/compare/multiply.d.ts +22 -0
- package/lib/compare/multiply.d.ts.map +1 -0
- package/lib/compare/multiply.js +28 -0
- package/lib/compare/multiply.js.map +1 -0
- package/lib/compare/subtract.d.ts +13 -0
- package/lib/compare/subtract.d.ts.map +1 -0
- package/lib/compare/subtract.js +58 -0
- package/lib/compare/subtract.js.map +1 -0
- package/lib/compute/getExtrema.d.ts +33 -0
- package/lib/compute/getExtrema.d.ts.map +1 -0
- package/lib/compute/getExtrema.js +72 -0
- package/lib/compute/getExtrema.js.map +1 -0
- package/lib/compute/histogram.d.ts +22 -14
- package/lib/compute/histogram.d.ts.map +1 -1
- package/lib/compute/histogram.js +29 -23
- package/lib/compute/histogram.js.map +1 -1
- package/lib/compute/index.d.ts +5 -1
- package/lib/compute/index.d.ts.map +1 -1
- package/lib/compute/index.js +5 -6
- package/lib/compute/index.js.map +1 -1
- package/lib/compute/mean.d.ts +17 -0
- package/lib/compute/mean.d.ts.map +1 -0
- package/lib/compute/mean.js +37 -0
- package/lib/compute/mean.js.map +1 -0
- package/lib/compute/median.d.ts +16 -0
- package/lib/compute/median.d.ts.map +1 -0
- package/lib/compute/median.js +37 -0
- package/lib/compute/median.js.map +1 -0
- package/lib/compute/variance.d.ts +17 -0
- package/lib/compute/variance.d.ts.map +1 -0
- package/lib/compute/variance.js +33 -0
- package/lib/compute/variance.js.map +1 -0
- package/lib/correctColor/correctColor.d.ts +22 -0
- package/lib/correctColor/correctColor.d.ts.map +1 -0
- package/lib/correctColor/correctColor.js +75 -0
- package/lib/correctColor/correctColor.js.map +1 -0
- package/lib/correctColor/index.d.ts +2 -0
- package/lib/correctColor/index.d.ts.map +1 -0
- package/lib/correctColor/index.js +2 -0
- package/lib/correctColor/index.js.map +1 -0
- package/lib/correctColor/utils/formatData.d.ts +37 -0
- package/lib/correctColor/utils/formatData.d.ts.map +1 -0
- package/lib/correctColor/utils/formatData.js +60 -0
- package/lib/correctColor/utils/formatData.js.map +1 -0
- package/lib/correctColor/utils/getImageColors.d.ts +9 -0
- package/lib/correctColor/utils/getImageColors.d.ts.map +1 -0
- package/lib/correctColor/utils/getImageColors.js +19 -0
- package/lib/correctColor/utils/getImageColors.js.map +1 -0
- package/lib/correctColor/utils/referenceColorCard.d.ts +42 -0
- package/lib/correctColor/utils/referenceColorCard.d.ts.map +1 -0
- package/lib/correctColor/utils/referenceColorCard.js +146 -0
- package/lib/correctColor/utils/referenceColorCard.js.map +1 -0
- package/lib/draw/drawCircleOnImage.d.ts +28 -0
- package/lib/draw/drawCircleOnImage.d.ts.map +1 -0
- package/lib/draw/drawCircleOnImage.js +75 -0
- package/lib/draw/drawCircleOnImage.js.map +1 -0
- package/lib/draw/drawLineOnImage.d.ts +28 -0
- package/lib/draw/drawLineOnImage.d.ts.map +1 -0
- package/lib/draw/drawLineOnImage.js +27 -0
- package/lib/draw/drawLineOnImage.js.map +1 -0
- package/lib/draw/drawLineOnMask.d.ts +23 -0
- package/lib/draw/drawLineOnMask.d.ts.map +1 -0
- package/lib/draw/drawLineOnMask.js +19 -0
- package/lib/draw/drawLineOnMask.js.map +1 -0
- package/lib/draw/drawMarker.d.ts +36 -0
- package/lib/draw/drawMarker.d.ts.map +1 -0
- package/lib/draw/drawMarker.js +62 -0
- package/lib/draw/drawMarker.js.map +1 -0
- package/lib/draw/drawMarkers.d.ts +12 -0
- package/lib/draw/drawMarkers.d.ts.map +1 -0
- package/lib/draw/drawMarkers.js +17 -0
- package/lib/draw/drawMarkers.js.map +1 -0
- package/lib/draw/drawPoints.d.ts +22 -0
- package/lib/draw/drawPoints.d.ts.map +1 -0
- package/lib/draw/drawPoints.js +32 -0
- package/lib/draw/drawPoints.js.map +1 -0
- package/lib/draw/drawPolygonOnImage.d.ts +24 -0
- package/lib/draw/drawPolygonOnImage.d.ts.map +1 -0
- package/lib/draw/drawPolygonOnImage.js +44 -0
- package/lib/draw/drawPolygonOnImage.js.map +1 -0
- package/lib/draw/drawPolygonOnMask.d.ts +23 -0
- package/lib/draw/drawPolygonOnMask.d.ts.map +1 -0
- package/lib/draw/drawPolygonOnMask.js +35 -0
- package/lib/draw/drawPolygonOnMask.js.map +1 -0
- package/lib/draw/drawPolylineOnImage.d.ts +27 -0
- package/lib/draw/drawPolylineOnImage.d.ts.map +1 -0
- package/lib/draw/drawPolylineOnImage.js +26 -0
- package/lib/draw/drawPolylineOnImage.js.map +1 -0
- package/lib/draw/drawPolylineOnMask.d.ts +22 -0
- package/lib/draw/drawPolylineOnMask.d.ts.map +1 -0
- package/lib/draw/drawPolylineOnMask.js +18 -0
- package/lib/draw/drawPolylineOnMask.js.map +1 -0
- package/lib/draw/drawRectangle.d.ts +37 -0
- package/lib/draw/drawRectangle.d.ts.map +1 -0
- package/lib/draw/drawRectangle.js +50 -0
- package/lib/draw/drawRectangle.js.map +1 -0
- package/lib/draw/index.d.ts +12 -0
- package/lib/draw/index.d.ts.map +1 -0
- package/lib/draw/index.js +12 -0
- package/lib/draw/index.js.map +1 -0
- package/lib/draw/utils/deleteDuplicates.d.ts +8 -0
- package/lib/draw/utils/deleteDuplicates.d.ts.map +1 -0
- package/lib/draw/utils/deleteDuplicates.js +19 -0
- package/lib/draw/utils/deleteDuplicates.js.map +1 -0
- package/lib/draw/utils/roundPoint.d.ts +8 -0
- package/lib/draw/utils/roundPoint.d.ts.map +1 -0
- package/lib/draw/utils/roundPoint.js +12 -0
- package/lib/draw/utils/roundPoint.js.map +1 -0
- package/lib/featureMatching/descriptors/getBrief.d.ts +15 -0
- package/lib/featureMatching/descriptors/getBrief.d.ts.map +1 -0
- package/lib/featureMatching/descriptors/getBrief.js +29 -0
- package/lib/featureMatching/descriptors/getBrief.js.map +1 -0
- package/lib/featureMatching/descriptors/getBriefDescriptors.d.ts +43 -0
- package/lib/featureMatching/descriptors/getBriefDescriptors.d.ts.map +1 -0
- package/lib/featureMatching/descriptors/getBriefDescriptors.js +58 -0
- package/lib/featureMatching/descriptors/getBriefDescriptors.js.map +1 -0
- package/lib/featureMatching/descriptors/utils/getKeypointPatch.d.ts +18 -0
- package/lib/featureMatching/descriptors/utils/getKeypointPatch.d.ts.map +1 -0
- package/lib/featureMatching/descriptors/utils/getKeypointPatch.js +32 -0
- package/lib/featureMatching/descriptors/utils/getKeypointPatch.js.map +1 -0
- package/lib/featureMatching/descriptors/utils/sliceBrief.d.ts +21 -0
- package/lib/featureMatching/descriptors/utils/sliceBrief.d.ts.map +1 -0
- package/lib/featureMatching/descriptors/utils/sliceBrief.js +17 -0
- package/lib/featureMatching/descriptors/utils/sliceBrief.js.map +1 -0
- package/lib/featureMatching/featureMatching.types.d.ts +26 -0
- package/lib/featureMatching/featureMatching.types.d.ts.map +1 -0
- package/lib/featureMatching/featureMatching.types.js +2 -0
- package/lib/featureMatching/featureMatching.types.js.map +1 -0
- package/lib/featureMatching/index.d.ts +13 -0
- package/lib/featureMatching/index.d.ts.map +1 -0
- package/lib/featureMatching/index.js +13 -0
- package/lib/featureMatching/index.js.map +1 -0
- package/lib/featureMatching/keypoints/getBestKeypointsInRadius.d.ts +9 -0
- package/lib/featureMatching/keypoints/getBestKeypointsInRadius.d.ts.map +1 -0
- package/lib/featureMatching/keypoints/getBestKeypointsInRadius.js +30 -0
- package/lib/featureMatching/keypoints/getBestKeypointsInRadius.js.map +1 -0
- package/lib/featureMatching/keypoints/getFastKeypoints.d.ts +53 -0
- package/lib/featureMatching/keypoints/getFastKeypoints.d.ts.map +1 -0
- package/lib/featureMatching/keypoints/getFastKeypoints.js +71 -0
- package/lib/featureMatching/keypoints/getFastKeypoints.js.map +1 -0
- package/lib/featureMatching/keypoints/getFastScore.d.ts +13 -0
- package/lib/featureMatching/keypoints/getFastScore.d.ts.map +1 -0
- package/lib/featureMatching/keypoints/getFastScore.js +25 -0
- package/lib/featureMatching/keypoints/getFastScore.js.map +1 -0
- package/lib/featureMatching/keypoints/getHarrisScore.d.ts +20 -0
- package/lib/featureMatching/keypoints/getHarrisScore.d.ts.map +1 -0
- package/lib/featureMatching/keypoints/getHarrisScore.js +55 -0
- package/lib/featureMatching/keypoints/getHarrisScore.js.map +1 -0
- package/lib/featureMatching/keypoints/getIntensityCentroid.d.ts +11 -0
- package/lib/featureMatching/keypoints/getIntensityCentroid.d.ts.map +1 -0
- package/lib/featureMatching/keypoints/getIntensityCentroid.js +30 -0
- package/lib/featureMatching/keypoints/getIntensityCentroid.js.map +1 -0
- package/lib/featureMatching/keypoints/getIntensityMoment.d.ts +22 -0
- package/lib/featureMatching/keypoints/getIntensityMoment.d.ts.map +1 -0
- package/lib/featureMatching/keypoints/getIntensityMoment.js +27 -0
- package/lib/featureMatching/keypoints/getIntensityMoment.js.map +1 -0
- package/lib/featureMatching/keypoints/getOrientedFastKeypoints.d.ts +26 -0
- package/lib/featureMatching/keypoints/getOrientedFastKeypoints.d.ts.map +1 -0
- package/lib/featureMatching/keypoints/getOrientedFastKeypoints.js +38 -0
- package/lib/featureMatching/keypoints/getOrientedFastKeypoints.js.map +1 -0
- package/lib/featureMatching/keypoints/getPatchIntensityCentroid.d.ts +13 -0
- package/lib/featureMatching/keypoints/getPatchIntensityCentroid.d.ts.map +1 -0
- package/lib/featureMatching/keypoints/getPatchIntensityCentroid.js +31 -0
- package/lib/featureMatching/keypoints/getPatchIntensityCentroid.js.map +1 -0
- package/lib/featureMatching/keypoints/getPatchIntensityMoment.d.ts +27 -0
- package/lib/featureMatching/keypoints/getPatchIntensityMoment.d.ts.map +1 -0
- package/lib/featureMatching/keypoints/getPatchIntensityMoment.js +29 -0
- package/lib/featureMatching/keypoints/getPatchIntensityMoment.js.map +1 -0
- package/lib/featureMatching/keypoints/isFastKeypoint.d.ts +26 -0
- package/lib/featureMatching/keypoints/isFastKeypoint.d.ts.map +1 -0
- package/lib/featureMatching/keypoints/isFastKeypoint.js +74 -0
- package/lib/featureMatching/keypoints/isFastKeypoint.js.map +1 -0
- package/lib/featureMatching/keypoints/utils/getDistanceMatrix.d.ts +9 -0
- package/lib/featureMatching/keypoints/utils/getDistanceMatrix.d.ts.map +1 -0
- package/lib/featureMatching/keypoints/utils/getDistanceMatrix.js +26 -0
- package/lib/featureMatching/keypoints/utils/getDistanceMatrix.js.map +1 -0
- package/lib/featureMatching/keypoints/utils/getKeypointsInRadius.d.ts +10 -0
- package/lib/featureMatching/keypoints/utils/getKeypointsInRadius.d.ts.map +1 -0
- package/lib/featureMatching/keypoints/utils/getKeypointsInRadius.js +26 -0
- package/lib/featureMatching/keypoints/utils/getKeypointsInRadius.js.map +1 -0
- package/lib/featureMatching/matching/bruteForceMatch.d.ts +36 -0
- package/lib/featureMatching/matching/bruteForceMatch.d.ts.map +1 -0
- package/lib/featureMatching/matching/bruteForceMatch.js +33 -0
- package/lib/featureMatching/matching/bruteForceMatch.js.map +1 -0
- package/lib/featureMatching/matching/filterEuclideanDistance.d.ts +21 -0
- package/lib/featureMatching/matching/filterEuclideanDistance.d.ts.map +1 -0
- package/lib/featureMatching/matching/filterEuclideanDistance.js +42 -0
- package/lib/featureMatching/matching/filterEuclideanDistance.js.map +1 -0
- package/lib/featureMatching/matching/filterSmallestDistanceMatches.d.ts +9 -0
- package/lib/featureMatching/matching/filterSmallestDistanceMatches.d.ts.map +1 -0
- package/lib/featureMatching/matching/filterSmallestDistanceMatches.js +28 -0
- package/lib/featureMatching/matching/filterSmallestDistanceMatches.js.map +1 -0
- package/lib/featureMatching/matching/getCrosscheckMatches.d.ts +19 -0
- package/lib/featureMatching/matching/getCrosscheckMatches.d.ts.map +1 -0
- package/lib/featureMatching/matching/getCrosscheckMatches.js +55 -0
- package/lib/featureMatching/matching/getCrosscheckMatches.js.map +1 -0
- package/lib/featureMatching/matching/getHammingDistance.d.ts +10 -0
- package/lib/featureMatching/matching/getHammingDistance.d.ts.map +1 -0
- package/lib/featureMatching/matching/getHammingDistance.js +15 -0
- package/lib/featureMatching/matching/getHammingDistance.js.map +1 -0
- package/lib/featureMatching/utils/checkBorderDistance.d.ts +11 -0
- package/lib/featureMatching/utils/checkBorderDistance.d.ts.map +1 -0
- package/lib/featureMatching/utils/checkBorderDistance.js +14 -0
- package/lib/featureMatching/utils/checkBorderDistance.js.map +1 -0
- package/lib/featureMatching/utils/compareIntensity.d.ts +19 -0
- package/lib/featureMatching/utils/compareIntensity.d.ts.map +1 -0
- package/lib/featureMatching/utils/compareIntensity.js +18 -0
- package/lib/featureMatching/utils/compareIntensity.js.map +1 -0
- package/lib/featureMatching/utils/extractSquareImage.d.ts +11 -0
- package/lib/featureMatching/utils/extractSquareImage.d.ts.map +1 -0
- package/lib/featureMatching/utils/extractSquareImage.js +20 -0
- package/lib/featureMatching/utils/extractSquareImage.js.map +1 -0
- package/lib/featureMatching/utils/getColors.d.ts +11 -0
- package/lib/featureMatching/utils/getColors.d.ts.map +1 -0
- package/lib/featureMatching/utils/getColors.js +25 -0
- package/lib/featureMatching/utils/getColors.js.map +1 -0
- package/lib/featureMatching/utils/getGaussianPoints.d.ts +23 -0
- package/lib/featureMatching/utils/getGaussianPoints.d.ts.map +1 -0
- package/lib/featureMatching/utils/getGaussianPoints.js +46 -0
- package/lib/featureMatching/utils/getGaussianPoints.js.map +1 -0
- package/lib/featureMatching/utils/getKeypointColor.d.ts +11 -0
- package/lib/featureMatching/utils/getKeypointColor.d.ts.map +1 -0
- package/lib/featureMatching/utils/getKeypointColor.js +21 -0
- package/lib/featureMatching/utils/getKeypointColor.js.map +1 -0
- package/lib/featureMatching/utils/getMatchColor.d.ts +11 -0
- package/lib/featureMatching/utils/getMatchColor.d.ts.map +1 -0
- package/lib/featureMatching/utils/getMatchColor.js +20 -0
- package/lib/featureMatching/utils/getMatchColor.js.map +1 -0
- package/lib/featureMatching/utils/sortByDistance.d.ts +8 -0
- package/lib/featureMatching/utils/sortByDistance.d.ts.map +1 -0
- package/lib/featureMatching/utils/sortByDistance.js +13 -0
- package/lib/featureMatching/utils/sortByDistance.js.map +1 -0
- package/lib/featureMatching/utils/sortBySourceDest.d.ts +14 -0
- package/lib/featureMatching/utils/sortBySourceDest.d.ts.map +1 -0
- package/lib/featureMatching/utils/sortBySourceDest.js +33 -0
- package/lib/featureMatching/utils/sortBySourceDest.js.map +1 -0
- package/lib/featureMatching/visualize/Montage.d.ts +84 -0
- package/lib/featureMatching/visualize/Montage.d.ts.map +1 -0
- package/lib/featureMatching/visualize/Montage.js +113 -0
- package/lib/featureMatching/visualize/Montage.js.map +1 -0
- package/lib/featureMatching/visualize/drawKeypoints.d.ts +55 -0
- package/lib/featureMatching/visualize/drawKeypoints.d.ts.map +1 -0
- package/lib/featureMatching/visualize/drawKeypoints.js +58 -0
- package/lib/featureMatching/visualize/drawKeypoints.js.map +1 -0
- package/lib/featureMatching/visualize/drawMatches.d.ts +42 -0
- package/lib/featureMatching/visualize/drawMatches.d.ts.map +1 -0
- package/lib/featureMatching/visualize/drawMatches.js +52 -0
- package/lib/featureMatching/visualize/drawMatches.js.map +1 -0
- package/lib/featureMatching/visualize/overlapImages.d.ts +30 -0
- package/lib/featureMatching/visualize/overlapImages.d.ts.map +1 -0
- package/lib/featureMatching/visualize/overlapImages.js +35 -0
- package/lib/featureMatching/visualize/overlapImages.js.map +1 -0
- package/lib/featureMatching/visualize/scaleKeypoints.d.ts +9 -0
- package/lib/featureMatching/visualize/scaleKeypoints.d.ts.map +1 -0
- package/lib/featureMatching/visualize/scaleKeypoints.js +20 -0
- package/lib/featureMatching/visualize/scaleKeypoints.js.map +1 -0
- package/lib/filters/and.d.ts +16 -0
- package/lib/filters/and.d.ts.map +1 -0
- package/lib/filters/and.js +24 -0
- package/lib/filters/and.js.map +1 -0
- package/lib/filters/blur.d.ts +33 -10
- package/lib/filters/blur.d.ts.map +1 -1
- package/lib/filters/blur.js +22 -13
- package/lib/filters/blur.js.map +1 -1
- package/lib/filters/convolution.d.ts +71 -10
- package/lib/filters/convolution.d.ts.map +1 -1
- package/lib/filters/convolution.js +160 -128
- package/lib/filters/convolution.js.map +1 -1
- package/lib/filters/derivativeFilter.d.ts +38 -0
- package/lib/filters/derivativeFilter.d.ts.map +1 -0
- package/lib/filters/derivativeFilter.js +26 -0
- package/lib/filters/derivativeFilter.js.map +1 -0
- package/lib/filters/flip.d.ts +20 -0
- package/lib/filters/flip.d.ts.map +1 -0
- package/lib/filters/flip.js +23 -0
- package/lib/filters/flip.js.map +1 -0
- package/lib/filters/flipX.d.ts +8 -0
- package/lib/filters/flipX.d.ts.map +1 -0
- package/lib/filters/flipX.js +24 -0
- package/lib/filters/flipX.js.map +1 -0
- package/lib/filters/flipY.d.ts +8 -0
- package/lib/filters/flipY.d.ts.map +1 -0
- package/lib/filters/flipY.js +24 -0
- package/lib/filters/flipY.js.map +1 -0
- package/lib/filters/gaussianBlur.d.ts +53 -17
- package/lib/filters/gaussianBlur.d.ts.map +1 -1
- package/lib/filters/gaussianBlur.js +52 -47
- package/lib/filters/gaussianBlur.js.map +1 -1
- package/lib/filters/gradientFilter.d.ts +51 -0
- package/lib/filters/gradientFilter.d.ts.map +1 -0
- package/lib/filters/gradientFilter.js +49 -0
- package/lib/filters/gradientFilter.js.map +1 -0
- package/lib/filters/hypotenuse.d.ts +16 -0
- package/lib/filters/hypotenuse.d.ts.map +1 -0
- package/lib/filters/hypotenuse.js +36 -0
- package/lib/filters/hypotenuse.js.map +1 -0
- package/lib/filters/increaseContrast.d.ts +21 -0
- package/lib/filters/increaseContrast.d.ts.map +1 -0
- package/lib/filters/increaseContrast.js +49 -0
- package/lib/filters/increaseContrast.js.map +1 -0
- package/lib/filters/index.d.ts +14 -4
- package/lib/filters/index.d.ts.map +1 -1
- package/lib/filters/index.js +14 -9
- package/lib/filters/index.js.map +1 -1
- package/lib/filters/invert.d.ts +10 -9
- package/lib/filters/invert.d.ts.map +1 -1
- package/lib/filters/invert.js +31 -16
- package/lib/filters/invert.js.map +1 -1
- package/lib/filters/level.d.ts +46 -0
- package/lib/filters/level.d.ts.map +1 -0
- package/lib/filters/level.js +63 -0
- package/lib/filters/level.js.map +1 -0
- package/lib/filters/medianFilter.d.ts +26 -0
- package/lib/filters/medianFilter.d.ts.map +1 -0
- package/lib/filters/medianFilter.js +42 -0
- package/lib/filters/medianFilter.js.map +1 -0
- package/lib/filters/or.d.ts +16 -0
- package/lib/filters/or.d.ts.map +1 -0
- package/lib/filters/or.js +24 -0
- package/lib/filters/or.js.map +1 -0
- package/lib/filters/pixelate.d.ts +24 -0
- package/lib/filters/pixelate.d.ts.map +1 -0
- package/lib/filters/pixelate.js +105 -0
- package/lib/filters/pixelate.js.map +1 -0
- package/lib/geometry/getPerspectiveWarp.d.ts +37 -0
- package/lib/geometry/getPerspectiveWarp.d.ts.map +1 -0
- package/lib/geometry/getPerspectiveWarp.js +131 -0
- package/lib/geometry/getPerspectiveWarp.js.map +1 -0
- package/lib/geometry/index.d.ts +6 -3
- package/lib/geometry/index.d.ts.map +1 -1
- package/lib/geometry/index.js +5 -8
- package/lib/geometry/index.js.map +1 -1
- package/lib/geometry/resize.d.ts +48 -13
- package/lib/geometry/resize.d.ts.map +1 -1
- package/lib/geometry/resize.js +86 -90
- package/lib/geometry/resize.js.map +1 -1
- package/lib/geometry/rotate.d.ts +9 -13
- package/lib/geometry/rotate.d.ts.map +1 -1
- package/lib/geometry/rotate.js +46 -26
- package/lib/geometry/rotate.js.map +1 -1
- package/lib/geometry/transform.d.ts +45 -12
- package/lib/geometry/transform.d.ts.map +1 -1
- package/lib/geometry/transform.js +102 -84
- package/lib/geometry/transform.js.map +1 -1
- package/lib/geometry/transformRotate.d.ts +24 -0
- package/lib/geometry/transformRotate.d.ts.map +1 -0
- package/lib/geometry/transformRotate.js +38 -0
- package/lib/geometry/transformRotate.js.map +1 -0
- package/lib/index.d.ts +24 -8
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +24 -13
- package/lib/index.js.map +1 -1
- package/lib/load/decode.d.ts +8 -7
- package/lib/load/decode.d.ts.map +1 -1
- package/lib/load/decode.js +24 -28
- package/lib/load/decode.js.map +1 -1
- package/lib/load/decodeBmp.d.ts +8 -0
- package/lib/load/decodeBmp.d.ts.map +1 -0
- package/lib/load/decodeBmp.js +36 -0
- package/lib/load/decodeBmp.js.map +1 -0
- package/lib/load/decodeJpeg.d.ts +7 -6
- package/lib/load/decodeJpeg.d.ts.map +1 -1
- package/lib/load/decodeJpeg.js +26 -16
- package/lib/load/decodeJpeg.js.map +1 -1
- package/lib/load/decodePng.d.ts +7 -6
- package/lib/load/decodePng.d.ts.map +1 -1
- package/lib/load/decodePng.js +91 -67
- package/lib/load/decodePng.js.map +1 -1
- package/lib/load/decodeTiff.d.ts +17 -0
- package/lib/load/decodeTiff.d.ts.map +1 -0
- package/lib/load/decodeTiff.js +80 -0
- package/lib/load/decodeTiff.js.map +1 -0
- package/lib/load/fetchURL.d.ts +7 -0
- package/lib/load/fetchURL.d.ts.map +1 -0
- package/lib/load/fetchURL.js +13 -0
- package/lib/load/fetchURL.js.map +1 -0
- package/lib/load/getMetadata.d.ts +16 -0
- package/lib/load/getMetadata.d.ts.map +1 -0
- package/lib/load/getMetadata.js +15 -0
- package/lib/load/getMetadata.js.map +1 -0
- package/lib/load/index.d.ts +9 -6
- package/lib/load/index.d.ts.map +1 -1
- package/lib/load/index.js +9 -11
- package/lib/load/index.js.map +1 -1
- package/lib/load/load.types.d.ts +8 -0
- package/lib/load/load.types.d.ts.map +1 -0
- package/lib/load/load.types.js +2 -0
- package/lib/load/load.types.js.map +1 -0
- package/lib/load/read.d.ts +16 -11
- package/lib/load/read.d.ts.map +1 -1
- package/lib/load/read.js +24 -23
- package/lib/load/read.js.map +1 -1
- package/lib/load/readCanvas.d.ts +7 -2
- package/lib/load/readCanvas.d.ts.map +1 -1
- package/lib/load/readCanvas.js +16 -17
- package/lib/load/readCanvas.js.map +1 -1
- package/lib/load/readImg.d.ts +7 -2
- package/lib/load/readImg.d.ts.map +1 -1
- package/lib/load/readImg.js +17 -16
- package/lib/load/readImg.js.map +1 -1
- package/lib/maskAnalysis/getBorderPoints.d.ts +12 -0
- package/lib/maskAnalysis/getBorderPoints.d.ts.map +1 -0
- package/lib/maskAnalysis/getBorderPoints.js +53 -0
- package/lib/maskAnalysis/getBorderPoints.js.map +1 -0
- package/lib/maskAnalysis/getConvexHull.d.ts +9 -0
- package/lib/maskAnalysis/getConvexHull.d.ts.map +1 -0
- package/lib/maskAnalysis/getConvexHull.js +23 -0
- package/lib/maskAnalysis/getConvexHull.js.map +1 -0
- package/lib/maskAnalysis/getFeret.d.ts +11 -0
- package/lib/maskAnalysis/getFeret.d.ts.map +1 -0
- package/lib/maskAnalysis/getFeret.js +181 -0
- package/lib/maskAnalysis/getFeret.js.map +1 -0
- package/lib/maskAnalysis/getMbr.d.ts +9 -0
- package/lib/maskAnalysis/getMbr.d.ts.map +1 -0
- package/lib/maskAnalysis/getMbr.js +13 -0
- package/lib/maskAnalysis/getMbr.js.map +1 -0
- package/lib/maskAnalysis/index.d.ts +2 -0
- package/lib/maskAnalysis/index.d.ts.map +1 -0
- package/lib/maskAnalysis/index.js +2 -0
- package/lib/maskAnalysis/index.js.map +1 -0
- package/lib/maskAnalysis/maskAnalysis.types.d.ts +97 -0
- package/lib/maskAnalysis/maskAnalysis.types.d.ts.map +1 -0
- package/lib/maskAnalysis/maskAnalysis.types.js +2 -0
- package/lib/maskAnalysis/maskAnalysis.types.js.map +1 -0
- package/lib/maskAnalysis/utils/getAngle.d.ts +19 -0
- package/lib/maskAnalysis/utils/getAngle.d.ts.map +1 -0
- package/lib/maskAnalysis/utils/getAngle.js +41 -0
- package/lib/maskAnalysis/utils/getAngle.js.map +1 -0
- package/lib/maskAnalysis/utils/getExtendedBorderPoints.d.ts +12 -0
- package/lib/maskAnalysis/utils/getExtendedBorderPoints.d.ts.map +1 -0
- package/lib/maskAnalysis/utils/getExtendedBorderPoints.js +20 -0
- package/lib/maskAnalysis/utils/getExtendedBorderPoints.js.map +1 -0
- package/lib/maskAnalysis/utils/getMbrAngle.d.ts +8 -0
- package/lib/maskAnalysis/utils/getMbrAngle.d.ts.map +1 -0
- package/lib/maskAnalysis/utils/getMbrAngle.js +21 -0
- package/lib/maskAnalysis/utils/getMbrAngle.js.map +1 -0
- package/lib/maskAnalysis/utils/getMbrFromPoints.d.ts +10 -0
- package/lib/maskAnalysis/utils/getMbrFromPoints.d.ts.map +1 -0
- package/lib/maskAnalysis/utils/getMbrFromPoints.js +102 -0
- package/lib/maskAnalysis/utils/getMbrFromPoints.js.map +1 -0
- package/lib/maskAnalysis/utils/monotoneChainConvexHull.d.ts +18 -0
- package/lib/maskAnalysis/utils/monotoneChainConvexHull.d.ts.map +1 -0
- package/lib/maskAnalysis/utils/monotoneChainConvexHull.js +45 -0
- package/lib/maskAnalysis/utils/monotoneChainConvexHull.js.map +1 -0
- package/lib/morphology/bottomHat.d.ts +18 -0
- package/lib/morphology/bottomHat.d.ts.map +1 -0
- package/lib/morphology/bottomHat.js +38 -0
- package/lib/morphology/bottomHat.js.map +1 -0
- package/lib/morphology/cannyEdgeDetector.d.ts +44 -0
- package/lib/morphology/cannyEdgeDetector.d.ts.map +1 -0
- package/lib/morphology/cannyEdgeDetector.js +146 -0
- package/lib/morphology/cannyEdgeDetector.js.map +1 -0
- package/lib/morphology/clearBorder.d.ts +26 -0
- package/lib/morphology/clearBorder.d.ts.map +1 -0
- package/lib/morphology/clearBorder.js +19 -0
- package/lib/morphology/clearBorder.js.map +1 -0
- package/lib/morphology/close.d.ts +18 -0
- package/lib/morphology/close.d.ts.map +1 -0
- package/lib/morphology/close.js +33 -0
- package/lib/morphology/close.js.map +1 -0
- package/lib/morphology/dilate.d.ts +18 -0
- package/lib/morphology/dilate.d.ts.map +1 -0
- package/lib/morphology/dilate.js +191 -0
- package/lib/morphology/dilate.js.map +1 -0
- package/lib/morphology/erode.d.ts +18 -0
- package/lib/morphology/erode.d.ts.map +1 -0
- package/lib/morphology/erode.js +191 -0
- package/lib/morphology/erode.js.map +1 -0
- package/lib/morphology/floodFill.d.ts +26 -0
- package/lib/morphology/floodFill.d.ts.map +1 -0
- package/lib/morphology/floodFill.js +18 -0
- package/lib/morphology/floodFill.js.map +1 -0
- package/lib/morphology/index.d.ts +12 -0
- package/lib/morphology/index.d.ts.map +1 -0
- package/lib/morphology/index.js +12 -0
- package/lib/morphology/index.js.map +1 -0
- package/lib/morphology/morphologicalGradient.d.ts +18 -0
- package/lib/morphology/morphologicalGradient.d.ts.map +1 -0
- package/lib/morphology/morphologicalGradient.js +34 -0
- package/lib/morphology/morphologicalGradient.js.map +1 -0
- package/lib/morphology/multipleFloodFill.d.ts +36 -0
- package/lib/morphology/multipleFloodFill.d.ts.map +1 -0
- package/lib/morphology/multipleFloodFill.js +87 -0
- package/lib/morphology/multipleFloodFill.js.map +1 -0
- package/lib/morphology/open.d.ts +18 -0
- package/lib/morphology/open.d.ts.map +1 -0
- package/lib/morphology/open.js +35 -0
- package/lib/morphology/open.js.map +1 -0
- package/lib/morphology/solidFill.d.ts +20 -0
- package/lib/morphology/solidFill.d.ts.map +1 -0
- package/lib/morphology/solidFill.js +15 -0
- package/lib/morphology/solidFill.js.map +1 -0
- package/lib/morphology/topHat.d.ts +18 -0
- package/lib/morphology/topHat.d.ts.map +1 -0
- package/lib/morphology/topHat.js +36 -0
- package/lib/morphology/topHat.js.map +1 -0
- package/lib/operations/convertBitDepth.d.ts +16 -0
- package/lib/operations/convertBitDepth.d.ts.map +1 -0
- package/lib/operations/convertBitDepth.js +56 -0
- package/lib/operations/convertBitDepth.js.map +1 -0
- package/lib/operations/convertColor.d.ts +35 -5
- package/lib/operations/convertColor.d.ts.map +1 -1
- package/lib/operations/convertColor.js +143 -75
- package/lib/operations/convertColor.js.map +1 -1
- package/lib/operations/copyTo.d.ts +17 -0
- package/lib/operations/copyTo.d.ts.map +1 -0
- package/lib/operations/copyTo.js +36 -0
- package/lib/operations/copyTo.js.map +1 -0
- package/lib/operations/correctBackground.d.ts +27 -0
- package/lib/operations/correctBackground.d.ts.map +1 -0
- package/lib/operations/correctBackground.js +44 -0
- package/lib/operations/correctBackground.js.map +1 -0
- package/lib/operations/crop.d.ts +32 -0
- package/lib/operations/crop.d.ts.map +1 -0
- package/lib/operations/crop.js +48 -0
- package/lib/operations/crop.js.map +1 -0
- package/lib/operations/cropAlpha.d.ts +11 -0
- package/lib/operations/cropAlpha.d.ts.map +1 -0
- package/lib/operations/cropAlpha.js +70 -0
- package/lib/operations/cropAlpha.js.map +1 -0
- package/lib/operations/cropRectangle.d.ts +14 -0
- package/lib/operations/cropRectangle.d.ts.map +1 -0
- package/lib/operations/cropRectangle.js +75 -0
- package/lib/operations/cropRectangle.js.map +1 -0
- package/lib/operations/extendBorders.d.ts +30 -0
- package/lib/operations/extendBorders.d.ts.map +1 -0
- package/lib/operations/extendBorders.js +61 -0
- package/lib/operations/extendBorders.js.map +1 -0
- package/lib/operations/extract.d.ts +19 -0
- package/lib/operations/extract.d.ts.map +1 -0
- package/lib/operations/extract.js +41 -0
- package/lib/operations/extract.js.map +1 -0
- package/lib/operations/getMaskFromCannyEdge.d.ts +11 -0
- package/lib/operations/getMaskFromCannyEdge.d.ts.map +1 -0
- package/lib/operations/getMaskFromCannyEdge.js +35 -0
- package/lib/operations/getMaskFromCannyEdge.js.map +1 -0
- package/lib/operations/grey.d.ts +62 -0
- package/lib/operations/grey.d.ts.map +1 -0
- package/lib/operations/grey.js +84 -0
- package/lib/operations/grey.js.map +1 -0
- package/lib/operations/greyAlgorithms.d.ts +133 -0
- package/lib/operations/greyAlgorithms.d.ts.map +1 -0
- package/lib/operations/greyAlgorithms.js +205 -0
- package/lib/operations/greyAlgorithms.js.map +1 -0
- package/lib/operations/index.d.ts +16 -5
- package/lib/operations/index.d.ts.map +1 -1
- package/lib/operations/index.js +16 -10
- package/lib/operations/index.js.map +1 -1
- package/lib/operations/merge.d.ts +7 -6
- package/lib/operations/merge.d.ts.map +1 -1
- package/lib/operations/merge.js +50 -47
- package/lib/operations/merge.js.map +1 -1
- package/lib/operations/operations.types.d.ts +7 -0
- package/lib/operations/operations.types.d.ts.map +1 -0
- package/lib/operations/operations.types.js +2 -0
- package/lib/operations/operations.types.js.map +1 -0
- package/lib/operations/paintMaskOnImage.d.ts +33 -0
- package/lib/operations/paintMaskOnImage.d.ts.map +1 -0
- package/lib/operations/paintMaskOnImage.js +53 -0
- package/lib/operations/paintMaskOnImage.js.map +1 -0
- package/lib/operations/paintMaskOnMask.d.ts +27 -0
- package/lib/operations/paintMaskOnMask.d.ts.map +1 -0
- package/lib/operations/paintMaskOnMask.js +24 -0
- package/lib/operations/paintMaskOnMask.js.map +1 -0
- package/lib/operations/split.d.ts +7 -2
- package/lib/operations/split.d.ts.map +1 -1
- package/lib/operations/split.js +19 -15
- package/lib/operations/split.js.map +1 -1
- package/lib/operations/threshold.d.ts +60 -18
- package/lib/operations/threshold.d.ts.map +1 -1
- package/lib/operations/threshold.js +90 -58
- package/lib/operations/threshold.js.map +1 -1
- package/lib/operations/thresholds/huang.d.ts +7 -0
- package/lib/operations/thresholds/huang.d.ts.map +1 -0
- package/lib/operations/thresholds/huang.js +78 -0
- package/lib/operations/thresholds/huang.js.map +1 -0
- package/lib/operations/thresholds/intermodes.d.ts +7 -0
- package/lib/operations/thresholds/intermodes.d.ts.map +1 -0
- package/lib/operations/thresholds/intermodes.js +57 -0
- package/lib/operations/thresholds/intermodes.js.map +1 -0
- package/lib/operations/thresholds/isodata.d.ts +7 -0
- package/lib/operations/thresholds/isodata.d.ts.map +1 -0
- package/lib/operations/thresholds/isodata.js +50 -0
- package/lib/operations/thresholds/isodata.js.map +1 -0
- package/lib/operations/thresholds/li.d.ts +8 -0
- package/lib/operations/thresholds/li.d.ts.map +1 -0
- package/lib/operations/thresholds/li.js +73 -0
- package/lib/operations/thresholds/li.js.map +1 -0
- package/lib/operations/thresholds/maxEntropy.d.ts +8 -0
- package/lib/operations/thresholds/maxEntropy.d.ts.map +1 -0
- package/lib/operations/thresholds/maxEntropy.js +76 -0
- package/lib/operations/thresholds/maxEntropy.js.map +1 -0
- package/lib/operations/thresholds/mean.d.ts +8 -0
- package/lib/operations/thresholds/mean.d.ts.map +1 -0
- package/lib/operations/thresholds/mean.js +22 -0
- package/lib/operations/thresholds/mean.js.map +1 -0
- package/lib/operations/thresholds/minError.d.ts +8 -0
- package/lib/operations/thresholds/minError.d.ts.map +1 -0
- package/lib/operations/thresholds/minError.js +86 -0
- package/lib/operations/thresholds/minError.js.map +1 -0
- package/lib/operations/thresholds/minimum.d.ts +7 -0
- package/lib/operations/thresholds/minimum.d.ts.map +1 -0
- package/lib/operations/thresholds/minimum.js +74 -0
- package/lib/operations/thresholds/minimum.js.map +1 -0
- package/lib/operations/thresholds/moments.d.ts +8 -0
- package/lib/operations/thresholds/moments.d.ts.map +1 -0
- package/lib/operations/thresholds/moments.js +58 -0
- package/lib/operations/thresholds/moments.js.map +1 -0
- package/lib/operations/thresholds/otsu.d.ts +7 -1
- package/lib/operations/thresholds/otsu.d.ts.map +1 -1
- package/lib/operations/thresholds/otsu.js +37 -34
- package/lib/operations/thresholds/otsu.js.map +1 -1
- package/lib/operations/thresholds/percentile.d.ts +7 -0
- package/lib/operations/thresholds/percentile.d.ts.map +1 -0
- package/lib/operations/thresholds/percentile.js +35 -0
- package/lib/operations/thresholds/percentile.js.map +1 -0
- package/lib/operations/thresholds/renyiEntropy.d.ts +8 -0
- package/lib/operations/thresholds/renyiEntropy.d.ts.map +1 -0
- package/lib/operations/thresholds/renyiEntropy.js +127 -0
- package/lib/operations/thresholds/renyiEntropy.js.map +1 -0
- package/lib/operations/thresholds/shanbhag.d.ts +8 -0
- package/lib/operations/thresholds/shanbhag.d.ts.map +1 -0
- package/lib/operations/thresholds/shanbhag.js +72 -0
- package/lib/operations/thresholds/shanbhag.js.map +1 -0
- package/lib/operations/thresholds/triangle.d.ts +6 -1
- package/lib/operations/thresholds/triangle.d.ts.map +1 -1
- package/lib/operations/thresholds/triangle.js +107 -105
- package/lib/operations/thresholds/triangle.js.map +1 -1
- package/lib/operations/thresholds/yen.d.ts +8 -0
- package/lib/operations/thresholds/yen.d.ts.map +1 -0
- package/lib/operations/thresholds/yen.js +55 -0
- package/lib/operations/thresholds/yen.js.map +1 -0
- package/lib/point/operations.d.ts +10 -0
- package/lib/point/operations.d.ts.map +1 -0
- package/lib/point/operations.js +21 -0
- package/lib/point/operations.js.map +1 -0
- package/lib/roi/Roi.d.ts +218 -0
- package/lib/roi/Roi.d.ts.map +1 -0
- package/lib/roi/Roi.js +553 -0
- package/lib/roi/Roi.js.map +1 -0
- package/lib/roi/RoiMapManager.d.ts +59 -0
- package/lib/roi/RoiMapManager.d.ts.map +1 -0
- package/lib/roi/RoiMapManager.js +51 -0
- package/lib/roi/RoiMapManager.js.map +1 -0
- package/lib/roi/colorRois.d.ts +38 -0
- package/lib/roi/colorRois.d.ts.map +1 -0
- package/lib/roi/colorRois.js +41 -0
- package/lib/roi/colorRois.js.map +1 -0
- package/lib/roi/computeRois.d.ts +7 -0
- package/lib/roi/computeRois.d.ts.map +1 -0
- package/lib/roi/computeRois.js +81 -0
- package/lib/roi/computeRois.js.map +1 -0
- package/lib/roi/fromMask.d.ts +17 -0
- package/lib/roi/fromMask.d.ts.map +1 -0
- package/lib/roi/fromMask.js +139 -0
- package/lib/roi/fromMask.js.map +1 -0
- package/lib/roi/getBorderPoints.d.ts +12 -0
- package/lib/roi/getBorderPoints.d.ts.map +1 -0
- package/lib/roi/getBorderPoints.js +12 -0
- package/lib/roi/getBorderPoints.js.map +1 -0
- package/lib/roi/getMask.d.ts +17 -0
- package/lib/roi/getMask.d.ts.map +1 -0
- package/lib/roi/getMask.js +27 -0
- package/lib/roi/getMask.js.map +1 -0
- package/lib/roi/getRois.d.ts +33 -0
- package/lib/roi/getRois.d.ts.map +1 -0
- package/lib/roi/getRois.js +27 -0
- package/lib/roi/getRois.js.map +1 -0
- package/lib/roi/index.d.ts +11 -0
- package/lib/roi/index.d.ts.map +1 -0
- package/lib/roi/index.js +11 -0
- package/lib/roi/index.js.map +1 -0
- package/lib/roi/properties/getEllipse.d.ts +9 -0
- package/lib/roi/properties/getEllipse.d.ts.map +1 -0
- package/lib/roi/properties/getEllipse.js +96 -0
- package/lib/roi/properties/getEllipse.js.map +1 -0
- package/lib/roi/roi.types.d.ts +29 -0
- package/lib/roi/roi.types.d.ts.map +1 -0
- package/lib/roi/roi.types.js +2 -0
- package/lib/roi/roi.types.js.map +1 -0
- package/lib/roi/utils/colorMaps/getBinaryMap.d.ts +33 -0
- package/lib/roi/utils/colorMaps/getBinaryMap.d.ts.map +1 -0
- package/lib/roi/utils/colorMaps/getBinaryMap.js +27 -0
- package/lib/roi/utils/colorMaps/getBinaryMap.js.map +1 -0
- package/lib/roi/utils/colorMaps/getRainbowMap.d.ts +23 -0
- package/lib/roi/utils/colorMaps/getRainbowMap.d.ts.map +1 -0
- package/lib/roi/utils/colorMaps/getRainbowMap.js +37 -0
- package/lib/roi/utils/colorMaps/getRainbowMap.js.map +1 -0
- package/lib/roi/utils/colorMaps/getSaturationMap.d.ts +33 -0
- package/lib/roi/utils/colorMaps/getSaturationMap.d.ts.map +1 -0
- package/lib/roi/utils/colorMaps/getSaturationMap.js +32 -0
- package/lib/roi/utils/colorMaps/getSaturationMap.js.map +1 -0
- package/lib/roi/utils/getColorMap.d.ts +29 -0
- package/lib/roi/utils/getColorMap.d.ts.map +1 -0
- package/lib/roi/utils/getColorMap.js +19 -0
- package/lib/roi/utils/getColorMap.js.map +1 -0
- package/lib/roi/utils/hsvToRgb.d.ts +20 -0
- package/lib/roi/utils/hsvToRgb.d.ts.map +1 -0
- package/lib/roi/utils/hsvToRgb.js +53 -0
- package/lib/roi/utils/hsvToRgb.js.map +1 -0
- package/lib/roi/utils/rgbToNumber.d.ts +7 -0
- package/lib/roi/utils/rgbToNumber.d.ts.map +1 -0
- package/lib/roi/utils/rgbToNumber.js +9 -0
- package/lib/roi/utils/rgbToNumber.js.map +1 -0
- package/lib/roi/waterShed.d.ts +36 -0
- package/lib/roi/waterShed.d.ts.map +1 -0
- package/lib/roi/waterShed.js +91 -0
- package/lib/roi/waterShed.js.map +1 -0
- package/lib/save/encode.d.ts +30 -34
- package/lib/save/encode.d.ts.map +1 -1
- package/lib/save/encode.js +24 -24
- package/lib/save/encode.js.map +1 -1
- package/lib/save/encodeBmp.d.ts +9 -0
- package/lib/save/encodeBmp.d.ts.map +1 -0
- package/lib/save/encodeBmp.js +30 -0
- package/lib/save/encodeBmp.js.map +1 -0
- package/lib/save/encodeDataURL.d.ts +10 -0
- package/lib/save/encodeDataURL.d.ts.map +1 -0
- package/lib/save/encodeDataURL.js +15 -0
- package/lib/save/encodeDataURL.js.map +1 -0
- package/lib/save/encodeJpeg.d.ts +16 -5
- package/lib/save/encodeJpeg.d.ts.map +1 -1
- package/lib/save/encodeJpeg.js +20 -18
- package/lib/save/encodeJpeg.js.map +1 -1
- package/lib/save/encodePng.d.ts +11 -4
- package/lib/save/encodePng.d.ts.map +1 -1
- package/lib/save/encodePng.js +22 -7
- package/lib/save/encodePng.js.map +1 -1
- package/lib/save/index.d.ts +6 -5
- package/lib/save/index.d.ts.map +1 -1
- package/lib/save/index.js +6 -10
- package/lib/save/index.js.map +1 -1
- package/lib/save/write.d.ts +61 -22
- package/lib/save/write.d.ts.map +1 -1
- package/lib/save/write.js +72 -49
- package/lib/save/write.js.map +1 -1
- package/lib/save/writeCanvas.d.ts +40 -14
- package/lib/save/writeCanvas.d.ts.map +1 -1
- package/lib/save/writeCanvas.js +28 -21
- package/lib/save/writeCanvas.js.map +1 -1
- package/lib/ssim/compute_dssim.d.ts +12 -0
- package/lib/ssim/compute_dssim.d.ts.map +1 -0
- package/lib/ssim/compute_dssim.js +14 -0
- package/lib/ssim/compute_dssim.js.map +1 -0
- package/lib/ssim/compute_ssim.d.ts +42 -0
- package/lib/ssim/compute_ssim.d.ts.map +1 -0
- package/lib/ssim/compute_ssim.js +56 -0
- package/lib/ssim/compute_ssim.js.map +1 -0
- package/lib/ssim/index.d.ts +3 -0
- package/lib/ssim/index.d.ts.map +1 -0
- package/lib/ssim/index.js +3 -0
- package/lib/ssim/index.js.map +1 -0
- package/lib/stack/compute/histogram.d.ts +10 -0
- package/lib/stack/compute/histogram.d.ts.map +1 -0
- package/lib/stack/compute/histogram.js +21 -0
- package/lib/stack/compute/histogram.js.map +1 -0
- package/lib/stack/compute/maxImage.d.ts +9 -0
- package/lib/stack/compute/maxImage.d.ts.map +1 -0
- package/lib/stack/compute/maxImage.js +21 -0
- package/lib/stack/compute/maxImage.js.map +1 -0
- package/lib/stack/compute/meanImage.d.ts +9 -0
- package/lib/stack/compute/meanImage.d.ts.map +1 -0
- package/lib/stack/compute/meanImage.js +29 -0
- package/lib/stack/compute/meanImage.js.map +1 -0
- package/lib/stack/compute/medianImage.d.ts +9 -0
- package/lib/stack/compute/medianImage.d.ts.map +1 -0
- package/lib/stack/compute/medianImage.js +25 -0
- package/lib/stack/compute/medianImage.js.map +1 -0
- package/lib/stack/compute/minImage.d.ts +9 -0
- package/lib/stack/compute/minImage.d.ts.map +1 -0
- package/lib/stack/compute/minImage.js +22 -0
- package/lib/stack/compute/minImage.js.map +1 -0
- package/lib/stack/compute/sum.d.ts +9 -0
- package/lib/stack/compute/sum.d.ts.map +1 -0
- package/lib/stack/compute/sum.js +30 -0
- package/lib/stack/compute/sum.js.map +1 -0
- package/lib/stack/index.d.ts +8 -0
- package/lib/stack/index.d.ts.map +1 -0
- package/lib/stack/index.js +8 -0
- package/lib/stack/index.js.map +1 -0
- package/lib/stack/load/decodeApng.d.ts +8 -0
- package/lib/stack/load/decodeApng.d.ts.map +1 -0
- package/lib/stack/load/decodeApng.js +60 -0
- package/lib/stack/load/decodeApng.js.map +1 -0
- package/lib/stack/load/decodeStack.d.ts +9 -0
- package/lib/stack/load/decodeStack.d.ts.map +1 -0
- package/lib/stack/load/decodeStack.js +21 -0
- package/lib/stack/load/decodeStack.js.map +1 -0
- package/lib/stack/load/decodeTiff.d.ts +8 -0
- package/lib/stack/load/decodeTiff.d.ts.map +1 -0
- package/lib/stack/load/decodeTiff.js +17 -0
- package/lib/stack/load/decodeTiff.js.map +1 -0
- package/lib/stack/utils/checkImagesValid.d.ts +13 -0
- package/lib/stack/utils/checkImagesValid.d.ts.map +1 -0
- package/lib/stack/utils/checkImagesValid.js +29 -0
- package/lib/stack/utils/checkImagesValid.js.map +1 -0
- package/lib/stack/utils/checkProcessable.d.ts +24 -0
- package/lib/stack/utils/checkProcessable.d.ts.map +1 -0
- package/lib/stack/utils/checkProcessable.js +32 -0
- package/lib/stack/utils/checkProcessable.js.map +1 -0
- package/lib/stack/utils/getStackFromFolder.d.ts +8 -0
- package/lib/stack/utils/getStackFromFolder.d.ts.map +1 -0
- package/lib/stack/utils/getStackFromFolder.js +16 -0
- package/lib/stack/utils/getStackFromFolder.js.map +1 -0
- package/lib/utils/arrayPointsToObjects.d.ts +8 -0
- package/lib/utils/arrayPointsToObjects.d.ts.map +1 -0
- package/lib/utils/arrayPointsToObjects.js +13 -0
- package/lib/utils/arrayPointsToObjects.js.map +1 -0
- package/lib/utils/boolToNumber.d.ts +8 -0
- package/lib/utils/boolToNumber.d.ts.map +1 -0
- package/lib/utils/boolToNumber.js +16 -0
- package/lib/utils/boolToNumber.js.map +1 -0
- package/lib/utils/borderIterator.d.ts +9 -0
- package/lib/utils/borderIterator.d.ts.map +1 -0
- package/lib/utils/borderIterator.js +20 -0
- package/lib/utils/borderIterator.js.map +1 -0
- package/lib/utils/clamp.d.ts +15 -3
- package/lib/utils/clamp.d.ts.map +1 -1
- package/lib/utils/clamp.js +42 -18
- package/lib/utils/clamp.js.map +1 -1
- package/lib/utils/constants/channelLabels.d.ts +8 -0
- package/lib/utils/constants/channelLabels.d.ts.map +1 -0
- package/lib/utils/constants/channelLabels.js +8 -0
- package/lib/utils/constants/channelLabels.js.map +1 -0
- package/lib/utils/constants/colorModels.d.ts +14 -0
- package/lib/utils/constants/colorModels.d.ts.map +1 -0
- package/lib/utils/constants/colorModels.js +35 -0
- package/lib/utils/constants/colorModels.js.map +1 -0
- package/lib/utils/constants/kernels.d.ts +13 -0
- package/lib/utils/constants/kernels.d.ts.map +1 -0
- package/lib/utils/constants/kernels.js +63 -0
- package/lib/utils/constants/kernels.js.map +1 -0
- package/lib/utils/constants/kinds.d.ts +7 -0
- package/lib/utils/constants/kinds.d.ts.map +1 -0
- package/lib/utils/constants/kinds.js +19 -0
- package/lib/utils/constants/kinds.js.map +1 -0
- package/lib/utils/copyData.d.ts +5 -0
- package/lib/utils/copyData.d.ts.map +1 -0
- package/lib/utils/copyData.js +15 -0
- package/lib/utils/copyData.js.map +1 -0
- package/lib/utils/cross_platform.d.ts +11 -0
- package/lib/utils/cross_platform.d.ts.map +1 -0
- package/lib/utils/cross_platform.js +17 -0
- package/lib/utils/cross_platform.js.map +1 -0
- package/lib/utils/geometry/angles.d.ts +16 -0
- package/lib/utils/geometry/angles.d.ts.map +1 -0
- package/lib/utils/geometry/angles.js +24 -0
- package/lib/utils/geometry/angles.js.map +1 -0
- package/lib/utils/geometry/getCirclePoints.d.ts +30 -0
- package/lib/utils/geometry/getCirclePoints.d.ts.map +1 -0
- package/lib/utils/geometry/getCirclePoints.js +88 -0
- package/lib/utils/geometry/getCirclePoints.js.map +1 -0
- package/lib/utils/geometry/index.d.ts +2 -0
- package/lib/utils/geometry/index.d.ts.map +1 -0
- package/lib/utils/geometry/index.js +2 -0
- package/lib/utils/geometry/index.js.map +1 -0
- package/lib/utils/geometry/lines.d.ts +23 -0
- package/lib/utils/geometry/lines.d.ts.map +1 -0
- package/lib/utils/geometry/lines.js +10 -0
- package/lib/utils/geometry/lines.js.map +1 -0
- package/lib/utils/geometry/points.d.ts +67 -0
- package/lib/utils/geometry/points.d.ts.map +1 -0
- package/lib/utils/geometry/points.js +80 -0
- package/lib/utils/geometry/points.js.map +1 -0
- package/lib/utils/geometry/polygons.d.ts +16 -0
- package/lib/utils/geometry/polygons.d.ts.map +1 -0
- package/lib/utils/geometry/polygons.js +30 -0
- package/lib/utils/geometry/polygons.js.map +1 -0
- package/lib/utils/geometry/removeClosePoints.d.ts +28 -0
- package/lib/utils/geometry/removeClosePoints.d.ts.map +1 -0
- package/lib/utils/geometry/removeClosePoints.js +44 -0
- package/lib/utils/geometry/removeClosePoints.js.map +1 -0
- package/lib/utils/getDefaultColor.d.ts +10 -0
- package/lib/utils/getDefaultColor.d.ts.map +1 -0
- package/lib/utils/getDefaultColor.js +17 -0
- package/lib/utils/getDefaultColor.js.map +1 -0
- package/lib/utils/getIndex.d.ts +5 -0
- package/lib/utils/getIndex.d.ts.map +1 -0
- package/lib/utils/getIndex.js +12 -0
- package/lib/utils/getIndex.js.map +1 -0
- package/lib/utils/getMinMax.d.ts +11 -0
- package/lib/utils/getMinMax.d.ts.map +1 -0
- package/lib/utils/getMinMax.js +24 -0
- package/lib/utils/getMinMax.js.map +1 -0
- package/lib/utils/getOutputImage.d.ts +57 -25
- package/lib/utils/getOutputImage.d.ts.map +1 -1
- package/lib/utils/getOutputImage.js +138 -37
- package/lib/utils/getOutputImage.js.map +1 -1
- package/lib/utils/getRadius.d.ts +7 -0
- package/lib/utils/getRadius.d.ts.map +1 -0
- package/lib/utils/getRadius.js +12 -0
- package/lib/utils/getRadius.js.map +1 -0
- package/lib/utils/interpolateBorder.d.ts +53 -9
- package/lib/utils/interpolateBorder.d.ts.map +1 -1
- package/lib/utils/interpolateBorder.js +136 -106
- package/lib/utils/interpolateBorder.js.map +1 -1
- package/lib/utils/interpolatePixel.d.ts +16 -7
- package/lib/utils/interpolatePixel.d.ts.map +1 -1
- package/lib/utils/interpolatePixel.js +121 -80
- package/lib/utils/interpolatePixel.js.map +1 -1
- package/lib/utils/round.d.ts +6 -1
- package/lib/utils/round.d.ts.map +1 -1
- package/lib/utils/round.js +18 -9
- package/lib/utils/round.js.map +1 -1
- package/lib/utils/sampleBackgroundPoints.d.ts +34 -0
- package/lib/utils/sampleBackgroundPoints.d.ts.map +1 -0
- package/lib/utils/sampleBackgroundPoints.js +37 -0
- package/lib/utils/sampleBackgroundPoints.js.map +1 -0
- package/lib/utils/setBlendedPixel.d.ts +11 -0
- package/lib/utils/setBlendedPixel.d.ts.map +1 -0
- package/lib/utils/setBlendedPixel.js +36 -0
- package/lib/utils/setBlendedPixel.js.map +1 -0
- package/lib/utils/setBlendedVisiblePixel.d.ts +11 -0
- package/lib/utils/setBlendedVisiblePixel.d.ts.map +1 -0
- package/lib/utils/setBlendedVisiblePixel.js +14 -0
- package/lib/utils/setBlendedVisiblePixel.js.map +1 -0
- package/lib/utils/surroundingPixels.d.ts +9 -0
- package/lib/utils/surroundingPixels.d.ts.map +1 -0
- package/lib/utils/surroundingPixels.js +15 -0
- package/lib/utils/surroundingPixels.js.map +1 -0
- package/lib/utils/utils.types.d.ts +25 -0
- package/lib/utils/utils.types.d.ts.map +1 -0
- package/lib/utils/utils.types.js +2 -0
- package/lib/utils/utils.types.js.map +1 -0
- package/lib/utils/validators/assert.d.ts +12 -0
- package/lib/utils/validators/assert.d.ts.map +1 -0
- package/lib/utils/validators/assert.js +18 -0
- package/lib/utils/validators/assert.js.map +1 -0
- package/lib/utils/validators/checkKernel.d.ts +6 -0
- package/lib/utils/validators/checkKernel.d.ts.map +1 -0
- package/lib/utils/validators/checkKernel.js +10 -0
- package/lib/utils/validators/checkKernel.js.map +1 -0
- package/lib/utils/validators/checkPointIsInteger.d.ts +8 -0
- package/lib/utils/validators/checkPointIsInteger.d.ts.map +1 -0
- package/lib/utils/validators/checkPointIsInteger.js +11 -0
- package/lib/utils/validators/checkPointIsInteger.js.map +1 -0
- package/lib/utils/validators/checkProcessable.d.ts +25 -0
- package/lib/utils/validators/checkProcessable.d.ts.map +1 -0
- package/lib/utils/validators/checkProcessable.js +64 -0
- package/lib/utils/validators/checkProcessable.js.map +1 -0
- package/lib/utils/validators/validators.d.ts +39 -0
- package/lib/utils/validators/validators.d.ts.map +1 -0
- package/lib/utils/validators/validators.js +66 -0
- package/lib/utils/validators/validators.js.map +1 -0
- package/package.json +91 -18
- package/src/Image.ts +922 -238
- package/src/Mask.ts +731 -0
- package/src/Stack.ts +204 -0
- package/src/align/affineTransfrom/affineFitFunction.ts +27 -0
- package/src/align/affineTransfrom/applyAffineTransform.ts +27 -0
- package/src/align/affineTransfrom/createAffineTransformModel.ts +31 -0
- package/src/align/affineTransfrom/drawResult.ts +56 -0
- package/src/align/affineTransfrom/getAffineTransform.ts +310 -0
- package/src/align/affineTransfrom/getEuclideanDistance.ts +11 -0
- package/src/align/affineTransfrom/getMatrixFromPoints.ts +20 -0
- package/src/align/affineTransfrom/getPointsFromMatrix.ts +17 -0
- package/src/align/affineTransfrom/utils/getSourceWithoutMargins.ts +30 -0
- package/src/align/alignMinDifference.ts +114 -0
- package/src/align/index.ts +2 -0
- package/src/compare/add.ts +34 -0
- package/src/compare/computePsnr.ts +17 -0
- package/src/compare/computeRmse.ts +33 -0
- package/src/compare/divide.ts +50 -0
- package/src/compare/index.ts +6 -0
- package/src/compare/multiply.ts +48 -0
- package/src/compare/subtract.ts +86 -0
- package/src/compute/getExtrema.ts +103 -0
- package/src/compute/histogram.ts +32 -10
- package/src/compute/index.ts +5 -1
- package/src/compute/mean.ts +48 -0
- package/src/compute/median.ts +50 -0
- package/src/compute/variance.ts +41 -0
- package/src/correctColor/correctColor.ts +109 -0
- package/src/correctColor/index.ts +1 -0
- package/src/correctColor/utils/formatData.ts +86 -0
- package/src/correctColor/utils/getImageColors.ts +23 -0
- package/src/correctColor/utils/referenceColorCard.ts +175 -0
- package/src/draw/drawCircleOnImage.ts +123 -0
- package/src/draw/drawLineOnImage.ts +64 -0
- package/src/draw/drawLineOnMask.ts +45 -0
- package/src/draw/drawMarker.ts +108 -0
- package/src/draw/drawMarkers.ts +25 -0
- package/src/draw/drawPoints.ts +74 -0
- package/src/draw/drawPolygonOnImage.ts +80 -0
- package/src/draw/drawPolygonOnMask.ts +69 -0
- package/src/draw/drawPolylineOnImage.ts +56 -0
- package/src/draw/drawPolylineOnMask.ts +37 -0
- package/src/draw/drawRectangle.ts +123 -0
- package/src/draw/index.ts +11 -0
- package/src/draw/utils/deleteDuplicates.ts +21 -0
- package/src/draw/utils/roundPoint.ts +13 -0
- package/src/featureMatching/descriptors/getBrief.ts +42 -0
- package/src/featureMatching/descriptors/getBriefDescriptors.ts +108 -0
- package/src/featureMatching/descriptors/utils/getKeypointPatch.ts +59 -0
- package/src/featureMatching/descriptors/utils/sliceBrief.ts +34 -0
- package/src/featureMatching/featureMatching.types.ts +26 -0
- package/src/featureMatching/index.ts +12 -0
- package/src/featureMatching/keypoints/getBestKeypointsInRadius.ts +39 -0
- package/src/featureMatching/keypoints/getFastKeypoints.ts +157 -0
- package/src/featureMatching/keypoints/getFastScore.ts +37 -0
- package/src/featureMatching/keypoints/getHarrisScore.ts +73 -0
- package/src/featureMatching/keypoints/getIntensityCentroid.ts +34 -0
- package/src/featureMatching/keypoints/getIntensityMoment.ts +43 -0
- package/src/featureMatching/keypoints/getOrientedFastKeypoints.ts +67 -0
- package/src/featureMatching/keypoints/getPatchIntensityCentroid.ts +39 -0
- package/src/featureMatching/keypoints/getPatchIntensityMoment.ts +56 -0
- package/src/featureMatching/keypoints/isFastKeypoint.ts +101 -0
- package/src/featureMatching/keypoints/utils/getDistanceMatrix.ts +35 -0
- package/src/featureMatching/keypoints/utils/getKeypointsInRadius.ts +34 -0
- package/src/featureMatching/matching/bruteForceMatch.ts +79 -0
- package/src/featureMatching/matching/filterEuclideanDistance.ts +64 -0
- package/src/featureMatching/matching/filterSmallestDistanceMatches.ts +30 -0
- package/src/featureMatching/matching/getCrosscheckMatches.ts +69 -0
- package/src/featureMatching/matching/getHammingDistance.ts +20 -0
- package/src/featureMatching/utils/checkBorderDistance.ts +22 -0
- package/src/featureMatching/utils/compareIntensity.ts +35 -0
- package/src/featureMatching/utils/extractSquareImage.ts +27 -0
- package/src/featureMatching/utils/getColors.ts +34 -0
- package/src/featureMatching/utils/getGaussianPoints.ts +64 -0
- package/src/featureMatching/utils/getKeypointColor.ts +29 -0
- package/src/featureMatching/utils/getMatchColor.ts +27 -0
- package/src/featureMatching/utils/sortByDistance.ts +14 -0
- package/src/featureMatching/utils/sortBySourceDest.ts +31 -0
- package/src/featureMatching/visualize/Montage.ts +165 -0
- package/src/featureMatching/visualize/drawKeypoints.ts +146 -0
- package/src/featureMatching/visualize/drawMatches.ts +107 -0
- package/src/featureMatching/visualize/overlapImages.ts +67 -0
- package/src/featureMatching/visualize/scaleKeypoints.ts +24 -0
- package/src/filters/and.ts +33 -0
- package/src/filters/blur.ts +41 -6
- package/src/filters/convolution.ts +173 -137
- package/src/filters/derivativeFilter.ts +71 -0
- package/src/filters/flip.ts +35 -0
- package/src/filters/flipX.ts +32 -0
- package/src/filters/flipY.ts +34 -0
- package/src/filters/gaussianBlur.ts +74 -27
- package/src/filters/gradientFilter.ts +103 -0
- package/src/filters/hypotenuse.ts +62 -0
- package/src/filters/increaseContrast.ts +69 -0
- package/src/filters/index.ts +14 -4
- package/src/filters/invert.ts +42 -11
- package/src/filters/level.ts +131 -0
- package/src/filters/medianFilter.ts +83 -0
- package/src/filters/or.ts +33 -0
- package/src/filters/pixelate.ts +178 -0
- package/src/geometry/getPerspectiveWarp.ts +169 -0
- package/src/geometry/index.ts +6 -3
- package/src/geometry/resize.ts +89 -57
- package/src/geometry/rotate.ts +56 -44
- package/src/geometry/transform.ts +137 -51
- package/src/geometry/transformRotate.ts +65 -0
- package/src/index.ts +24 -8
- package/src/load/decode.ts +20 -17
- package/src/load/decodeBmp.ts +37 -0
- package/src/load/decodeJpeg.ts +20 -4
- package/src/load/decodePng.ts +68 -33
- package/src/load/decodeTiff.ts +94 -0
- package/src/load/fetchURL.ts +13 -0
- package/src/load/getMetadata.ts +18 -0
- package/src/load/index.ts +9 -6
- package/src/load/load.types.ts +7 -0
- package/src/load/read.ts +15 -12
- package/src/load/readCanvas.ts +11 -9
- package/src/load/readImg.ts +15 -9
- package/src/maskAnalysis/getBorderPoints.ts +70 -0
- package/src/maskAnalysis/getConvexHull.ts +29 -0
- package/src/maskAnalysis/getFeret.ts +239 -0
- package/src/maskAnalysis/getMbr.ts +17 -0
- package/src/maskAnalysis/index.ts +1 -0
- package/src/maskAnalysis/maskAnalysis.types.ts +100 -0
- package/src/maskAnalysis/utils/getAngle.ts +40 -0
- package/src/maskAnalysis/utils/getExtendedBorderPoints.ts +30 -0
- package/src/maskAnalysis/utils/getMbrAngle.ts +26 -0
- package/src/maskAnalysis/utils/getMbrFromPoints.ts +112 -0
- package/src/maskAnalysis/utils/monotoneChainConvexHull.ts +66 -0
- package/src/morphology/bottomHat.ts +64 -0
- package/src/morphology/cannyEdgeDetector.ts +209 -0
- package/src/morphology/clearBorder.ts +41 -0
- package/src/morphology/close.ts +59 -0
- package/src/morphology/dilate.ts +261 -0
- package/src/morphology/erode.ts +261 -0
- package/src/morphology/floodFill.ts +38 -0
- package/src/morphology/index.ts +11 -0
- package/src/morphology/morphologicalGradient.ts +66 -0
- package/src/morphology/multipleFloodFill.ts +135 -0
- package/src/morphology/open.ts +62 -0
- package/src/morphology/solidFill.ts +29 -0
- package/src/morphology/topHat.ts +62 -0
- package/src/operations/convertBitDepth.ts +74 -0
- package/src/operations/convertColor.ts +143 -66
- package/src/operations/copyTo.ts +79 -0
- package/src/operations/correctBackground.ts +71 -0
- package/src/operations/crop.ts +94 -0
- package/src/operations/cropAlpha.ts +108 -0
- package/src/operations/cropRectangle.ts +112 -0
- package/src/operations/extendBorders.ts +119 -0
- package/src/operations/extract.ts +76 -0
- package/src/operations/getMaskFromCannyEdge.ts +41 -0
- package/src/operations/grey.ts +139 -0
- package/src/operations/greyAlgorithms.ts +248 -0
- package/src/operations/index.ts +16 -5
- package/src/operations/merge.ts +36 -20
- package/src/operations/operations.types.ts +6 -0
- package/src/operations/paintMaskOnImage.ts +111 -0
- package/src/operations/paintMaskOnMask.ts +59 -0
- package/src/operations/split.ts +11 -4
- package/src/operations/threshold.ts +111 -52
- package/src/operations/thresholds/huang.ts +84 -0
- package/src/operations/thresholds/intermodes.ts +61 -0
- package/src/operations/thresholds/isodata.ts +53 -0
- package/src/operations/thresholds/li.ts +80 -0
- package/src/operations/thresholds/maxEntropy.ts +88 -0
- package/src/operations/thresholds/mean.ts +22 -0
- package/src/operations/thresholds/minError.ts +101 -0
- package/src/operations/thresholds/minimum.ts +77 -0
- package/src/operations/thresholds/moments.ts +59 -0
- package/src/operations/thresholds/otsu.ts +7 -1
- package/src/operations/thresholds/percentile.ts +39 -0
- package/src/operations/thresholds/renyiEntropy.ts +145 -0
- package/src/operations/thresholds/shanbhag.ts +80 -0
- package/src/operations/thresholds/triangle.ts +8 -2
- package/src/operations/thresholds/yen.ts +59 -0
- package/src/point/operations.ts +29 -0
- package/src/roi/Roi.ts +661 -0
- package/src/roi/RoiMapManager.ts +97 -0
- package/src/roi/colorRois.ts +68 -0
- package/src/roi/computeRois.ts +90 -0
- package/src/roi/fromMask.ts +182 -0
- package/src/roi/getBorderPoints.ts +20 -0
- package/src/roi/getMask.ts +41 -0
- package/src/roi/getRois.ts +65 -0
- package/src/roi/index.ts +10 -0
- package/src/roi/properties/getEllipse.ts +124 -0
- package/src/roi/roi.types.ts +23 -0
- package/src/roi/utils/colorMaps/getBinaryMap.ts +67 -0
- package/src/roi/utils/colorMaps/getRainbowMap.ts +59 -0
- package/src/roi/utils/colorMaps/getSaturationMap.ts +70 -0
- package/src/roi/utils/getColorMap.ts +46 -0
- package/src/roi/utils/hsvToRgb.ts +61 -0
- package/src/roi/utils/rgbToNumber.ts +8 -0
- package/src/roi/waterShed.ts +146 -0
- package/src/save/encode.ts +41 -43
- package/src/save/encodeBmp.ts +31 -0
- package/src/save/encodeDataURL.ts +25 -0
- package/src/save/encodeJpeg.ts +22 -13
- package/src/save/encodePng.ts +30 -6
- package/src/save/index.ts +6 -5
- package/src/save/write.ts +129 -50
- package/src/save/writeCanvas.ts +45 -19
- package/src/ssim/compute_dssim.ts +21 -0
- package/src/ssim/compute_ssim.ts +94 -0
- package/src/ssim/index.ts +2 -0
- package/src/stack/compute/histogram.ts +26 -0
- package/src/stack/compute/maxImage.ts +31 -0
- package/src/stack/compute/meanImage.ts +37 -0
- package/src/stack/compute/medianImage.ts +30 -0
- package/src/stack/compute/minImage.ts +32 -0
- package/src/stack/compute/sum.ts +37 -0
- package/src/stack/index.ts +7 -0
- package/src/stack/load/decodeApng.ts +71 -0
- package/src/stack/load/decodeStack.ts +28 -0
- package/src/stack/load/decodeTiff.ts +19 -0
- package/src/stack/utils/checkImagesValid.ts +35 -0
- package/src/stack/utils/checkProcessable.ts +61 -0
- package/src/stack/utils/getStackFromFolder.ts +17 -0
- package/src/types/bresenham-zingl.d.ts +50 -0
- package/src/utils/arrayPointsToObjects.ts +15 -0
- package/src/utils/boolToNumber.ts +17 -0
- package/src/utils/borderIterator.ts +22 -0
- package/src/utils/clamp.ts +32 -5
- package/src/utils/constants/channelLabels.ts +9 -0
- package/src/utils/constants/colorModels.ts +45 -0
- package/src/utils/constants/kernels.ts +73 -0
- package/src/utils/constants/kinds.ts +26 -0
- package/src/utils/copyData.ts +21 -0
- package/src/utils/cross_platform.ts +18 -0
- package/src/utils/geometry/angles.ts +26 -0
- package/src/utils/geometry/getCirclePoints.ts +123 -0
- package/src/utils/geometry/index.ts +1 -0
- package/src/utils/geometry/lines.ts +26 -0
- package/src/utils/geometry/points.ts +104 -0
- package/src/utils/geometry/polygons.ts +32 -0
- package/src/utils/geometry/removeClosePoints.ts +83 -0
- package/src/utils/getDefaultColor.ts +20 -0
- package/src/utils/getIndex.ts +26 -0
- package/src/utils/getMinMax.ts +27 -0
- package/src/utils/getOutputImage.ts +149 -32
- package/src/utils/getRadius.ts +11 -0
- package/src/utils/interpolateBorder.ts +95 -62
- package/src/utils/interpolatePixel.ts +107 -57
- package/src/utils/round.ts +13 -3
- package/src/utils/sampleBackgroundPoints.ts +84 -0
- package/src/utils/setBlendedPixel.ts +54 -0
- package/src/utils/setBlendedVisiblePixel.ts +22 -0
- package/src/utils/surroundingPixels.ts +14 -0
- package/src/utils/utils.types.ts +32 -0
- package/src/utils/validators/assert.ts +18 -0
- package/src/utils/validators/checkKernel.ts +11 -0
- package/src/utils/validators/checkPointIsInteger.ts +12 -0
- package/src/utils/validators/checkProcessable.ts +95 -0
- package/src/utils/validators/validators.ts +82 -0
- package/lib/load/checkHeader.d.ts +0 -8
- package/lib/load/checkHeader.d.ts.map +0 -1
- package/lib/load/checkHeader.js +0 -21
- package/lib/load/checkHeader.js.map +0 -1
- package/lib/operations/convertDepth.d.ts +0 -3
- package/lib/operations/convertDepth.d.ts.map +0 -1
- package/lib/operations/convertDepth.js +0 -40
- package/lib/operations/convertDepth.js.map +0 -1
- package/lib/types.d.ts +0 -13
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js +0 -17
- package/lib/types.js.map +0 -1
- package/lib/utils/kinds.d.ts +0 -9
- package/lib/utils/kinds.d.ts.map +0 -1
- package/lib/utils/kinds.js +0 -22
- package/lib/utils/kinds.js.map +0 -1
- package/lib/utils/validators.d.ts +0 -7
- package/lib/utils/validators.d.ts.map +0 -1
- package/lib/utils/validators.js +0 -19
- package/lib/utils/validators.js.map +0 -1
- package/lib-esm/Image.d.ts +0 -180
- package/lib-esm/Image.d.ts.map +0 -1
- package/lib-esm/Image.js +0 -337
- package/lib-esm/Image.js.map +0 -1
- package/lib-esm/compute/histogram.d.ts +0 -15
- package/lib-esm/compute/histogram.d.ts.map +0 -1
- package/lib-esm/compute/histogram.js +0 -21
- package/lib-esm/compute/histogram.js.map +0 -1
- package/lib-esm/compute/index.d.ts +0 -2
- package/lib-esm/compute/index.d.ts.map +0 -1
- package/lib-esm/compute/index.js +0 -2
- package/lib-esm/compute/index.js.map +0 -1
- package/lib-esm/filters/blur.d.ts +0 -11
- package/lib-esm/filters/blur.d.ts.map +0 -1
- package/lib-esm/filters/blur.js +0 -11
- package/lib-esm/filters/blur.js.map +0 -1
- package/lib-esm/filters/convolution.d.ts +0 -11
- package/lib-esm/filters/convolution.d.ts.map +0 -1
- package/lib-esm/filters/convolution.js +0 -125
- package/lib-esm/filters/convolution.js.map +0 -1
- package/lib-esm/filters/gaussianBlur.d.ts +0 -18
- package/lib-esm/filters/gaussianBlur.d.ts.map +0 -1
- package/lib-esm/filters/gaussianBlur.js +0 -45
- package/lib-esm/filters/gaussianBlur.js.map +0 -1
- package/lib-esm/filters/index.d.ts +0 -5
- package/lib-esm/filters/index.d.ts.map +0 -1
- package/lib-esm/filters/index.js +0 -5
- package/lib-esm/filters/index.js.map +0 -1
- package/lib-esm/filters/invert.d.ts +0 -10
- package/lib-esm/filters/invert.d.ts.map +0 -1
- package/lib-esm/filters/invert.js +0 -14
- package/lib-esm/filters/invert.js.map +0 -1
- package/lib-esm/geometry/index.d.ts +0 -4
- package/lib-esm/geometry/index.d.ts.map +0 -1
- package/lib-esm/geometry/index.js +0 -4
- package/lib-esm/geometry/index.js.map +0 -1
- package/lib-esm/geometry/resize.d.ts +0 -14
- package/lib-esm/geometry/resize.d.ts.map +0 -1
- package/lib-esm/geometry/resize.js +0 -88
- package/lib-esm/geometry/resize.js.map +0 -1
- package/lib-esm/geometry/rotate.d.ts +0 -14
- package/lib-esm/geometry/rotate.d.ts.map +0 -1
- package/lib-esm/geometry/rotate.js +0 -24
- package/lib-esm/geometry/rotate.js.map +0 -1
- package/lib-esm/geometry/transform.d.ts +0 -13
- package/lib-esm/geometry/transform.d.ts.map +0 -1
- package/lib-esm/geometry/transform.js +0 -82
- package/lib-esm/geometry/transform.js.map +0 -1
- package/lib-esm/index.d.ts +0 -9
- package/lib-esm/index.d.ts.map +0 -1
- package/lib-esm/index.js +0 -9
- package/lib-esm/index.js.map +0 -1
- package/lib-esm/load/checkHeader.d.ts +0 -8
- package/lib-esm/load/checkHeader.d.ts.map +0 -1
- package/lib-esm/load/checkHeader.js +0 -18
- package/lib-esm/load/checkHeader.js.map +0 -1
- package/lib-esm/load/decode.d.ts +0 -8
- package/lib-esm/load/decode.d.ts.map +0 -1
- package/lib-esm/load/decode.js +0 -23
- package/lib-esm/load/decode.js.map +0 -1
- package/lib-esm/load/decodeJpeg.d.ts +0 -7
- package/lib-esm/load/decodeJpeg.d.ts.map +0 -1
- package/lib-esm/load/decodeJpeg.js +0 -14
- package/lib-esm/load/decodeJpeg.js.map +0 -1
- package/lib-esm/load/decodePng.d.ts +0 -7
- package/lib-esm/load/decodePng.d.ts.map +0 -1
- package/lib-esm/load/decodePng.js +0 -65
- package/lib-esm/load/decodePng.js.map +0 -1
- package/lib-esm/load/index.d.ts +0 -7
- package/lib-esm/load/index.d.ts.map +0 -1
- package/lib-esm/load/index.js +0 -7
- package/lib-esm/load/index.js.map +0 -1
- package/lib-esm/load/read.d.ts +0 -12
- package/lib-esm/load/read.d.ts.map +0 -1
- package/lib-esm/load/read.js +0 -20
- package/lib-esm/load/read.js.map +0 -1
- package/lib-esm/load/readCanvas.d.ts +0 -3
- package/lib-esm/load/readCanvas.d.ts.map +0 -1
- package/lib-esm/load/readCanvas.js +0 -15
- package/lib-esm/load/readCanvas.js.map +0 -1
- package/lib-esm/load/readImg.d.ts +0 -3
- package/lib-esm/load/readImg.d.ts.map +0 -1
- package/lib-esm/load/readImg.js +0 -14
- package/lib-esm/load/readImg.js.map +0 -1
- package/lib-esm/operations/convertColor.d.ts +0 -6
- package/lib-esm/operations/convertColor.d.ts.map +0 -1
- package/lib-esm/operations/convertColor.js +0 -73
- package/lib-esm/operations/convertColor.js.map +0 -1
- package/lib-esm/operations/convertDepth.d.ts +0 -3
- package/lib-esm/operations/convertDepth.d.ts.map +0 -1
- package/lib-esm/operations/convertDepth.js +0 -37
- package/lib-esm/operations/convertDepth.js.map +0 -1
- package/lib-esm/operations/index.d.ts +0 -6
- package/lib-esm/operations/index.d.ts.map +0 -1
- package/lib-esm/operations/index.js +0 -6
- package/lib-esm/operations/index.js.map +0 -1
- package/lib-esm/operations/merge.d.ts +0 -7
- package/lib-esm/operations/merge.d.ts.map +0 -1
- package/lib-esm/operations/merge.js +0 -45
- package/lib-esm/operations/merge.js.map +0 -1
- package/lib-esm/operations/split.d.ts +0 -3
- package/lib-esm/operations/split.d.ts.map +0 -1
- package/lib-esm/operations/split.js +0 -13
- package/lib-esm/operations/split.js.map +0 -1
- package/lib-esm/operations/threshold.d.ts +0 -19
- package/lib-esm/operations/threshold.d.ts.map +0 -1
- package/lib-esm/operations/threshold.js +0 -55
- package/lib-esm/operations/threshold.js.map +0 -1
- package/lib-esm/operations/thresholds/otsu.d.ts +0 -2
- package/lib-esm/operations/thresholds/otsu.d.ts.map +0 -1
- package/lib-esm/operations/thresholds/otsu.js +0 -32
- package/lib-esm/operations/thresholds/otsu.js.map +0 -1
- package/lib-esm/operations/thresholds/triangle.d.ts +0 -2
- package/lib-esm/operations/thresholds/triangle.d.ts.map +0 -1
- package/lib-esm/operations/thresholds/triangle.js +0 -103
- package/lib-esm/operations/thresholds/triangle.js.map +0 -1
- package/lib-esm/save/encode.d.ts +0 -35
- package/lib-esm/save/encode.d.ts.map +0 -1
- package/lib-esm/save/encode.js +0 -22
- package/lib-esm/save/encode.js.map +0 -1
- package/lib-esm/save/encodeJpeg.d.ts +0 -6
- package/lib-esm/save/encodeJpeg.d.ts.map +0 -1
- package/lib-esm/save/encodeJpeg.js +0 -16
- package/lib-esm/save/encodeJpeg.js.map +0 -1
- package/lib-esm/save/encodePng.d.ts +0 -5
- package/lib-esm/save/encodePng.d.ts.map +0 -1
- package/lib-esm/save/encodePng.js +0 -5
- package/lib-esm/save/encodePng.js.map +0 -1
- package/lib-esm/save/index.d.ts +0 -6
- package/lib-esm/save/index.d.ts.map +0 -1
- package/lib-esm/save/index.js +0 -6
- package/lib-esm/save/index.js.map +0 -1
- package/lib-esm/save/write.d.ts +0 -23
- package/lib-esm/save/write.d.ts.map +0 -1
- package/lib-esm/save/write.js +0 -46
- package/lib-esm/save/write.js.map +0 -1
- package/lib-esm/save/writeCanvas.d.ts +0 -15
- package/lib-esm/save/writeCanvas.d.ts.map +0 -1
- package/lib-esm/save/writeCanvas.js +0 -19
- package/lib-esm/save/writeCanvas.js.map +0 -1
- package/lib-esm/types.d.ts +0 -13
- package/lib-esm/types.d.ts.map +0 -1
- package/lib-esm/types.js +0 -15
- package/lib-esm/types.js.map +0 -1
- package/lib-esm/utils/clamp.d.ts +0 -4
- package/lib-esm/utils/clamp.d.ts.map +0 -1
- package/lib-esm/utils/clamp.js +0 -16
- package/lib-esm/utils/clamp.js.map +0 -1
- package/lib-esm/utils/getOutputImage.d.ts +0 -26
- package/lib-esm/utils/getOutputImage.d.ts.map +0 -1
- package/lib-esm/utils/getOutputImage.js +0 -35
- package/lib-esm/utils/getOutputImage.js.map +0 -1
- package/lib-esm/utils/interpolateBorder.d.ts +0 -10
- package/lib-esm/utils/interpolateBorder.d.ts.map +0 -1
- package/lib-esm/utils/interpolateBorder.js +0 -99
- package/lib-esm/utils/interpolateBorder.js.map +0 -1
- package/lib-esm/utils/interpolatePixel.d.ts +0 -8
- package/lib-esm/utils/interpolatePixel.d.ts.map +0 -1
- package/lib-esm/utils/interpolatePixel.js +0 -78
- package/lib-esm/utils/interpolatePixel.js.map +0 -1
- package/lib-esm/utils/kinds.d.ts +0 -9
- package/lib-esm/utils/kinds.d.ts.map +0 -1
- package/lib-esm/utils/kinds.js +0 -20
- package/lib-esm/utils/kinds.js.map +0 -1
- package/lib-esm/utils/round.d.ts +0 -2
- package/lib-esm/utils/round.d.ts.map +0 -1
- package/lib-esm/utils/round.js +0 -7
- package/lib-esm/utils/round.js.map +0 -1
- package/lib-esm/utils/validators.d.ts +0 -7
- package/lib-esm/utils/validators.d.ts.map +0 -1
- package/lib-esm/utils/validators.js +0 -15
- package/lib-esm/utils/validators.js.map +0 -1
- package/src/load/checkHeader.ts +0 -20
- package/src/operations/convertDepth.ts +0 -43
- package/src/operations/thresholds/huang.js +0 -80
- package/src/operations/thresholds/intermodes.js +0 -56
- package/src/operations/thresholds/isodata.js +0 -47
- package/src/operations/thresholds/li.js +0 -74
- package/src/operations/thresholds/maxEntropy.js +0 -79
- package/src/operations/thresholds/mean.js +0 -16
- package/src/operations/thresholds/minError.js +0 -92
- package/src/operations/thresholds/minimum.js +0 -75
- package/src/operations/thresholds/moments.js +0 -52
- package/src/operations/thresholds/percentile.js +0 -33
- package/src/operations/thresholds/renyiEntropy.js +0 -142
- package/src/operations/thresholds/shanbhag.js +0 -74
- package/src/operations/thresholds/yen.js +0 -56
- package/src/types.ts +0 -13
- package/src/utils/kinds.ts +0 -27
- package/src/utils/validators.ts +0 -23
package/lib/Image.js
CHANGED
|
@@ -1,340 +1,873 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
*
|
|
114
|
-
* @
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
*
|
|
138
|
-
* @
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
1
|
+
import { match } from 'ts-pattern';
|
|
2
|
+
import { divide } from './compare/divide.js';
|
|
3
|
+
import { add, subtract } from './compare/index.js';
|
|
4
|
+
import { multiply } from './compare/multiply.js';
|
|
5
|
+
import { histogram, mean, median, variance } from './compute/index.js';
|
|
6
|
+
import { correctColor } from './correctColor/index.js';
|
|
7
|
+
import { drawCircleOnImage, drawLineOnImage, drawMarker, drawMarkers, drawPoints, drawPolygonOnImage, drawPolylineOnImage, drawRectangle, } from './draw/index.js';
|
|
8
|
+
import { blur, derivativeFilter, directConvolution, flip, gaussianBlur, gradientFilter, hypotenuse, increaseContrast, invert, level, medianFilter, pixelate, rawDirectConvolution, separableConvolution, } from './filters/index.js';
|
|
9
|
+
import { resize, rotate, transform, transformRotate, } from './geometry/index.js';
|
|
10
|
+
import { bottomHat, cannyEdgeDetector, close, dilate, erode, morphologicalGradient, open, topHat, } from './morphology/index.js';
|
|
11
|
+
import { convertBitDepth, convertColor, copyTo, crop, cropAlpha, cropRectangle, extract, grey, paintMaskOnImage, split, threshold, } from './operations/index.js';
|
|
12
|
+
import { colorModels } from './utils/constants/colorModels.js';
|
|
13
|
+
import { getMinMax } from './utils/getMinMax.js';
|
|
14
|
+
import { validateChannel, validateValue, } from './utils/validators/validators.js';
|
|
15
|
+
export const ImageCoordinates = {
|
|
16
|
+
CENTER: 'center',
|
|
17
|
+
TOP_LEFT: 'top-left',
|
|
18
|
+
TOP_RIGHT: 'top-right',
|
|
19
|
+
BOTTOM_LEFT: 'bottom-left',
|
|
20
|
+
BOTTOM_RIGHT: 'bottom-right',
|
|
21
|
+
};
|
|
22
|
+
export class Image {
|
|
23
|
+
/**
|
|
24
|
+
* The number of columns of the image.
|
|
25
|
+
*/
|
|
26
|
+
width;
|
|
27
|
+
/**
|
|
28
|
+
* The number of rows of the image.
|
|
29
|
+
*/
|
|
30
|
+
height;
|
|
31
|
+
/**
|
|
32
|
+
* The total number of pixels in the image (width × height).
|
|
33
|
+
*/
|
|
34
|
+
size;
|
|
35
|
+
/**
|
|
36
|
+
* The number of bits per value in each channel.
|
|
37
|
+
*/
|
|
38
|
+
bitDepth;
|
|
39
|
+
/**
|
|
40
|
+
* The color model of the image.
|
|
41
|
+
*/
|
|
42
|
+
colorModel;
|
|
43
|
+
/**
|
|
44
|
+
* The number of color channels in the image, excluding the alpha channel.
|
|
45
|
+
* A GREY image has 1 component. An RGB image has 3 components.
|
|
46
|
+
*/
|
|
47
|
+
components;
|
|
48
|
+
/**
|
|
49
|
+
* The total number of channels in the image, including the alpha channel.
|
|
50
|
+
*/
|
|
51
|
+
channels;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the image has an alpha channel or not.
|
|
54
|
+
*/
|
|
55
|
+
alpha;
|
|
56
|
+
/**
|
|
57
|
+
* The maximum value that a pixel channel can have.
|
|
58
|
+
*/
|
|
59
|
+
maxValue;
|
|
60
|
+
/**
|
|
61
|
+
* Origin of the image relative to a the parent image.
|
|
62
|
+
*/
|
|
63
|
+
origin;
|
|
64
|
+
meta;
|
|
65
|
+
/**
|
|
66
|
+
* Typed array holding the image data.
|
|
67
|
+
*/
|
|
68
|
+
data;
|
|
69
|
+
/**
|
|
70
|
+
* Construct a new Image knowing its dimensions.
|
|
71
|
+
* @param width - Image width.
|
|
72
|
+
* @param height - Image height.
|
|
73
|
+
* @param options - Image options.
|
|
74
|
+
*/
|
|
75
|
+
constructor(width, height, options = {}) {
|
|
76
|
+
const { bitDepth = 8, data, colorModel = 'RGB', origin = { row: 0, column: 0 }, meta, } = options;
|
|
77
|
+
if (width < 1 || !Number.isInteger(width)) {
|
|
78
|
+
throw new RangeError(`width must be an integer and at least 1. Received ${width}`);
|
|
79
|
+
}
|
|
80
|
+
if (height < 1 || !Number.isInteger(height)) {
|
|
81
|
+
throw new RangeError(`height must be an integer and at least 1. Received ${height}`);
|
|
82
|
+
}
|
|
83
|
+
this.width = width;
|
|
84
|
+
this.height = height;
|
|
85
|
+
this.size = width * height;
|
|
86
|
+
this.bitDepth = bitDepth;
|
|
87
|
+
this.colorModel = colorModel;
|
|
88
|
+
this.origin = origin;
|
|
89
|
+
this.meta = meta;
|
|
90
|
+
const colorModelDef = colorModels[colorModel];
|
|
91
|
+
this.components = colorModelDef.components;
|
|
92
|
+
this.alpha = colorModelDef.alpha;
|
|
93
|
+
this.channels = colorModelDef.channels;
|
|
94
|
+
this.maxValue = 2 ** bitDepth - 1;
|
|
95
|
+
if (data === undefined) {
|
|
96
|
+
this.data = createPixelArray(this.size, this.channels, this.alpha, this.bitDepth, this.maxValue);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
if (bitDepth === 8 && data instanceof Uint16Array) {
|
|
100
|
+
throw new RangeError(`bitDepth is ${bitDepth} but data is Uint16Array`);
|
|
101
|
+
}
|
|
102
|
+
else if (bitDepth === 16 && data instanceof Uint8Array) {
|
|
103
|
+
throw new RangeError(`bitDepth is ${bitDepth} but data is Uint8Array`);
|
|
104
|
+
}
|
|
105
|
+
const expectedLength = this.size * this.channels;
|
|
106
|
+
if (data.length !== expectedLength) {
|
|
107
|
+
throw new RangeError(`incorrect data size: ${data.length}. Expected ${expectedLength}`);
|
|
108
|
+
}
|
|
109
|
+
this.data = data;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Create a new Image based on the properties of an existing one.
|
|
114
|
+
* @param other - Reference image.
|
|
115
|
+
* @param options - Image options.
|
|
116
|
+
* @returns New image.
|
|
117
|
+
*/
|
|
118
|
+
static createFrom(other, options = {}) {
|
|
119
|
+
const { width = other.width, height = other.height } = options;
|
|
120
|
+
let bitDepth;
|
|
121
|
+
if (other instanceof Image) {
|
|
122
|
+
bitDepth = other.bitDepth;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
bitDepth = 8;
|
|
126
|
+
}
|
|
127
|
+
return new Image(width, height, {
|
|
128
|
+
bitDepth,
|
|
129
|
+
colorModel: other.colorModel,
|
|
130
|
+
origin: other.origin,
|
|
131
|
+
...options,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Get all the channels of a pixel.
|
|
136
|
+
* @param column - Column index.
|
|
137
|
+
* @param row - Row index.
|
|
138
|
+
* @returns Channels of the pixel.
|
|
139
|
+
*/
|
|
140
|
+
getPixel(column, row) {
|
|
141
|
+
const result = [];
|
|
142
|
+
const start = (row * this.width + column) * this.channels;
|
|
143
|
+
for (let i = 0; i < this.channels; i++) {
|
|
144
|
+
result.push(this.data[start + i]);
|
|
145
|
+
}
|
|
146
|
+
return result;
|
|
147
|
+
}
|
|
148
|
+
getColumn(column) {
|
|
149
|
+
const columnValues = [];
|
|
150
|
+
for (let i = 0; i < this.channels; i++) {
|
|
151
|
+
const channelValues = [];
|
|
152
|
+
for (let j = 0; j < this.height; j++) {
|
|
153
|
+
channelValues.push(this.getValue(column, j, i));
|
|
154
|
+
}
|
|
155
|
+
columnValues.push(channelValues);
|
|
156
|
+
}
|
|
157
|
+
return columnValues;
|
|
158
|
+
}
|
|
159
|
+
getRow(row) {
|
|
160
|
+
const rowValues = [];
|
|
161
|
+
for (let i = 0; i < this.channels; i++) {
|
|
162
|
+
const channelValues = [];
|
|
163
|
+
for (let j = 0; j < this.width; j++) {
|
|
164
|
+
channelValues.push(this.getValue(j, row, i));
|
|
165
|
+
}
|
|
166
|
+
rowValues.push(channelValues);
|
|
167
|
+
}
|
|
168
|
+
return rowValues;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Set all the channels of a pixel.
|
|
172
|
+
* @param column - Column index.
|
|
173
|
+
* @param row - Row index.
|
|
174
|
+
* @param value - New color of the pixel to set.
|
|
175
|
+
*/
|
|
176
|
+
setPixel(column, row, value) {
|
|
177
|
+
const start = (row * this.width + column) * this.channels;
|
|
178
|
+
for (let i = 0; i < this.channels; i++) {
|
|
179
|
+
this.data[start + i] = value[i];
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Set all the channels of a pixel if the coordinates are inside the image.
|
|
184
|
+
* @param column - Column index.
|
|
185
|
+
* @param row - Row index.
|
|
186
|
+
* @param value - New color of the pixel to set.
|
|
187
|
+
*/
|
|
188
|
+
setVisiblePixel(column, row, value) {
|
|
189
|
+
if (column >= 0 && column < this.width && row >= 0 && row < this.height) {
|
|
190
|
+
this.setPixel(column, row, value);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Get all the channels of a pixel using its index.
|
|
195
|
+
* @param index - Index of the pixel.
|
|
196
|
+
* @returns Channels of the pixel.
|
|
197
|
+
*/
|
|
198
|
+
getPixelByIndex(index) {
|
|
199
|
+
const result = [];
|
|
200
|
+
const start = index * this.channels;
|
|
201
|
+
for (let i = 0; i < this.channels; i++) {
|
|
202
|
+
result.push(this.data[start + i]);
|
|
203
|
+
}
|
|
204
|
+
return result;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Set all the channels of a pixel using its index.
|
|
208
|
+
* @param index - Index of the pixel.
|
|
209
|
+
* @param value - New channel values of the pixel to set.
|
|
210
|
+
*/
|
|
211
|
+
setPixelByIndex(index, value) {
|
|
212
|
+
const start = index * this.channels;
|
|
213
|
+
for (let i = 0; i < this.channels; i++) {
|
|
214
|
+
this.data[start + i] = value[i];
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Get the value of a specific pixel channel. Select pixel using coordinates.
|
|
219
|
+
* @param column - Column index.
|
|
220
|
+
* @param row - Row index.
|
|
221
|
+
* @param channel - Channel index.
|
|
222
|
+
* @returns Value of the specified channel of one pixel.
|
|
223
|
+
*/
|
|
224
|
+
getValue(column, row, channel) {
|
|
225
|
+
return this.data[(row * this.width + column) * this.channels + channel];
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Set the value of a specific pixel channel. Select pixel using coordinates.
|
|
229
|
+
* @param column - Column index.
|
|
230
|
+
* @param row - Row index.
|
|
231
|
+
* @param channel - Channel index.
|
|
232
|
+
* @param value - Value to set.
|
|
233
|
+
*/
|
|
234
|
+
setValue(column, row, channel, value) {
|
|
235
|
+
this.data[(row * this.width + column) * this.channels + channel] = value;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Set the value of a specific pixel channel. Select pixel using coordinates.
|
|
239
|
+
* If the value is out of range it is set to the closest extremety.
|
|
240
|
+
* @param column - Column index.
|
|
241
|
+
* @param row - Row index.
|
|
242
|
+
* @param channel - Channel index.
|
|
243
|
+
* @param value - Value to set.
|
|
244
|
+
*/
|
|
245
|
+
setClampedValue(column, row, channel, value) {
|
|
246
|
+
if (value < 0)
|
|
247
|
+
value = 0;
|
|
248
|
+
else if (value > this.maxValue)
|
|
249
|
+
value = this.maxValue;
|
|
250
|
+
this.data[(row * this.width + column) * this.channels + channel] = value;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Get the value of a specific pixel channel. Select pixel using index.
|
|
254
|
+
* @param index - Index of the pixel.
|
|
255
|
+
* @param channel - Channel index.
|
|
256
|
+
* @returns Value of the channel of the pixel.
|
|
257
|
+
*/
|
|
258
|
+
getValueByIndex(index, channel) {
|
|
259
|
+
return this.data[index * this.channels + channel];
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Set the value of a specific pixel channel. Select pixel using index.
|
|
263
|
+
* @param index - Index of the pixel.
|
|
264
|
+
* @param channel - Channel index.
|
|
265
|
+
* @param value - Value to set.
|
|
266
|
+
*/
|
|
267
|
+
setValueByIndex(index, channel, value) {
|
|
268
|
+
this.data[index * this.channels + channel] = value;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Set the value of a specific pixel channel. Select pixel using index.
|
|
272
|
+
* If the value is out of range it is set to the closest extremety.
|
|
273
|
+
* @param index - Index of the pixel.
|
|
274
|
+
* @param channel - Channel index.
|
|
275
|
+
* @param value - Value to set.
|
|
276
|
+
*/
|
|
277
|
+
setClampedValueByIndex(index, channel, value) {
|
|
278
|
+
if (value < 0)
|
|
279
|
+
value = 0;
|
|
280
|
+
else if (value > this.maxValue)
|
|
281
|
+
value = this.maxValue;
|
|
282
|
+
this.data[index * this.channels + channel] = value;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Get the value of a specific pixel channel. Select pixel using a point.
|
|
286
|
+
* @param point - Coordinates of the desired pixel.
|
|
287
|
+
* @param channel - Channel index.
|
|
288
|
+
* @returns Value of the channel of the pixel.
|
|
289
|
+
*/
|
|
290
|
+
getValueByPoint(point, channel) {
|
|
291
|
+
return this.getValue(point.column, point.row, channel);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Set the value of a specific pixel channel. Select pixel using a point.
|
|
295
|
+
* @param point - Coordinates of the pixel.
|
|
296
|
+
* @param channel - Channel index.
|
|
297
|
+
* @param value - Value to set.
|
|
298
|
+
*/
|
|
299
|
+
setValueByPoint(point, channel, value) {
|
|
300
|
+
this.setValue(point.column, point.row, channel, value);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Find the min and max values of each channel of the image.
|
|
304
|
+
* @returns An object with arrays of the min and max values.
|
|
305
|
+
*/
|
|
306
|
+
minMax() {
|
|
307
|
+
return getMinMax(this);
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Return the raw image data.
|
|
311
|
+
* @returns The raw data.
|
|
312
|
+
*/
|
|
313
|
+
getRawImage() {
|
|
314
|
+
return {
|
|
315
|
+
width: this.width,
|
|
316
|
+
height: this.height,
|
|
317
|
+
data: this.data,
|
|
318
|
+
channels: this.channels,
|
|
319
|
+
bitDepth: this.bitDepth,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
[Symbol.for('nodejs.util.inspect.custom')]() {
|
|
323
|
+
let dataString;
|
|
324
|
+
if (this.height > 20 || this.width > 20) {
|
|
325
|
+
dataString = '[...]';
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
dataString = printData(this);
|
|
329
|
+
}
|
|
156
330
|
return `Image {
|
|
157
331
|
width: ${this.width}
|
|
158
332
|
height: ${this.height}
|
|
159
|
-
|
|
160
|
-
|
|
333
|
+
bitDepth: ${this.bitDepth}
|
|
334
|
+
colorModel: ${this.colorModel}
|
|
161
335
|
channels: ${this.channels}
|
|
162
|
-
data: ${
|
|
163
|
-
}`;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Fill the image with a value or a color
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
return
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
return
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}
|
|
336
|
+
data: ${dataString}
|
|
337
|
+
}`;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Fill the image with a value or a color.
|
|
341
|
+
* @param value - Value or color.
|
|
342
|
+
* @returns The image instance.
|
|
343
|
+
*/
|
|
344
|
+
fill(value) {
|
|
345
|
+
if (typeof value === 'number') {
|
|
346
|
+
validateValue(value, this);
|
|
347
|
+
this.data.fill(value);
|
|
348
|
+
return this;
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
if (value.length !== this.channels) {
|
|
352
|
+
throw new RangeError(`the size of value must match the number of channels (${this.channels}). Received ${value.length}`);
|
|
353
|
+
}
|
|
354
|
+
for (const val of value)
|
|
355
|
+
validateValue(val, this);
|
|
356
|
+
for (let i = 0; i < this.data.length; i += this.channels) {
|
|
357
|
+
for (let j = 0; j <= this.channels; j++) {
|
|
358
|
+
this.data[i + j] = value[j];
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
return this;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Fill one channel with a value.
|
|
366
|
+
* @param channel - The channel to fill.
|
|
367
|
+
* @param value - The new value.
|
|
368
|
+
* @returns The image instance.
|
|
369
|
+
*/
|
|
370
|
+
fillChannel(channel, value) {
|
|
371
|
+
validateChannel(channel, this);
|
|
372
|
+
validateValue(value, this);
|
|
373
|
+
for (let i = channel; i < this.data.length; i += this.channels) {
|
|
374
|
+
this.data[i] = value;
|
|
375
|
+
}
|
|
376
|
+
return this;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Get one channel of the image as an array.
|
|
380
|
+
* @param channel - The channel to fill.
|
|
381
|
+
* @returns Array with the channel values.
|
|
382
|
+
*/
|
|
383
|
+
getChannel(channel) {
|
|
384
|
+
validateChannel(channel, this);
|
|
385
|
+
const result = new Array(this.size);
|
|
386
|
+
for (let i = 0; i < this.size; i++) {
|
|
387
|
+
result[i] = this.data[channel + i * this.channels];
|
|
388
|
+
}
|
|
389
|
+
return result;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Fill the alpha channel with the specified value.
|
|
393
|
+
* @param value - New channel value.
|
|
394
|
+
* @returns The image instance.
|
|
395
|
+
*/
|
|
396
|
+
fillAlpha(value) {
|
|
397
|
+
validateValue(value, this);
|
|
398
|
+
if (!this.alpha) {
|
|
399
|
+
throw new TypeError('fillAlpha can only be called if the image has an alpha channel');
|
|
400
|
+
}
|
|
401
|
+
const alphaIndex = this.channels - 1;
|
|
402
|
+
return this.fillChannel(alphaIndex, value);
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Create a copy of this image.
|
|
406
|
+
* @returns The image clone.
|
|
407
|
+
*/
|
|
408
|
+
clone() {
|
|
409
|
+
return Image.createFrom(this, { data: this.data.slice() });
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Modify all the values of the image using the given callback.
|
|
413
|
+
* @param cb - Callback that modifies a given value.
|
|
414
|
+
*/
|
|
415
|
+
changeEach(cb) {
|
|
416
|
+
for (let i = 0; i < this.data.length; i++) {
|
|
417
|
+
this.data[i] = cb(this.data[i]);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Get the coordinates of a point in the image. The reference is the top-left corner.
|
|
422
|
+
* @param coordinates - The point for which you want the coordinates.
|
|
423
|
+
* @param round - Whether the coordinates should be rounded. This is useful when you want the center of the image.
|
|
424
|
+
* @returns Coordinates of the point in the format [column, row].
|
|
425
|
+
*/
|
|
426
|
+
getCoordinates(coordinates, round = false) {
|
|
427
|
+
return match(coordinates)
|
|
428
|
+
.with('center', () => {
|
|
429
|
+
const centerX = (this.width - 1) / 2;
|
|
430
|
+
const centerY = (this.height - 1) / 2;
|
|
431
|
+
if (round) {
|
|
432
|
+
return { column: Math.round(centerX), row: Math.round(centerY) };
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
return { column: centerX, row: centerY };
|
|
436
|
+
}
|
|
437
|
+
})
|
|
438
|
+
.with('top-left', () => ({ column: 0, row: 0 }))
|
|
439
|
+
.with('top-right', () => ({ column: this.width - 1, row: 0 }))
|
|
440
|
+
.with('bottom-left', () => ({ column: 0, row: this.height - 1 }))
|
|
441
|
+
.with('bottom-right', () => ({
|
|
442
|
+
column: this.width - 1,
|
|
443
|
+
row: this.height - 1,
|
|
444
|
+
}))
|
|
445
|
+
.exhaustive();
|
|
446
|
+
}
|
|
447
|
+
// COMPARE
|
|
448
|
+
/**
|
|
449
|
+
* Subtract other from an image.
|
|
450
|
+
* @param other - Image to subtract.
|
|
451
|
+
* @param options - Inversion options.
|
|
452
|
+
* @returns The subtracted image.
|
|
453
|
+
*/
|
|
454
|
+
subtract(other, options = {}) {
|
|
455
|
+
return subtract(this, other, options);
|
|
456
|
+
}
|
|
457
|
+
add(other) {
|
|
458
|
+
return add(this, other);
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Multiply image pixels by a constant.
|
|
462
|
+
* @param value - Value which pixels will be multiplied to.
|
|
463
|
+
* @param options - Multiply options.
|
|
464
|
+
* @returns Multiplied image.
|
|
465
|
+
*/
|
|
466
|
+
multiply(value, options = {}) {
|
|
467
|
+
return multiply(this, value, options);
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Divide image pixels by a constant.
|
|
471
|
+
* @param value - Value which pixels will be divided to.
|
|
472
|
+
* @param options - Divide options.
|
|
473
|
+
* @returns Divided image.
|
|
474
|
+
*/
|
|
475
|
+
divide(value, options = {}) {
|
|
476
|
+
return divide(this, value, options);
|
|
477
|
+
}
|
|
478
|
+
// COMPUTE
|
|
479
|
+
histogram(options) {
|
|
480
|
+
return histogram(this, options);
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Compute the mean pixel of an image.
|
|
484
|
+
* @param options - Mean options.
|
|
485
|
+
* @returns The mean pixel.
|
|
486
|
+
*/
|
|
487
|
+
mean(options) {
|
|
488
|
+
return mean(this, options);
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Compute the median pixel of an image.
|
|
492
|
+
* @param options - Median options.
|
|
493
|
+
* @returns The median pixel.
|
|
494
|
+
*/
|
|
495
|
+
median(options) {
|
|
496
|
+
return median(this, options);
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Compute the variance of each channel of an image.
|
|
500
|
+
* @param options - Variance options.
|
|
501
|
+
* @returns The variance of the channels of the image.
|
|
502
|
+
*/
|
|
503
|
+
variance(options) {
|
|
504
|
+
return variance(this, options);
|
|
505
|
+
}
|
|
506
|
+
// DRAW
|
|
507
|
+
/**
|
|
508
|
+
* Draw a set of points on an image.
|
|
509
|
+
* @param points - Array of points.
|
|
510
|
+
* @param options - Draw points on Image options.
|
|
511
|
+
* @returns New mask.
|
|
512
|
+
*/
|
|
513
|
+
drawPoints(points, options = {}) {
|
|
514
|
+
return drawPoints(this, points, options);
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Draw a line defined by two points onto an image.
|
|
518
|
+
* @param from - Line starting point.
|
|
519
|
+
* @param to - Line ending point.
|
|
520
|
+
* @param options - Draw Line options.
|
|
521
|
+
* @returns The mask with the line drawing.
|
|
522
|
+
*/
|
|
523
|
+
drawLine(from, to, options = {}) {
|
|
524
|
+
return drawLineOnImage(this, from, to, options);
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Draw a rectangle defined by position of the top-left corner, width and height.
|
|
528
|
+
* @param options - Draw rectangle options.
|
|
529
|
+
* @returns The image with the rectangle drawing.
|
|
530
|
+
*/
|
|
531
|
+
drawRectangle(options = {}) {
|
|
532
|
+
return drawRectangle(this, options);
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Draw a polyline defined by an array of points on an image.
|
|
536
|
+
* @param points - Polyline array of points.
|
|
537
|
+
* @param options - Draw polyline options.
|
|
538
|
+
* @returns The image with the polyline drawing.
|
|
539
|
+
*/
|
|
540
|
+
drawPolyline(points, options = {}) {
|
|
541
|
+
return drawPolylineOnImage(this, points, options);
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Draw a polygon defined by an array of points onto an image.
|
|
545
|
+
* @param points - Polygon vertices.
|
|
546
|
+
* @param options - Draw Line options.
|
|
547
|
+
* @returns The image with the polygon drawing.
|
|
548
|
+
*/
|
|
549
|
+
drawPolygon(points, options = {}) {
|
|
550
|
+
return drawPolygonOnImage(this, points, options);
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Draw a circle defined by center and radius onto an image.
|
|
554
|
+
* @param center - Circle center.
|
|
555
|
+
* @param radius - Circle radius.
|
|
556
|
+
* @param options - Draw circle options.
|
|
557
|
+
* @returns The image with the circle drawing.
|
|
558
|
+
*/
|
|
559
|
+
drawCircle(center, radius, options = {}) {
|
|
560
|
+
return drawCircleOnImage(this, center, radius, options);
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Draw a marker on the image.
|
|
564
|
+
* @param point - Marker center point.
|
|
565
|
+
* @param options - Draw marker options.
|
|
566
|
+
* @returns The image with the marker drawing.
|
|
567
|
+
*/
|
|
568
|
+
drawMarker(point, options = {}) {
|
|
569
|
+
return drawMarker(this, point, options);
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Draw markers on the image.
|
|
573
|
+
* @param points - Markers center points.
|
|
574
|
+
* @param options - Draw marker options.
|
|
575
|
+
* @returns The image with the markers drawing.
|
|
576
|
+
*/
|
|
577
|
+
drawMarkers(points, options = {}) {
|
|
578
|
+
return drawMarkers(this, points, options);
|
|
579
|
+
}
|
|
580
|
+
// OPERATIONS
|
|
581
|
+
split() {
|
|
582
|
+
return split(this);
|
|
583
|
+
}
|
|
584
|
+
convertColor(colorModel, options) {
|
|
585
|
+
return convertColor(this, colorModel, options);
|
|
586
|
+
}
|
|
587
|
+
convertBitDepth(newDepth, options) {
|
|
588
|
+
return convertBitDepth(this, newDepth, options);
|
|
589
|
+
}
|
|
590
|
+
grey(options) {
|
|
591
|
+
return grey(this, options);
|
|
592
|
+
}
|
|
593
|
+
copyTo(target, options = {}) {
|
|
594
|
+
return copyTo(this, target, options);
|
|
595
|
+
}
|
|
596
|
+
threshold(options = {}) {
|
|
597
|
+
return threshold(this, options);
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Crop the input image to a desired size.
|
|
601
|
+
* @param [options] - Crop options.
|
|
602
|
+
* @returns The new cropped image.
|
|
603
|
+
*/
|
|
604
|
+
crop(options) {
|
|
605
|
+
return crop(this, options);
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Crop an oriented rectangle from the image.
|
|
609
|
+
* If the rectangle's length or width are not an integers, its dimension is expanded in both directions such as the length and width are integers.
|
|
610
|
+
* @param points - The points of the rectangle. Points must be circling around the rectangle (clockwise or anti-clockwise)
|
|
611
|
+
* @param options - Crop options, see {@link CropRectangleOptions}
|
|
612
|
+
* @returns The cropped image. The orientation of the image is the one closest to the rectangle passed as input.
|
|
613
|
+
*/
|
|
614
|
+
cropRectangle(points, options) {
|
|
615
|
+
return cropRectangle(this, points, options);
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Crops the image based on the alpha channel
|
|
619
|
+
* This removes lines and columns where the alpha channel is lower than a threshold value.
|
|
620
|
+
* @param options - Crop alpha options.
|
|
621
|
+
* @returns The cropped image.
|
|
622
|
+
*/
|
|
623
|
+
cropAlpha(options = {}) {
|
|
624
|
+
return cropAlpha(this, options);
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Extract the pixels of an image, as specified in a mask.
|
|
628
|
+
* @param mask - The mask defining which pixels to keep.
|
|
629
|
+
* @param options - Extract options.
|
|
630
|
+
* @returns The extracted image.
|
|
631
|
+
*/
|
|
632
|
+
extract(mask, options) {
|
|
633
|
+
return extract(this, mask, options);
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Paint a mask onto an image and the given position and with the given color.
|
|
637
|
+
* @param mask - Mask to paint on the image.
|
|
638
|
+
* @param options - Paint mask options.
|
|
639
|
+
* @returns The painted image.
|
|
640
|
+
*/
|
|
641
|
+
paintMask(mask, options) {
|
|
642
|
+
return paintMaskOnImage(this, mask, options);
|
|
643
|
+
}
|
|
644
|
+
// FILTERS
|
|
645
|
+
blur(options) {
|
|
646
|
+
return blur(this, options);
|
|
647
|
+
}
|
|
648
|
+
pixelate(options) {
|
|
649
|
+
return pixelate(this, options);
|
|
650
|
+
}
|
|
651
|
+
directConvolution(kernel, options) {
|
|
652
|
+
return directConvolution(this, kernel, options);
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Compute direct convolution of an image and return an array with the raw values.
|
|
656
|
+
* @param kernel - Kernel used for the convolution.
|
|
657
|
+
* @param options - Convolution options.
|
|
658
|
+
* @returns Array with the raw convoluted values.
|
|
659
|
+
*/
|
|
660
|
+
rawDirectConvolution(kernel, options) {
|
|
661
|
+
return rawDirectConvolution(this, kernel, options);
|
|
662
|
+
}
|
|
663
|
+
separableConvolution(kernelX, kernelY, options) {
|
|
664
|
+
return separableConvolution(this, kernelX, kernelY, options);
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Apply a gaussian filter to an image.
|
|
668
|
+
* @param options - Gaussian blur options.
|
|
669
|
+
* @returns The blurred image.
|
|
670
|
+
*/
|
|
671
|
+
gaussianBlur(options) {
|
|
672
|
+
return gaussianBlur(this, options);
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Flip the image.
|
|
676
|
+
* @param options - Flip options.
|
|
677
|
+
* @returns The flipped image.
|
|
678
|
+
*/
|
|
679
|
+
flip(options) {
|
|
680
|
+
return flip(this, options);
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Invert the colors of the image.
|
|
684
|
+
* @param options - Inversion options.
|
|
685
|
+
* @returns The inverted image.
|
|
686
|
+
*/
|
|
687
|
+
invert(options) {
|
|
688
|
+
return invert(this, options);
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Calculate a new image that is the hypotenuse between the current image and the other.
|
|
692
|
+
* @param other - Other image.
|
|
693
|
+
* @param options - Hypotenuse options.
|
|
694
|
+
* @returns Hypotenuse of the two images.
|
|
695
|
+
*/
|
|
696
|
+
hypotenuse(other, options) {
|
|
697
|
+
return hypotenuse(this, other, options);
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Apply a gradient filter to an image.
|
|
701
|
+
* @param options - Gradient filter options.
|
|
702
|
+
* @returns The gradient image.
|
|
703
|
+
*/
|
|
704
|
+
gradientFilter(options) {
|
|
705
|
+
return gradientFilter(this, options);
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Apply a derivative filter to an image.
|
|
709
|
+
* @param options - Derivative filter options.
|
|
710
|
+
* @returns The processed image.
|
|
711
|
+
*/
|
|
712
|
+
derivativeFilter(options) {
|
|
713
|
+
return derivativeFilter(this, options);
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Level the image using the optional input and output value. This function allows you to enhance the image's contrast.
|
|
717
|
+
* @param options - Level options.
|
|
718
|
+
* @returns The levelled image.
|
|
719
|
+
*/
|
|
720
|
+
level(options) {
|
|
721
|
+
return level(this, options);
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Increase the contrast of an image by spanning each channel on the range [0, image.maxValue].
|
|
725
|
+
* @param options - Increase contrast options.
|
|
726
|
+
* @returns The enhanced image.
|
|
727
|
+
*/
|
|
728
|
+
increaseContrast(options = {}) {
|
|
729
|
+
return increaseContrast(this, options);
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Correct the colors in an image using the reference colors.
|
|
733
|
+
* @param measuredColors - Colors from the image, which will be compared to the reference.
|
|
734
|
+
* @param referenceColors - Reference colors.
|
|
735
|
+
* @returns Image with the colors corrected.
|
|
736
|
+
*/
|
|
737
|
+
correctColor(measuredColors, referenceColors) {
|
|
738
|
+
return correctColor(this, measuredColors, referenceColors);
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Apply a median filter to the image.
|
|
742
|
+
* @param options - Options to apply for median filter.
|
|
743
|
+
* @returns Image after median filter.
|
|
744
|
+
*/
|
|
745
|
+
medianFilter(options) {
|
|
746
|
+
return medianFilter(this, options);
|
|
747
|
+
}
|
|
748
|
+
// GEOMETRY
|
|
749
|
+
resize(options) {
|
|
750
|
+
return resize(this, options);
|
|
751
|
+
}
|
|
752
|
+
rotate(angle) {
|
|
753
|
+
return rotate(this, angle);
|
|
754
|
+
}
|
|
755
|
+
transform(transformMatrix, options) {
|
|
756
|
+
return transform(this, transformMatrix, options);
|
|
757
|
+
}
|
|
758
|
+
transformRotate(angle, options) {
|
|
759
|
+
return transformRotate(this, angle, options);
|
|
760
|
+
}
|
|
761
|
+
// MORPHOLOGY
|
|
762
|
+
/**
|
|
763
|
+
* Erode an image.
|
|
764
|
+
* @param options - Erode options.
|
|
765
|
+
* @returns The eroded image.
|
|
766
|
+
*/
|
|
767
|
+
erode(options) {
|
|
768
|
+
return erode(this, options);
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Dilate an image.
|
|
772
|
+
* @param options - Dilate options.
|
|
773
|
+
* @returns The dilated image.
|
|
774
|
+
*/
|
|
775
|
+
dilate(options) {
|
|
776
|
+
return dilate(this, options);
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* Open an image.
|
|
780
|
+
* @param options - Open options.
|
|
781
|
+
* @returns The opened image.
|
|
782
|
+
*/
|
|
783
|
+
open(options) {
|
|
784
|
+
return open(this, options);
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Close an image.
|
|
788
|
+
* @param options - Close options.
|
|
789
|
+
* @returns The closed image.
|
|
790
|
+
*/
|
|
791
|
+
close(options) {
|
|
792
|
+
return close(this, options);
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Top hat of an image.
|
|
796
|
+
* @param options - Top hat options.
|
|
797
|
+
* @returns The top-hatted image.
|
|
798
|
+
*/
|
|
799
|
+
topHat(options) {
|
|
800
|
+
return topHat(this, options);
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Bottom hat of an image.
|
|
804
|
+
* @param options - Bottom hat options.
|
|
805
|
+
* @returns The bottom-hatted image.
|
|
806
|
+
*/
|
|
807
|
+
bottomHat(options) {
|
|
808
|
+
return bottomHat(this, options);
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Apply morphological gradient to an image.
|
|
812
|
+
* @param options - Morphological gradient options.
|
|
813
|
+
* @returns The processed image.
|
|
814
|
+
*/
|
|
815
|
+
morphologicalGradient(options) {
|
|
816
|
+
return morphologicalGradient(this, options);
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* Apply Canny edge detection to an image.
|
|
820
|
+
* @param options - Canny edge detection options.
|
|
821
|
+
* @returns The processed image.
|
|
822
|
+
*/
|
|
823
|
+
cannyEdgeDetector(options) {
|
|
824
|
+
return cannyEdgeDetector(this, options);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* Create data array and set alpha channel to max value if applicable.
|
|
829
|
+
* @param size - Number of pixels.
|
|
830
|
+
* @param channels - Number of channels.
|
|
831
|
+
* @param alpha - Specify if there is alpha channel.
|
|
832
|
+
* @param bitDepth - Number of bits per channel.
|
|
833
|
+
* @param maxValue - Maximal acceptable value for the channels.
|
|
834
|
+
* @returns The new pixel array.
|
|
835
|
+
*/
|
|
836
|
+
function createPixelArray(size, channels, alpha, bitDepth, maxValue) {
|
|
837
|
+
const length = channels * size;
|
|
838
|
+
const arr = match(bitDepth)
|
|
839
|
+
.with(8, () => new Uint8Array(length))
|
|
840
|
+
.with(16, () => new Uint16Array(length))
|
|
841
|
+
.otherwise(() => {
|
|
842
|
+
throw new RangeError(`invalid bitDepth: ${bitDepth}`);
|
|
843
|
+
});
|
|
844
|
+
// Alpha channel is 100% by default.
|
|
845
|
+
if (alpha) {
|
|
846
|
+
for (let i = channels - 1; i < length; i += channels) {
|
|
847
|
+
arr[i] = maxValue;
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
return arr;
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Returns the image data as a formatted string.
|
|
854
|
+
* @param img - The image instance.
|
|
855
|
+
* @returns Formatted string containing the image data.
|
|
856
|
+
*/
|
|
857
|
+
function printData(img) {
|
|
858
|
+
const result = [];
|
|
859
|
+
const padding = img.bitDepth === 8 ? 3 : 5;
|
|
860
|
+
for (let row = 0; row < img.height; row++) {
|
|
861
|
+
const currentRow = [];
|
|
862
|
+
for (let column = 0; column < img.width; column++) {
|
|
863
|
+
for (let channel = 0; channel < img.channels; channel++) {
|
|
864
|
+
currentRow.push(String(img.getValue(column, row, channel)).padStart(padding, ' '));
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
result.push(`[${currentRow.join(' ')}]`);
|
|
868
|
+
}
|
|
324
869
|
return `{
|
|
325
|
-
${
|
|
326
|
-
}`;
|
|
327
|
-
}
|
|
328
|
-
function printChannel(img, c) {
|
|
329
|
-
const result = [];
|
|
330
|
-
const padding = img.depth === 8 ? 3 : 5;
|
|
331
|
-
for (let i = 0; i < img.height; i++) {
|
|
332
|
-
const line = [];
|
|
333
|
-
for (let j = 0; j < img.width; j++) {
|
|
334
|
-
line.push(String(img.getValue(i, j, c)).padStart(padding, ' '));
|
|
335
|
-
}
|
|
336
|
-
result.push(`[${line.join(' ')}]`);
|
|
337
|
-
}
|
|
338
|
-
return result.join('\n ');
|
|
339
|
-
}
|
|
870
|
+
[\n ${result.join('\n ')}\n ]
|
|
871
|
+
}`;
|
|
872
|
+
}
|
|
340
873
|
//# sourceMappingURL=Image.js.map
|