image-js 1.0.0-alpha.2 → 1.0.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 +33179 -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 +33324 -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 +4260 -0
- package/lib/Image.d.ts +447 -71
- package/lib/Image.d.ts.map +1 -1
- package/lib/Image.js +751 -127
- 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 +12 -4
- package/lib/compute/histogram.d.ts.map +1 -1
- package/lib/compute/histogram.js +17 -11
- 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 +43 -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 +25 -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 +11 -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 +29 -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 +28 -4
- package/lib/filters/blur.d.ts.map +1 -1
- package/lib/filters/blur.js +16 -8
- package/lib/filters/blur.js.map +1 -1
- package/lib/filters/convolution.d.ts +67 -6
- package/lib/filters/convolution.d.ts.map +1 -1
- package/lib/filters/convolution.js +124 -81
- 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 +44 -9
- package/lib/filters/gaussianBlur.d.ts.map +1 -1
- package/lib/filters/gaussianBlur.js +28 -23
- 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 +9 -8
- package/lib/filters/invert.d.ts.map +1 -1
- package/lib/filters/invert.js +26 -11
- 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 -1
- package/lib/geometry/index.d.ts.map +1 -1
- package/lib/geometry/index.js +5 -6
- package/lib/geometry/index.js.map +1 -1
- package/lib/geometry/resize.d.ts +49 -0
- package/lib/geometry/resize.d.ts.map +1 -0
- package/lib/geometry/resize.js +87 -0
- package/lib/geometry/resize.js.map +1 -0
- package/lib/geometry/rotate.d.ts +10 -0
- package/lib/geometry/rotate.d.ts.map +1 -0
- package/lib/geometry/rotate.js +47 -0
- package/lib/geometry/rotate.js.map +1 -0
- package/lib/geometry/transform.d.ts +39 -6
- package/lib/geometry/transform.d.ts.map +1 -1
- package/lib/geometry/transform.js +90 -36
- 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 +4 -3
- package/lib/load/decode.d.ts.map +1 -1
- package/lib/load/decode.js +17 -23
- package/lib/load/decode.js.map +1 -1
- package/lib/load/decodeJpeg.d.ts +3 -2
- package/lib/load/decodeJpeg.d.ts.map +1 -1
- package/lib/load/decodeJpeg.js +20 -10
- package/lib/load/decodeJpeg.js.map +1 -1
- package/lib/load/decodePng.d.ts +4 -3
- package/lib/load/decodePng.d.ts.map +1 -1
- package/lib/load/decodePng.js +30 -30
- 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 +57 -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 +9 -4
- package/lib/load/read.d.ts.map +1 -1
- package/lib/load/read.js +15 -14
- package/lib/load/read.js.map +1 -1
- package/lib/load/readCanvas.d.ts +6 -1
- package/lib/load/readCanvas.d.ts.map +1 -1
- package/lib/load/readCanvas.js +11 -12
- 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 +11 -10
- 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 +20 -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 +44 -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 +33 -3
- package/lib/operations/convertColor.d.ts.map +1 -1
- package/lib/operations/convertColor.js +114 -46
- 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 -4
- package/lib/operations/index.d.ts.map +1 -1
- package/lib/operations/index.js +16 -9
- package/lib/operations/index.js.map +1 -1
- package/lib/operations/merge.d.ts +8 -0
- package/lib/operations/merge.d.ts.map +1 -0
- package/lib/operations/merge.js +51 -0
- package/lib/operations/merge.js.map +1 -0
- 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 +6 -1
- package/lib/operations/split.d.ts.map +1 -1
- package/lib/operations/split.js +12 -8
- package/lib/operations/split.js.map +1 -1
- package/lib/operations/threshold.d.ts +55 -13
- package/lib/operations/threshold.d.ts.map +1 -1
- package/lib/operations/threshold.js +79 -45
- 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 +7 -4
- 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 +7 -5
- 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 +24 -28
- package/lib/save/encode.d.ts.map +1 -1
- package/lib/save/encode.js +23 -23
- 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 +22 -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 +14 -3
- package/lib/save/encodeJpeg.d.ts.map +1 -1
- package/lib/save/encodeJpeg.js +16 -14
- 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 +21 -6
- 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 +45 -6
- package/lib/save/write.d.ts.map +1 -1
- package/lib/save/write.js +58 -35
- package/lib/save/write.js.map +1 -1
- package/lib/save/writeCanvas.d.ts +30 -4
- package/lib/save/writeCanvas.d.ts.map +1 -1
- package/lib/save/writeCanvas.js +21 -14
- 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/decodeStack.d.ts +9 -0
- package/lib/stack/load/decodeStack.d.ts.map +1 -0
- package/lib/stack/load/decodeStack.js +19 -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 -2
- package/lib/utils/clamp.d.ts.map +1 -1
- package/lib/utils/clamp.js +41 -5
- 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 +78 -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 +43 -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 +40 -8
- package/lib/utils/getOutputImage.d.ts.map +1 -1
- package/lib/utils/getOutputImage.js +120 -19
- 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 -2
- package/lib/utils/interpolateBorder.d.ts.map +1 -1
- package/lib/utils/interpolateBorder.js +129 -43
- package/lib/utils/interpolateBorder.js.map +1 -1
- package/lib/utils/interpolatePixel.d.ts +14 -4
- package/lib/utils/interpolatePixel.d.ts.map +1 -1
- package/lib/utils/interpolatePixel.js +117 -22
- package/lib/utils/interpolatePixel.js.map +1 -1
- package/lib/utils/round.d.ts +5 -0
- package/lib/utils/round.d.ts.map +1 -1
- package/lib/utils/round.js +15 -10
- 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 -20
- package/src/Image.ts +978 -163
- 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 +71 -0
- package/src/featureMatching/matching/filterSmallestDistanceMatches.ts +33 -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 +12 -0
- package/src/featureMatching/utils/sortBySourceDest.ts +27 -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 +42 -7
- package/src/filters/convolution.ts +190 -128
- 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 +75 -29
- 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 -1
- package/src/geometry/resize.ts +166 -0
- package/src/geometry/rotate.ts +63 -0
- package/src/geometry/transform.ts +180 -40
- package/src/geometry/transformRotate.ts +65 -0
- package/src/index.ts +24 -8
- package/src/load/decode.ts +18 -16
- package/src/load/decodeJpeg.ts +20 -4
- package/src/load/decodePng.ts +30 -27
- package/src/load/decodeTiff.ts +63 -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 +25 -0
- package/src/maskAnalysis/utils/getMbrFromPoints.ts +112 -0
- package/src/maskAnalysis/utils/monotoneChainConvexHull.ts +65 -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 -4
- package/src/operations/merge.ts +66 -0
- 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 +113 -58
- 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 +24 -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/decodeStack.ts +26 -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 +46 -3
- 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 +102 -0
- package/src/utils/geometry/polygons.ts +32 -0
- package/src/utils/geometry/removeClosePoints.ts +82 -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 +193 -40
- package/src/utils/interpolatePixel.ts +162 -27
- package/src/utils/round.ts +13 -8
- 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 -12
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js +0 -16
- 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 -161
- package/lib-esm/Image.d.ts.map +0 -1
- package/lib-esm/Image.js +0 -246
- 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 -10
- package/lib-esm/filters/blur.d.ts.map +0 -1
- package/lib-esm/filters/blur.js +0 -12
- 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 -114
- package/lib-esm/filters/convolution.js.map +0 -1
- package/lib-esm/filters/gaussianBlur.d.ts +0 -19
- package/lib-esm/filters/gaussianBlur.d.ts.map +0 -1
- package/lib-esm/filters/gaussianBlur.js +0 -46
- 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 -2
- package/lib-esm/geometry/index.d.ts.map +0 -1
- package/lib-esm/geometry/index.js +0 -2
- package/lib-esm/geometry/index.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 -46
- 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 -5
- package/lib-esm/operations/index.d.ts.map +0 -1
- package/lib-esm/operations/index.js +0 -5
- package/lib-esm/operations/index.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 -53
- 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 -12
- package/lib-esm/types.d.ts.map +0 -1
- package/lib-esm/types.js +0 -14
- package/lib-esm/types.js.map +0 -1
- package/lib-esm/utils/clamp.d.ts +0 -3
- package/lib-esm/utils/clamp.d.ts.map +0 -1
- package/lib-esm/utils/clamp.js +0 -4
- 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 -3
- package/lib-esm/utils/interpolateBorder.d.ts.map +0 -1
- package/lib-esm/utils/interpolateBorder.js +0 -48
- package/lib-esm/utils/interpolateBorder.js.map +0 -1
- package/lib-esm/utils/interpolatePixel.d.ts +0 -7
- package/lib-esm/utils/interpolatePixel.d.ts.map +0 -1
- package/lib-esm/utils/interpolatePixel.js +0 -23
- 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 -11
- 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 -12
- package/src/utils/kinds.ts +0 -27
- package/src/utils/validators.ts +0 -23
package/src/Image.ts
CHANGED
|
@@ -1,30 +1,161 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { convertColor, IConvertColorOptions } from './operations/convertColor';
|
|
4
|
-
import { convertDepth } from './operations/convertDepth';
|
|
5
|
-
import { split } from './operations/split';
|
|
6
|
-
import { IHistogramOptions, histogram } from './compute';
|
|
7
|
-
|
|
8
|
-
type ImageDataArray = Uint8Array | Uint16Array;
|
|
9
|
-
|
|
10
|
-
export enum ColorDepth {
|
|
11
|
-
UINT8 = 8,
|
|
12
|
-
UINT16 = 16
|
|
13
|
-
}
|
|
1
|
+
import type { RgbColor } from 'colord';
|
|
2
|
+
import { match } from 'ts-pattern';
|
|
14
3
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
4
|
+
import type { Mask } from './Mask.js';
|
|
5
|
+
import type { DivideOptions } from './compare/divide.js';
|
|
6
|
+
import { divide } from './compare/divide.js';
|
|
7
|
+
import type { SubtractImageOptions } from './compare/index.js';
|
|
8
|
+
import { add, subtract } from './compare/index.js';
|
|
9
|
+
import type { MultiplyOptions } from './compare/multiply.js';
|
|
10
|
+
import { multiply } from './compare/multiply.js';
|
|
11
|
+
import type {
|
|
12
|
+
HistogramOptions,
|
|
13
|
+
MeanOptions,
|
|
14
|
+
MedianOptions,
|
|
15
|
+
VarianceOptions,
|
|
16
|
+
} from './compute/index.js';
|
|
17
|
+
import { histogram, mean, median, variance } from './compute/index.js';
|
|
18
|
+
import { correctColor } from './correctColor/index.js';
|
|
19
|
+
import type {
|
|
20
|
+
DrawCircleOnImageOptions,
|
|
21
|
+
DrawLineOnImageOptions,
|
|
22
|
+
DrawMarkerOptions,
|
|
23
|
+
DrawPointsOptions,
|
|
24
|
+
DrawPolygonOnImageOptions,
|
|
25
|
+
DrawPolylineOnImageOptions,
|
|
26
|
+
DrawRectangleOptions,
|
|
27
|
+
} from './draw/index.js';
|
|
28
|
+
import {
|
|
29
|
+
drawCircleOnImage,
|
|
30
|
+
drawLineOnImage,
|
|
31
|
+
drawMarker,
|
|
32
|
+
drawMarkers,
|
|
33
|
+
drawPoints,
|
|
34
|
+
drawPolygonOnImage,
|
|
35
|
+
drawPolylineOnImage,
|
|
36
|
+
drawRectangle,
|
|
37
|
+
} from './draw/index.js';
|
|
38
|
+
import type {
|
|
39
|
+
BlurOptions,
|
|
40
|
+
ConvolutionOptions,
|
|
41
|
+
DerivativeFilterOptions,
|
|
42
|
+
FlipOptions,
|
|
43
|
+
GaussianBlurOptions,
|
|
44
|
+
GradientFilterOptions,
|
|
45
|
+
HypotenuseOptions,
|
|
46
|
+
IncreaseContrastOptions,
|
|
47
|
+
InvertOptions,
|
|
48
|
+
LevelOptions,
|
|
49
|
+
MedianFilterOptions,
|
|
50
|
+
PixelateOptions,
|
|
51
|
+
} from './filters/index.js';
|
|
52
|
+
import {
|
|
53
|
+
blur,
|
|
54
|
+
derivativeFilter,
|
|
55
|
+
directConvolution,
|
|
56
|
+
flip,
|
|
57
|
+
gaussianBlur,
|
|
58
|
+
gradientFilter,
|
|
59
|
+
hypotenuse,
|
|
60
|
+
increaseContrast,
|
|
61
|
+
invert,
|
|
62
|
+
level,
|
|
63
|
+
medianFilter,
|
|
64
|
+
pixelate,
|
|
65
|
+
rawDirectConvolution,
|
|
66
|
+
separableConvolution,
|
|
67
|
+
} from './filters/index.js';
|
|
68
|
+
import type {
|
|
69
|
+
Point,
|
|
70
|
+
ResizeOptions,
|
|
71
|
+
RotateAngle,
|
|
72
|
+
TransformOptions,
|
|
73
|
+
TransformRotateOptions,
|
|
74
|
+
} from './geometry/index.js';
|
|
75
|
+
import {
|
|
76
|
+
resize,
|
|
77
|
+
rotate,
|
|
78
|
+
transform,
|
|
79
|
+
transformRotate,
|
|
80
|
+
} from './geometry/index.js';
|
|
81
|
+
import type { ImageMetadata } from './load/load.types.js';
|
|
82
|
+
import type {
|
|
83
|
+
BottomHatOptions,
|
|
84
|
+
CannyEdgeOptions,
|
|
85
|
+
CloseOptions,
|
|
86
|
+
DilateOptions,
|
|
87
|
+
ErodeOptions,
|
|
88
|
+
MorphologicalGradientOptions,
|
|
89
|
+
OpenOptions,
|
|
90
|
+
TopHatOptions,
|
|
91
|
+
} from './morphology/index.js';
|
|
92
|
+
import {
|
|
93
|
+
bottomHat,
|
|
94
|
+
cannyEdgeDetector,
|
|
95
|
+
close,
|
|
96
|
+
dilate,
|
|
97
|
+
erode,
|
|
98
|
+
morphologicalGradient,
|
|
99
|
+
open,
|
|
100
|
+
topHat,
|
|
101
|
+
} from './morphology/index.js';
|
|
102
|
+
import type {
|
|
103
|
+
ConvertBitDepthOptions,
|
|
104
|
+
ConvertColorOptions,
|
|
105
|
+
CopyToOptions,
|
|
106
|
+
CropAlphaOptions,
|
|
107
|
+
CropOptions,
|
|
108
|
+
CropRectangleOptions,
|
|
109
|
+
ExtractOptions,
|
|
110
|
+
GreyOptions,
|
|
111
|
+
PaintMaskOnImageOptions,
|
|
112
|
+
ThresholdOptions,
|
|
113
|
+
} from './operations/index.js';
|
|
114
|
+
import {
|
|
115
|
+
convertBitDepth,
|
|
116
|
+
convertColor,
|
|
117
|
+
copyTo,
|
|
118
|
+
crop,
|
|
119
|
+
cropAlpha,
|
|
120
|
+
cropRectangle,
|
|
121
|
+
extract,
|
|
122
|
+
grey,
|
|
123
|
+
paintMaskOnImage,
|
|
124
|
+
split,
|
|
125
|
+
threshold,
|
|
126
|
+
} from './operations/index.js';
|
|
127
|
+
import type { ImageColorModel } from './utils/constants/colorModels.js';
|
|
128
|
+
import { colorModels } from './utils/constants/colorModels.js';
|
|
129
|
+
import { getMinMax } from './utils/getMinMax.js';
|
|
130
|
+
import {
|
|
131
|
+
validateChannel,
|
|
132
|
+
validateValue,
|
|
133
|
+
} from './utils/validators/validators.js';
|
|
134
|
+
|
|
135
|
+
export type ImageDataArray = Uint8Array | Uint16Array | Uint8ClampedArray;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Bit depth of the image (nb of bits that encode each value in the image).
|
|
139
|
+
*/
|
|
140
|
+
export type BitDepth = 1 | 8 | 16;
|
|
141
|
+
|
|
142
|
+
export const ImageCoordinates = {
|
|
143
|
+
CENTER: 'center',
|
|
144
|
+
TOP_LEFT: 'top-left',
|
|
145
|
+
TOP_RIGHT: 'top-right',
|
|
146
|
+
BOTTOM_LEFT: 'bottom-left',
|
|
147
|
+
BOTTOM_RIGHT: 'bottom-right',
|
|
148
|
+
} as const;
|
|
149
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
150
|
+
export type ImageCoordinates =
|
|
151
|
+
(typeof ImageCoordinates)[keyof typeof ImageCoordinates];
|
|
21
152
|
|
|
22
|
-
export interface
|
|
153
|
+
export interface ImageOptions {
|
|
23
154
|
/**
|
|
24
155
|
* Number of bits per value in each channel.
|
|
25
|
-
*
|
|
156
|
+
* @default `8`.
|
|
26
157
|
*/
|
|
27
|
-
|
|
158
|
+
bitDepth?: BitDepth;
|
|
28
159
|
|
|
29
160
|
/**
|
|
30
161
|
* Typed array holding the image data.
|
|
@@ -32,43 +163,27 @@ export interface INewImageOptions {
|
|
|
32
163
|
data?: ImageDataArray;
|
|
33
164
|
|
|
34
165
|
/**
|
|
35
|
-
*
|
|
166
|
+
* Color model of the created image.
|
|
167
|
+
* @default `'RGB'`.
|
|
36
168
|
*/
|
|
37
|
-
|
|
169
|
+
colorModel?: ImageColorModel;
|
|
38
170
|
|
|
39
171
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
172
|
+
* Origin of the image relative to a parent image (top-left corner).
|
|
173
|
+
* @default `{row: 0, column: 0}`
|
|
42
174
|
*/
|
|
43
|
-
|
|
175
|
+
origin?: Point;
|
|
44
176
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
177
|
+
meta?: ImageMetadata;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface CreateFromOptions extends ImageOptions {
|
|
48
181
|
width?: number;
|
|
182
|
+
height?: number;
|
|
49
183
|
}
|
|
50
184
|
|
|
51
185
|
export type ImageValues = [number, number, number, number];
|
|
52
186
|
|
|
53
|
-
const kinds: { [key in ImageKind]: { components: number; alpha: boolean } } = {
|
|
54
|
-
[ImageKind.GREY]: {
|
|
55
|
-
components: 1,
|
|
56
|
-
alpha: false
|
|
57
|
-
},
|
|
58
|
-
[ImageKind.GREYA]: {
|
|
59
|
-
components: 1,
|
|
60
|
-
alpha: true
|
|
61
|
-
},
|
|
62
|
-
[ImageKind.RGB]: {
|
|
63
|
-
components: 3,
|
|
64
|
-
alpha: false
|
|
65
|
-
},
|
|
66
|
-
[ImageKind.RGBA]: {
|
|
67
|
-
components: 3,
|
|
68
|
-
alpha: true
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
187
|
export class Image {
|
|
73
188
|
/**
|
|
74
189
|
* The number of columns of the image.
|
|
@@ -81,23 +196,23 @@ export class Image {
|
|
|
81
196
|
public readonly height: number;
|
|
82
197
|
|
|
83
198
|
/**
|
|
84
|
-
* The total number of pixels in the image (width
|
|
199
|
+
* The total number of pixels in the image (width × height).
|
|
85
200
|
*/
|
|
86
201
|
public readonly size: number;
|
|
87
202
|
|
|
88
203
|
/**
|
|
89
204
|
* The number of bits per value in each channel.
|
|
90
205
|
*/
|
|
91
|
-
public readonly
|
|
206
|
+
public readonly bitDepth: BitDepth;
|
|
92
207
|
|
|
93
208
|
/**
|
|
94
|
-
* The
|
|
209
|
+
* The color model of the image.
|
|
95
210
|
*/
|
|
96
|
-
public readonly
|
|
211
|
+
public readonly colorModel: ImageColorModel;
|
|
97
212
|
|
|
98
213
|
/**
|
|
99
214
|
* The number of color channels in the image, excluding the alpha channel.
|
|
100
|
-
* A
|
|
215
|
+
* A GREY image has 1 component. An RGB image has 3 components.
|
|
101
216
|
*/
|
|
102
217
|
public readonly components: number;
|
|
103
218
|
|
|
@@ -115,88 +230,82 @@ export class Image {
|
|
|
115
230
|
* The maximum value that a pixel channel can have.
|
|
116
231
|
*/
|
|
117
232
|
public readonly maxValue: number;
|
|
118
|
-
|
|
119
233
|
/**
|
|
120
|
-
*
|
|
234
|
+
* Origin of the image relative to a the parent image.
|
|
121
235
|
*/
|
|
122
|
-
public readonly
|
|
236
|
+
public readonly origin: Point;
|
|
237
|
+
|
|
238
|
+
public readonly meta?: ImageMetadata;
|
|
123
239
|
|
|
124
240
|
/**
|
|
125
|
-
*
|
|
126
|
-
* @param width
|
|
127
|
-
* @param height
|
|
128
|
-
* @param options
|
|
241
|
+
* Typed array holding the image data.
|
|
129
242
|
*/
|
|
130
|
-
|
|
243
|
+
private readonly data: ImageDataArray;
|
|
244
|
+
|
|
131
245
|
/**
|
|
132
|
-
* Construct a new
|
|
133
|
-
* @param
|
|
246
|
+
* Construct a new Image knowing its dimensions.
|
|
247
|
+
* @param width - Image width.
|
|
248
|
+
* @param height - Image height.
|
|
249
|
+
* @param options - Image options.
|
|
134
250
|
*/
|
|
135
|
-
public constructor(options?: INewImageOptions);
|
|
136
251
|
public constructor(
|
|
137
|
-
width
|
|
138
|
-
height
|
|
139
|
-
options:
|
|
252
|
+
width: number,
|
|
253
|
+
height: number,
|
|
254
|
+
options: ImageOptions = {},
|
|
140
255
|
) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (height === undefined) {
|
|
151
|
-
height = options.height || 1;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const { depth = ColorDepth.UINT8, data, kind = ImageKind.RGB } = options;
|
|
256
|
+
const {
|
|
257
|
+
bitDepth = 8,
|
|
258
|
+
data,
|
|
259
|
+
colorModel = 'RGB',
|
|
260
|
+
origin = { row: 0, column: 0 },
|
|
261
|
+
meta,
|
|
262
|
+
} = options;
|
|
155
263
|
|
|
156
264
|
if (width < 1 || !Number.isInteger(width)) {
|
|
157
265
|
throw new RangeError(
|
|
158
|
-
`width must be an integer and at least 1. Received ${width}
|
|
266
|
+
`width must be an integer and at least 1. Received ${width}`,
|
|
159
267
|
);
|
|
160
268
|
}
|
|
161
269
|
|
|
162
270
|
if (height < 1 || !Number.isInteger(height)) {
|
|
163
271
|
throw new RangeError(
|
|
164
|
-
`height must be an integer and at least 1. Received ${height}
|
|
272
|
+
`height must be an integer and at least 1. Received ${height}`,
|
|
165
273
|
);
|
|
166
274
|
}
|
|
167
275
|
|
|
168
276
|
this.width = width;
|
|
169
277
|
this.height = height;
|
|
170
278
|
this.size = width * height;
|
|
171
|
-
this.
|
|
172
|
-
this.
|
|
279
|
+
this.bitDepth = bitDepth;
|
|
280
|
+
this.colorModel = colorModel;
|
|
281
|
+
this.origin = origin;
|
|
282
|
+
this.meta = meta;
|
|
173
283
|
|
|
174
|
-
const
|
|
175
|
-
this.components =
|
|
176
|
-
this.
|
|
177
|
-
this.
|
|
284
|
+
const colorModelDef = colorModels[colorModel];
|
|
285
|
+
this.components = colorModelDef.components;
|
|
286
|
+
this.alpha = colorModelDef.alpha;
|
|
287
|
+
this.channels = colorModelDef.channels;
|
|
178
288
|
|
|
179
|
-
|
|
180
|
-
this.maxValue = maxValue;
|
|
289
|
+
this.maxValue = 2 ** bitDepth - 1;
|
|
181
290
|
|
|
182
291
|
if (data === undefined) {
|
|
183
292
|
this.data = createPixelArray(
|
|
184
293
|
this.size,
|
|
185
294
|
this.channels,
|
|
186
295
|
this.alpha,
|
|
187
|
-
this.
|
|
188
|
-
maxValue
|
|
296
|
+
this.bitDepth,
|
|
297
|
+
this.maxValue,
|
|
189
298
|
);
|
|
190
299
|
} else {
|
|
191
|
-
if (
|
|
192
|
-
throw new
|
|
193
|
-
} else if (
|
|
194
|
-
throw new
|
|
300
|
+
if (bitDepth === 8 && data instanceof Uint16Array) {
|
|
301
|
+
throw new RangeError(`bitDepth is ${bitDepth} but data is Uint16Array`);
|
|
302
|
+
} else if (bitDepth === 16 && data instanceof Uint8Array) {
|
|
303
|
+
throw new RangeError(`bitDepth is ${bitDepth} but data is Uint8Array`);
|
|
195
304
|
}
|
|
196
305
|
const expectedLength = this.size * this.channels;
|
|
197
306
|
if (data.length !== expectedLength) {
|
|
198
307
|
throw new RangeError(
|
|
199
|
-
`incorrect data size: ${data.length}. Expected ${expectedLength}
|
|
308
|
+
`incorrect data size: ${data.length}. Expected ${expectedLength}`,
|
|
200
309
|
);
|
|
201
310
|
}
|
|
202
311
|
this.data = data;
|
|
@@ -204,28 +313,101 @@ export class Image {
|
|
|
204
313
|
}
|
|
205
314
|
|
|
206
315
|
/**
|
|
207
|
-
* Create a new
|
|
316
|
+
* Create a new Image based on the properties of an existing one.
|
|
208
317
|
* @param other - Reference image.
|
|
318
|
+
* @param options - Image options.
|
|
319
|
+
* @returns New image.
|
|
209
320
|
*/
|
|
210
|
-
public static createFrom(
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
321
|
+
public static createFrom(
|
|
322
|
+
other: Image | Mask,
|
|
323
|
+
options: CreateFromOptions = {},
|
|
324
|
+
): Image {
|
|
325
|
+
const { width = other.width, height = other.height } = options;
|
|
326
|
+
let bitDepth: BitDepth;
|
|
327
|
+
if (other instanceof Image) {
|
|
328
|
+
bitDepth = other.bitDepth;
|
|
329
|
+
} else {
|
|
330
|
+
bitDepth = 8;
|
|
331
|
+
}
|
|
332
|
+
return new Image(width, height, {
|
|
333
|
+
bitDepth,
|
|
334
|
+
colorModel: other.colorModel,
|
|
335
|
+
origin: other.origin,
|
|
336
|
+
...options,
|
|
217
337
|
});
|
|
218
338
|
}
|
|
219
339
|
|
|
220
340
|
/**
|
|
221
|
-
* Get all the
|
|
222
|
-
* @param
|
|
223
|
-
* @param
|
|
224
|
-
* @returns
|
|
341
|
+
* Get all the channels of a pixel.
|
|
342
|
+
* @param column - Column index.
|
|
343
|
+
* @param row - Row index.
|
|
344
|
+
* @returns Channels of the pixel.
|
|
345
|
+
*/
|
|
346
|
+
public getPixel(column: number, row: number): number[] {
|
|
347
|
+
const result = [];
|
|
348
|
+
const start = (row * this.width + column) * this.channels;
|
|
349
|
+
for (let i = 0; i < this.channels; i++) {
|
|
350
|
+
result.push(this.data[start + i]);
|
|
351
|
+
}
|
|
352
|
+
return result;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
public getColumn(column: number): number[][] {
|
|
356
|
+
const columnValues = [];
|
|
357
|
+
for (let i = 0; i < this.channels; i++) {
|
|
358
|
+
const channelValues = [];
|
|
359
|
+
for (let j = 0; j < this.height; j++) {
|
|
360
|
+
channelValues.push(this.getValue(column, j, i));
|
|
361
|
+
}
|
|
362
|
+
columnValues.push(channelValues);
|
|
363
|
+
}
|
|
364
|
+
return columnValues;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
public getRow(row: number): number[][] {
|
|
368
|
+
const rowValues = [];
|
|
369
|
+
for (let i = 0; i < this.channels; i++) {
|
|
370
|
+
const channelValues = [];
|
|
371
|
+
for (let j = 0; j < this.width; j++) {
|
|
372
|
+
channelValues.push(this.getValue(j, row, i));
|
|
373
|
+
}
|
|
374
|
+
rowValues.push(channelValues);
|
|
375
|
+
}
|
|
376
|
+
return rowValues;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Set all the channels of a pixel.
|
|
380
|
+
* @param column - Column index.
|
|
381
|
+
* @param row - Row index.
|
|
382
|
+
* @param value - New color of the pixel to set.
|
|
225
383
|
*/
|
|
226
|
-
public
|
|
384
|
+
public setPixel(column: number, row: number, value: number[]): void {
|
|
385
|
+
const start = (row * this.width + column) * this.channels;
|
|
386
|
+
for (let i = 0; i < this.channels; i++) {
|
|
387
|
+
this.data[start + i] = value[i];
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Set all the channels of a pixel if the coordinates are inside the image.
|
|
393
|
+
* @param column - Column index.
|
|
394
|
+
* @param row - Row index.
|
|
395
|
+
* @param value - New color of the pixel to set.
|
|
396
|
+
*/
|
|
397
|
+
public setVisiblePixel(column: number, row: number, value: number[]): void {
|
|
398
|
+
if (column >= 0 && column < this.width && row >= 0 && row < this.height) {
|
|
399
|
+
this.setPixel(column, row, value);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Get all the channels of a pixel using its index.
|
|
405
|
+
* @param index - Index of the pixel.
|
|
406
|
+
* @returns Channels of the pixel.
|
|
407
|
+
*/
|
|
408
|
+
public getPixelByIndex(index: number): number[] {
|
|
227
409
|
const result = [];
|
|
228
|
-
const start =
|
|
410
|
+
const start = index * this.channels;
|
|
229
411
|
for (let i = 0; i < this.channels; i++) {
|
|
230
412
|
result.push(this.data[start + i]);
|
|
231
413
|
}
|
|
@@ -233,41 +415,161 @@ export class Image {
|
|
|
233
415
|
}
|
|
234
416
|
|
|
235
417
|
/**
|
|
236
|
-
* Set all the
|
|
237
|
-
* @param
|
|
238
|
-
* @param
|
|
239
|
-
* @param value - Values of the pixel to set.
|
|
418
|
+
* Set all the channels of a pixel using its index.
|
|
419
|
+
* @param index - Index of the pixel.
|
|
420
|
+
* @param value - New channel values of the pixel to set.
|
|
240
421
|
*/
|
|
241
|
-
public
|
|
242
|
-
const start =
|
|
422
|
+
public setPixelByIndex(index: number, value: number[]): void {
|
|
423
|
+
const start = index * this.channels;
|
|
243
424
|
for (let i = 0; i < this.channels; i++) {
|
|
244
425
|
this.data[start + i] = value[i];
|
|
245
426
|
}
|
|
246
427
|
}
|
|
247
428
|
|
|
248
429
|
/**
|
|
249
|
-
* Get the value of a specific pixel channel.
|
|
250
|
-
* @param
|
|
251
|
-
* @param
|
|
430
|
+
* Get the value of a specific pixel channel. Select pixel using coordinates.
|
|
431
|
+
* @param column - Column index.
|
|
432
|
+
* @param row - Row index.
|
|
433
|
+
* @param channel - Channel index.
|
|
434
|
+
* @returns Value of the specified channel of one pixel.
|
|
435
|
+
*/
|
|
436
|
+
public getValue(column: number, row: number, channel: number): number {
|
|
437
|
+
return this.data[(row * this.width + column) * this.channels + channel];
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Set the value of a specific pixel channel. Select pixel using coordinates.
|
|
442
|
+
* @param column - Column index.
|
|
443
|
+
* @param row - Row index.
|
|
444
|
+
* @param channel - Channel index.
|
|
445
|
+
* @param value - Value to set.
|
|
446
|
+
*/
|
|
447
|
+
public setValue(
|
|
448
|
+
column: number,
|
|
449
|
+
row: number,
|
|
450
|
+
channel: number,
|
|
451
|
+
value: number,
|
|
452
|
+
): void {
|
|
453
|
+
this.data[(row * this.width + column) * this.channels + channel] = value;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Set the value of a specific pixel channel. Select pixel using coordinates.
|
|
458
|
+
* If the value is out of range it is set to the closest extremety.
|
|
459
|
+
* @param column - Column index.
|
|
460
|
+
* @param row - Row index.
|
|
461
|
+
* @param channel - Channel index.
|
|
462
|
+
* @param value - Value to set.
|
|
463
|
+
*/
|
|
464
|
+
public setClampedValue(
|
|
465
|
+
column: number,
|
|
466
|
+
row: number,
|
|
467
|
+
channel: number,
|
|
468
|
+
value: number,
|
|
469
|
+
): void {
|
|
470
|
+
if (value < 0) value = 0;
|
|
471
|
+
else if (value > this.maxValue) value = this.maxValue;
|
|
472
|
+
this.data[(row * this.width + column) * this.channels + channel] = value;
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Get the value of a specific pixel channel. Select pixel using index.
|
|
476
|
+
* @param index - Index of the pixel.
|
|
477
|
+
* @param channel - Channel index.
|
|
478
|
+
* @returns Value of the channel of the pixel.
|
|
479
|
+
*/
|
|
480
|
+
public getValueByIndex(index: number, channel: number): number {
|
|
481
|
+
return this.data[index * this.channels + channel];
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Set the value of a specific pixel channel. Select pixel using index.
|
|
485
|
+
* @param index - Index of the pixel.
|
|
486
|
+
* @param channel - Channel index.
|
|
487
|
+
* @param value - Value to set.
|
|
488
|
+
*/
|
|
489
|
+
public setValueByIndex(index: number, channel: number, value: number): void {
|
|
490
|
+
this.data[index * this.channels + channel] = value;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Set the value of a specific pixel channel. Select pixel using index.
|
|
495
|
+
* If the value is out of range it is set to the closest extremety.
|
|
496
|
+
* @param index - Index of the pixel.
|
|
252
497
|
* @param channel - Channel index.
|
|
498
|
+
* @param value - Value to set.
|
|
253
499
|
*/
|
|
254
|
-
public
|
|
255
|
-
|
|
500
|
+
public setClampedValueByIndex(
|
|
501
|
+
index: number,
|
|
502
|
+
channel: number,
|
|
503
|
+
value: number,
|
|
504
|
+
): void {
|
|
505
|
+
if (value < 0) value = 0;
|
|
506
|
+
else if (value > this.maxValue) value = this.maxValue;
|
|
507
|
+
this.data[index * this.channels + channel] = value;
|
|
256
508
|
}
|
|
257
509
|
|
|
258
510
|
/**
|
|
259
|
-
*
|
|
260
|
-
* @param
|
|
261
|
-
* @param
|
|
511
|
+
* Get the value of a specific pixel channel. Select pixel using a point.
|
|
512
|
+
* @param point - Coordinates of the desired pixel.
|
|
513
|
+
* @param channel - Channel index.
|
|
514
|
+
* @returns Value of the channel of the pixel.
|
|
515
|
+
*/
|
|
516
|
+
public getValueByPoint(point: Point, channel: number): number {
|
|
517
|
+
return this.getValue(point.column, point.row, channel);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Set the value of a specific pixel channel. Select pixel using a point.
|
|
522
|
+
* @param point - Coordinates of the pixel.
|
|
262
523
|
* @param channel - Channel index.
|
|
263
524
|
* @param value - Value to set.
|
|
264
525
|
*/
|
|
265
|
-
public
|
|
266
|
-
this.
|
|
526
|
+
public setValueByPoint(point: Point, channel: number, value: number): void {
|
|
527
|
+
this.setValue(point.column, point.row, channel, value);
|
|
267
528
|
}
|
|
268
529
|
|
|
269
530
|
/**
|
|
270
|
-
*
|
|
531
|
+
* Find the min and max values of each channel of the image.
|
|
532
|
+
* @returns An object with arrays of the min and max values.
|
|
533
|
+
*/
|
|
534
|
+
public minMax(): { min: number[]; max: number[] } {
|
|
535
|
+
return getMinMax(this);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Return the raw image data.
|
|
540
|
+
* @returns The raw data.
|
|
541
|
+
*/
|
|
542
|
+
public getRawImage() {
|
|
543
|
+
return {
|
|
544
|
+
width: this.width,
|
|
545
|
+
height: this.height,
|
|
546
|
+
data: this.data,
|
|
547
|
+
channels: this.channels,
|
|
548
|
+
bitDepth: this.bitDepth,
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
public [Symbol.for('nodejs.util.inspect.custom')](): string {
|
|
553
|
+
let dataString;
|
|
554
|
+
if (this.height > 20 || this.width > 20) {
|
|
555
|
+
dataString = '[...]';
|
|
556
|
+
} else {
|
|
557
|
+
dataString = printData(this);
|
|
558
|
+
}
|
|
559
|
+
return `Image {
|
|
560
|
+
width: ${this.width}
|
|
561
|
+
height: ${this.height}
|
|
562
|
+
bitDepth: ${this.bitDepth}
|
|
563
|
+
colorModel: ${this.colorModel}
|
|
564
|
+
channels: ${this.channels}
|
|
565
|
+
data: ${dataString}
|
|
566
|
+
}`;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Fill the image with a value or a color.
|
|
571
|
+
* @param value - Value or color.
|
|
572
|
+
* @returns The image instance.
|
|
271
573
|
*/
|
|
272
574
|
public fill(value: number | number[]): this {
|
|
273
575
|
if (typeof value === 'number') {
|
|
@@ -277,12 +579,10 @@ export class Image {
|
|
|
277
579
|
} else {
|
|
278
580
|
if (value.length !== this.channels) {
|
|
279
581
|
throw new RangeError(
|
|
280
|
-
`the size of value must match the number of channels (${
|
|
281
|
-
this.channels
|
|
282
|
-
}). Got ${value.length} instead`
|
|
582
|
+
`the size of value must match the number of channels (${this.channels}). Received ${value.length}`,
|
|
283
583
|
);
|
|
284
584
|
}
|
|
285
|
-
|
|
585
|
+
for (const val of value) validateValue(val, this);
|
|
286
586
|
for (let i = 0; i < this.data.length; i += this.channels) {
|
|
287
587
|
for (let j = 0; j <= this.channels; j++) {
|
|
288
588
|
this.data[i + j] = value[j];
|
|
@@ -293,9 +593,10 @@ export class Image {
|
|
|
293
593
|
}
|
|
294
594
|
|
|
295
595
|
/**
|
|
296
|
-
* Fill one channel with a value
|
|
596
|
+
* Fill one channel with a value.
|
|
297
597
|
* @param channel - The channel to fill.
|
|
298
598
|
* @param value - The new value.
|
|
599
|
+
* @returns The image instance.
|
|
299
600
|
*/
|
|
300
601
|
public fillChannel(channel: number, value: number): this {
|
|
301
602
|
validateChannel(channel, this);
|
|
@@ -306,14 +607,30 @@ export class Image {
|
|
|
306
607
|
return this;
|
|
307
608
|
}
|
|
308
609
|
|
|
610
|
+
/**
|
|
611
|
+
* Get one channel of the image as an array.
|
|
612
|
+
* @param channel - The channel to fill.
|
|
613
|
+
* @returns Array with the channel values.
|
|
614
|
+
*/
|
|
615
|
+
public getChannel(channel: number): number[] {
|
|
616
|
+
validateChannel(channel, this);
|
|
617
|
+
const result = new Array(this.size);
|
|
618
|
+
for (let i = 0; i < this.size; i++) {
|
|
619
|
+
result[i] = this.data[channel + i * this.channels];
|
|
620
|
+
}
|
|
621
|
+
return result;
|
|
622
|
+
}
|
|
623
|
+
|
|
309
624
|
/**
|
|
310
625
|
* Fill the alpha channel with the specified value.
|
|
626
|
+
* @param value - New channel value.
|
|
627
|
+
* @returns The image instance.
|
|
311
628
|
*/
|
|
312
629
|
public fillAlpha(value: number): this {
|
|
313
630
|
validateValue(value, this);
|
|
314
631
|
if (!this.alpha) {
|
|
315
|
-
throw new
|
|
316
|
-
'fillAlpha can only be called if the image has an alpha channel'
|
|
632
|
+
throw new TypeError(
|
|
633
|
+
'fillAlpha can only be called if the image has an alpha channel',
|
|
317
634
|
);
|
|
318
635
|
}
|
|
319
636
|
const alphaIndex = this.channels - 1;
|
|
@@ -322,70 +639,542 @@ export class Image {
|
|
|
322
639
|
|
|
323
640
|
/**
|
|
324
641
|
* Create a copy of this image.
|
|
642
|
+
* @returns The image clone.
|
|
325
643
|
*/
|
|
326
644
|
public clone(): Image {
|
|
327
645
|
return Image.createFrom(this, { data: this.data.slice() });
|
|
328
646
|
}
|
|
329
647
|
|
|
648
|
+
/**
|
|
649
|
+
* Modify all the values of the image using the given callback.
|
|
650
|
+
* @param cb - Callback that modifies a given value.
|
|
651
|
+
*/
|
|
330
652
|
public changeEach(cb: (value: number) => number): void {
|
|
331
653
|
for (let i = 0; i < this.data.length; i++) {
|
|
332
654
|
this.data[i] = cb(this.data[i]);
|
|
333
655
|
}
|
|
334
656
|
}
|
|
335
657
|
|
|
336
|
-
|
|
658
|
+
/**
|
|
659
|
+
* Get the coordinates of a point in the image. The reference is the top-left corner.
|
|
660
|
+
* @param coordinates - The point for which you want the coordinates.
|
|
661
|
+
* @param round - Whether the coordinates should be rounded. This is useful when you want the center of the image.
|
|
662
|
+
* @returns Coordinates of the point in the format [column, row].
|
|
663
|
+
*/
|
|
664
|
+
public getCoordinates(coordinates: ImageCoordinates, round = false): Point {
|
|
665
|
+
return match(coordinates)
|
|
666
|
+
.with('center', () => {
|
|
667
|
+
const centerX = (this.width - 1) / 2;
|
|
668
|
+
const centerY = (this.height - 1) / 2;
|
|
669
|
+
if (round) {
|
|
670
|
+
return { column: Math.round(centerX), row: Math.round(centerY) };
|
|
671
|
+
} else {
|
|
672
|
+
return { column: centerX, row: centerY };
|
|
673
|
+
}
|
|
674
|
+
})
|
|
675
|
+
.with('top-left', () => ({ column: 0, row: 0 }))
|
|
676
|
+
.with('top-right', () => ({ column: this.width - 1, row: 0 }))
|
|
677
|
+
.with('bottom-left', () => ({ column: 0, row: this.height - 1 }))
|
|
678
|
+
.with('bottom-right', () => ({
|
|
679
|
+
column: this.width - 1,
|
|
680
|
+
row: this.height - 1,
|
|
681
|
+
}))
|
|
682
|
+
.exhaustive();
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
// COMPARE
|
|
686
|
+
/**
|
|
687
|
+
* Subtract other from an image.
|
|
688
|
+
* @param other - Image to subtract.
|
|
689
|
+
* @param options - Inversion options.
|
|
690
|
+
* @returns The subtracted image.
|
|
691
|
+
*/
|
|
692
|
+
public subtract(other: Image, options: SubtractImageOptions = {}): Image {
|
|
693
|
+
return subtract(this, other, options);
|
|
694
|
+
}
|
|
337
695
|
|
|
696
|
+
public add(other: Image): Image {
|
|
697
|
+
return add(this, other);
|
|
698
|
+
}
|
|
338
699
|
/**
|
|
339
|
-
*
|
|
340
|
-
* @param
|
|
700
|
+
* Multiply image pixels by a constant.
|
|
701
|
+
* @param value - Value which pixels will be multiplied to.
|
|
702
|
+
* @param options - Multiply options.
|
|
703
|
+
* @returns Multiplied image.
|
|
341
704
|
*/
|
|
342
|
-
public
|
|
705
|
+
public multiply(value: number, options: MultiplyOptions = {}): Image {
|
|
706
|
+
return multiply(this, value, options);
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Divide image pixels by a constant.
|
|
710
|
+
* @param value - Value which pixels will be divided to.
|
|
711
|
+
* @param options - Divide options.
|
|
712
|
+
* @returns Divided image.
|
|
713
|
+
*/
|
|
714
|
+
public divide(value: number, options: DivideOptions = {}): Image {
|
|
715
|
+
return divide(this, value, options);
|
|
716
|
+
}
|
|
717
|
+
// COMPUTE
|
|
718
|
+
|
|
719
|
+
public histogram(options?: HistogramOptions): Uint32Array {
|
|
343
720
|
return histogram(this, options);
|
|
344
721
|
}
|
|
345
722
|
|
|
346
|
-
|
|
723
|
+
/**
|
|
724
|
+
* Compute the mean pixel of an image.
|
|
725
|
+
* @param options - Mean options.
|
|
726
|
+
* @returns The mean pixel.
|
|
727
|
+
*/
|
|
728
|
+
public mean(options?: MeanOptions): number[] {
|
|
729
|
+
return mean(this, options);
|
|
730
|
+
}
|
|
347
731
|
|
|
348
732
|
/**
|
|
349
|
-
*
|
|
733
|
+
* Compute the median pixel of an image.
|
|
734
|
+
* @param options - Median options.
|
|
735
|
+
* @returns The median pixel.
|
|
350
736
|
*/
|
|
351
|
-
public
|
|
352
|
-
return
|
|
737
|
+
public median(options?: MedianOptions): number[] {
|
|
738
|
+
return median(this, options);
|
|
353
739
|
}
|
|
354
740
|
|
|
355
|
-
|
|
741
|
+
/**
|
|
742
|
+
* Compute the variance of each channel of an image.
|
|
743
|
+
* @param options - Variance options.
|
|
744
|
+
* @returns The variance of the channels of the image.
|
|
745
|
+
*/
|
|
746
|
+
public variance(options?: VarianceOptions): number[] {
|
|
747
|
+
return variance(this, options);
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
// DRAW
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* Draw a set of points on an image.
|
|
754
|
+
* @param points - Array of points.
|
|
755
|
+
* @param options - Draw points on Image options.
|
|
756
|
+
* @returns New mask.
|
|
757
|
+
*/
|
|
758
|
+
public drawPoints(points: Point[], options: DrawPointsOptions = {}): Image {
|
|
759
|
+
return drawPoints(this, points, options);
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Draw a line defined by two points onto an image.
|
|
764
|
+
* @param from - Line starting point.
|
|
765
|
+
* @param to - Line ending point.
|
|
766
|
+
* @param options - Draw Line options.
|
|
767
|
+
* @returns The mask with the line drawing.
|
|
768
|
+
*/
|
|
769
|
+
public drawLine(
|
|
770
|
+
from: Point,
|
|
771
|
+
to: Point,
|
|
772
|
+
options: DrawLineOnImageOptions = {},
|
|
773
|
+
): Image {
|
|
774
|
+
return drawLineOnImage(this, from, to, options);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* Draw a rectangle defined by position of the top-left corner, width and height.
|
|
779
|
+
* @param options - Draw rectangle options.
|
|
780
|
+
* @returns The image with the rectangle drawing.
|
|
781
|
+
*/
|
|
782
|
+
public drawRectangle(options: DrawRectangleOptions<Image> = {}): Image {
|
|
783
|
+
return drawRectangle(this, options);
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* Draw a polyline defined by an array of points on an image.
|
|
788
|
+
* @param points - Polyline array of points.
|
|
789
|
+
* @param options - Draw polyline options.
|
|
790
|
+
* @returns The image with the polyline drawing.
|
|
791
|
+
*/
|
|
792
|
+
public drawPolyline(
|
|
793
|
+
points: Point[],
|
|
794
|
+
options: DrawPolylineOnImageOptions = {},
|
|
795
|
+
): Image {
|
|
796
|
+
return drawPolylineOnImage(this, points, options);
|
|
797
|
+
}
|
|
356
798
|
|
|
357
|
-
|
|
358
|
-
|
|
799
|
+
/**
|
|
800
|
+
* Draw a polygon defined by an array of points onto an image.
|
|
801
|
+
* @param points - Polygon vertices.
|
|
802
|
+
* @param options - Draw Line options.
|
|
803
|
+
* @returns The image with the polygon drawing.
|
|
804
|
+
*/
|
|
805
|
+
public drawPolygon(
|
|
806
|
+
points: Point[],
|
|
807
|
+
options: DrawPolygonOnImageOptions = {},
|
|
808
|
+
): Image {
|
|
809
|
+
return drawPolygonOnImage(this, points, options);
|
|
359
810
|
}
|
|
360
811
|
|
|
361
|
-
|
|
362
|
-
|
|
812
|
+
/**
|
|
813
|
+
* Draw a circle defined by center and radius onto an image.
|
|
814
|
+
* @param center - Circle center.
|
|
815
|
+
* @param radius - Circle radius.
|
|
816
|
+
* @param options - Draw circle options.
|
|
817
|
+
* @returns The image with the circle drawing.
|
|
818
|
+
*/
|
|
819
|
+
public drawCircle(
|
|
820
|
+
center: Point,
|
|
821
|
+
radius: number,
|
|
822
|
+
options: DrawCircleOnImageOptions = {},
|
|
823
|
+
): Image {
|
|
824
|
+
return drawCircleOnImage(this, center, radius, options);
|
|
363
825
|
}
|
|
364
826
|
|
|
827
|
+
/**
|
|
828
|
+
* Draw a marker on the image.
|
|
829
|
+
* @param point - Marker center point.
|
|
830
|
+
* @param options - Draw marker options.
|
|
831
|
+
* @returns The image with the marker drawing.
|
|
832
|
+
*/
|
|
833
|
+
public drawMarker(point: Point, options: DrawMarkerOptions = {}): Image {
|
|
834
|
+
return drawMarker(this, point, options);
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* Draw markers on the image.
|
|
839
|
+
* @param points - Markers center points.
|
|
840
|
+
* @param options - Draw marker options.
|
|
841
|
+
* @returns The image with the markers drawing.
|
|
842
|
+
*/
|
|
843
|
+
public drawMarkers(points: Point[], options: DrawMarkerOptions = {}): Image {
|
|
844
|
+
return drawMarkers(this, points, options);
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
// OPERATIONS
|
|
365
848
|
public split(): Image[] {
|
|
366
849
|
return split(this);
|
|
367
850
|
}
|
|
851
|
+
|
|
852
|
+
public convertColor(
|
|
853
|
+
colorModel: ImageColorModel,
|
|
854
|
+
options?: ConvertColorOptions,
|
|
855
|
+
): Image {
|
|
856
|
+
return convertColor(this, colorModel, options);
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
public convertBitDepth(
|
|
860
|
+
newDepth: BitDepth,
|
|
861
|
+
options?: ConvertBitDepthOptions,
|
|
862
|
+
): Image {
|
|
863
|
+
return convertBitDepth(this, newDepth, options);
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
public grey(options?: GreyOptions): Image {
|
|
867
|
+
return grey(this, options);
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
public copyTo(target: Image, options: CopyToOptions<Image> = {}): Image {
|
|
871
|
+
return copyTo(this, target, options);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
public threshold(options: ThresholdOptions = {}): Mask {
|
|
875
|
+
return threshold(this, options);
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* Crop the input image to a desired size.
|
|
880
|
+
* @param [options] - Crop options.
|
|
881
|
+
* @returns The new cropped image.
|
|
882
|
+
*/
|
|
883
|
+
public crop(options?: CropOptions): Image {
|
|
884
|
+
return crop(this, options);
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* Crop an oriented rectangle from the image.
|
|
889
|
+
* 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.
|
|
890
|
+
* @param points - The points of the rectangle. Points must be circling around the rectangle (clockwise or anti-clockwise)
|
|
891
|
+
* @param options - Crop options, see {@link CropRectangleOptions}
|
|
892
|
+
* @returns The cropped image. The orientation of the image is the one closest to the rectangle passed as input.
|
|
893
|
+
*/
|
|
894
|
+
public cropRectangle(points: Point[], options?: CropRectangleOptions) {
|
|
895
|
+
return cropRectangle(this, points, options);
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* Crops the image based on the alpha channel
|
|
900
|
+
* This removes lines and columns where the alpha channel is lower than a threshold value.
|
|
901
|
+
* @param options - Crop alpha options.
|
|
902
|
+
* @returns The cropped image.
|
|
903
|
+
*/
|
|
904
|
+
public cropAlpha(options: CropAlphaOptions = {}): Image {
|
|
905
|
+
return cropAlpha(this, options);
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* Extract the pixels of an image, as specified in a mask.
|
|
910
|
+
* @param mask - The mask defining which pixels to keep.
|
|
911
|
+
* @param options - Extract options.
|
|
912
|
+
* @returns The extracted image.
|
|
913
|
+
*/
|
|
914
|
+
public extract(mask: Mask, options?: ExtractOptions): Image {
|
|
915
|
+
return extract(this, mask, options);
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Paint a mask onto an image and the given position and with the given color.
|
|
920
|
+
* @param mask - Mask to paint on the image.
|
|
921
|
+
* @param options - Paint mask options.
|
|
922
|
+
* @returns The painted image.
|
|
923
|
+
*/
|
|
924
|
+
public paintMask(mask: Mask, options?: PaintMaskOnImageOptions): Image {
|
|
925
|
+
return paintMaskOnImage(this, mask, options);
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
// FILTERS
|
|
929
|
+
|
|
930
|
+
public blur(options: BlurOptions): Image {
|
|
931
|
+
return blur(this, options);
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
public pixelate(options: PixelateOptions): Image {
|
|
935
|
+
return pixelate(this, options);
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
public directConvolution(
|
|
939
|
+
kernel: number[][],
|
|
940
|
+
options?: ConvolutionOptions,
|
|
941
|
+
): Image {
|
|
942
|
+
return directConvolution(this, kernel, options);
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* Compute direct convolution of an image and return an array with the raw values.
|
|
947
|
+
* @param kernel - Kernel used for the convolution.
|
|
948
|
+
* @param options - Convolution options.
|
|
949
|
+
* @returns Array with the raw convoluted values.
|
|
950
|
+
*/
|
|
951
|
+
public rawDirectConvolution(
|
|
952
|
+
kernel: number[][],
|
|
953
|
+
options?: ConvolutionOptions,
|
|
954
|
+
): Float64Array {
|
|
955
|
+
return rawDirectConvolution(this, kernel, options);
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
public separableConvolution(
|
|
959
|
+
kernelX: number[],
|
|
960
|
+
kernelY: number[],
|
|
961
|
+
options?: ConvolutionOptions,
|
|
962
|
+
): Image {
|
|
963
|
+
return separableConvolution(this, kernelX, kernelY, options);
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* Apply a gaussian filter to an image.
|
|
968
|
+
* @param options - Gaussian blur options.
|
|
969
|
+
* @returns The blurred image.
|
|
970
|
+
*/
|
|
971
|
+
public gaussianBlur(options: GaussianBlurOptions): Image {
|
|
972
|
+
return gaussianBlur(this, options);
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Flip the image.
|
|
976
|
+
* @param options - Flip options.
|
|
977
|
+
* @returns The flipped image.
|
|
978
|
+
*/
|
|
979
|
+
public flip(options?: FlipOptions): Image {
|
|
980
|
+
return flip(this, options);
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
/**
|
|
984
|
+
* Invert the colors of the image.
|
|
985
|
+
* @param options - Inversion options.
|
|
986
|
+
* @returns The inverted image.
|
|
987
|
+
*/
|
|
988
|
+
public invert(options?: InvertOptions): Image {
|
|
989
|
+
return invert(this, options);
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Calculate a new image that is the hypotenuse between the current image and the other.
|
|
994
|
+
* @param other - Other image.
|
|
995
|
+
* @param options - Hypotenuse options.
|
|
996
|
+
* @returns Hypotenuse of the two images.
|
|
997
|
+
*/
|
|
998
|
+
public hypotenuse(other: Image, options?: HypotenuseOptions): Image {
|
|
999
|
+
return hypotenuse(this, other, options);
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* Apply a gradient filter to an image.
|
|
1004
|
+
* @param options - Gradient filter options.
|
|
1005
|
+
* @returns The gradient image.
|
|
1006
|
+
*/
|
|
1007
|
+
public gradientFilter(options: GradientFilterOptions): Image {
|
|
1008
|
+
return gradientFilter(this, options);
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* Apply a derivative filter to an image.
|
|
1013
|
+
* @param options - Derivative filter options.
|
|
1014
|
+
* @returns The processed image.
|
|
1015
|
+
*/
|
|
1016
|
+
public derivativeFilter(options?: DerivativeFilterOptions): Image {
|
|
1017
|
+
return derivativeFilter(this, options);
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Level the image using the optional input and output value. This function allows you to enhance the image's contrast.
|
|
1022
|
+
* @param options - Level options.
|
|
1023
|
+
* @returns The levelled image.
|
|
1024
|
+
*/
|
|
1025
|
+
public level(options?: LevelOptions): Image {
|
|
1026
|
+
return level(this, options);
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* Increase the contrast of an image by spanning each channel on the range [0, image.maxValue].
|
|
1031
|
+
* @param options - Increase contrast options.
|
|
1032
|
+
* @returns The enhanced image.
|
|
1033
|
+
*/
|
|
1034
|
+
public increaseContrast(options: IncreaseContrastOptions = {}): Image {
|
|
1035
|
+
return increaseContrast(this, options);
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* Correct the colors in an image using the reference colors.
|
|
1040
|
+
* @param measuredColors - Colors from the image, which will be compared to the reference.
|
|
1041
|
+
* @param referenceColors - Reference colors.
|
|
1042
|
+
* @returns Image with the colors corrected.
|
|
1043
|
+
*/
|
|
1044
|
+
public correctColor(
|
|
1045
|
+
measuredColors: RgbColor[],
|
|
1046
|
+
referenceColors: RgbColor[],
|
|
1047
|
+
): Image {
|
|
1048
|
+
return correctColor(this, measuredColors, referenceColors);
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Apply a median filter to the image.
|
|
1052
|
+
* @param options - Options to apply for median filter.
|
|
1053
|
+
* @returns Image after median filter.
|
|
1054
|
+
*/
|
|
1055
|
+
public medianFilter(options: MedianFilterOptions) {
|
|
1056
|
+
return medianFilter(this, options);
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
// GEOMETRY
|
|
1060
|
+
|
|
1061
|
+
public resize(options: ResizeOptions): Image {
|
|
1062
|
+
return resize(this, options);
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
public rotate(angle: RotateAngle): Image {
|
|
1066
|
+
return rotate(this, angle);
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
public transform(
|
|
1070
|
+
transformMatrix: number[][],
|
|
1071
|
+
options?: TransformOptions,
|
|
1072
|
+
): Image {
|
|
1073
|
+
return transform(this, transformMatrix, options);
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
public transformRotate(
|
|
1077
|
+
angle: number,
|
|
1078
|
+
options?: TransformRotateOptions,
|
|
1079
|
+
): Image {
|
|
1080
|
+
return transformRotate(this, angle, options);
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
// MORPHOLOGY
|
|
1084
|
+
/**
|
|
1085
|
+
* Erode an image.
|
|
1086
|
+
* @param options - Erode options.
|
|
1087
|
+
* @returns The eroded image.
|
|
1088
|
+
*/
|
|
1089
|
+
public erode(options?: ErodeOptions): Image {
|
|
1090
|
+
return erode(this, options);
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Dilate an image.
|
|
1094
|
+
* @param options - Dilate options.
|
|
1095
|
+
* @returns The dilated image.
|
|
1096
|
+
*/
|
|
1097
|
+
public dilate(options?: DilateOptions): Image {
|
|
1098
|
+
return dilate(this, options);
|
|
1099
|
+
}
|
|
1100
|
+
/**
|
|
1101
|
+
* Open an image.
|
|
1102
|
+
* @param options - Open options.
|
|
1103
|
+
* @returns The opened image.
|
|
1104
|
+
*/
|
|
1105
|
+
public open(options?: OpenOptions): Image {
|
|
1106
|
+
return open(this, options);
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* Close an image.
|
|
1111
|
+
* @param options - Close options.
|
|
1112
|
+
* @returns The closed image.
|
|
1113
|
+
*/
|
|
1114
|
+
public close(options?: CloseOptions): Image {
|
|
1115
|
+
return close(this, options);
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* Top hat of an image.
|
|
1120
|
+
* @param options - Top hat options.
|
|
1121
|
+
* @returns The top-hatted image.
|
|
1122
|
+
*/
|
|
1123
|
+
public topHat(options?: TopHatOptions): Image {
|
|
1124
|
+
return topHat(this, options);
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
/**
|
|
1128
|
+
* Bottom hat of an image.
|
|
1129
|
+
* @param options - Bottom hat options.
|
|
1130
|
+
* @returns The bottom-hatted image.
|
|
1131
|
+
*/
|
|
1132
|
+
public bottomHat(options?: BottomHatOptions): Image {
|
|
1133
|
+
return bottomHat(this, options);
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
/**
|
|
1137
|
+
* Apply morphological gradient to an image.
|
|
1138
|
+
* @param options - Morphological gradient options.
|
|
1139
|
+
* @returns The processed image.
|
|
1140
|
+
*/
|
|
1141
|
+
public morphologicalGradient(options?: MorphologicalGradientOptions): Image {
|
|
1142
|
+
return morphologicalGradient(this, options);
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
/**
|
|
1146
|
+
* Apply Canny edge detection to an image.
|
|
1147
|
+
* @param options - Canny edge detection options.
|
|
1148
|
+
* @returns The processed image.
|
|
1149
|
+
*/
|
|
1150
|
+
public cannyEdgeDetector(options?: CannyEdgeOptions): Mask {
|
|
1151
|
+
return cannyEdgeDetector(this, options);
|
|
1152
|
+
}
|
|
368
1153
|
}
|
|
369
1154
|
|
|
1155
|
+
/**
|
|
1156
|
+
* Create data array and set alpha channel to max value if applicable.
|
|
1157
|
+
* @param size - Number of pixels.
|
|
1158
|
+
* @param channels - Number of channels.
|
|
1159
|
+
* @param alpha - Specify if there is alpha channel.
|
|
1160
|
+
* @param bitDepth - Number of bits per channel.
|
|
1161
|
+
* @param maxValue - Maximal acceptable value for the channels.
|
|
1162
|
+
* @returns The new pixel array.
|
|
1163
|
+
*/
|
|
370
1164
|
function createPixelArray(
|
|
371
1165
|
size: number,
|
|
372
1166
|
channels: number,
|
|
373
1167
|
alpha: boolean,
|
|
374
|
-
|
|
375
|
-
maxValue: number
|
|
1168
|
+
bitDepth: BitDepth,
|
|
1169
|
+
maxValue: number,
|
|
376
1170
|
): ImageDataArray {
|
|
377
1171
|
const length = channels * size;
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
arr = new Uint16Array(length);
|
|
385
|
-
break;
|
|
386
|
-
default:
|
|
387
|
-
throw new Error(`unexpected color depth: ${depth}`);
|
|
388
|
-
}
|
|
1172
|
+
const arr = match(bitDepth)
|
|
1173
|
+
.with(8, () => new Uint8Array(length))
|
|
1174
|
+
.with(16, () => new Uint16Array(length))
|
|
1175
|
+
.otherwise(() => {
|
|
1176
|
+
throw new RangeError(`invalid bitDepth: ${bitDepth}`);
|
|
1177
|
+
});
|
|
389
1178
|
|
|
390
1179
|
// Alpha channel is 100% by default.
|
|
391
1180
|
if (alpha) {
|
|
@@ -396,3 +1185,29 @@ function createPixelArray(
|
|
|
396
1185
|
|
|
397
1186
|
return arr;
|
|
398
1187
|
}
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* Returns the image data as a formatted string.
|
|
1191
|
+
* @param img - The image instance.
|
|
1192
|
+
* @returns Formatted string containing the image data.
|
|
1193
|
+
*/
|
|
1194
|
+
function printData(img: Image): string {
|
|
1195
|
+
const result = [];
|
|
1196
|
+
const padding = img.bitDepth === 8 ? 3 : 5;
|
|
1197
|
+
|
|
1198
|
+
for (let row = 0; row < img.height; row++) {
|
|
1199
|
+
const currentRow = [];
|
|
1200
|
+
for (let column = 0; column < img.width; column++) {
|
|
1201
|
+
for (let channel = 0; channel < img.channels; channel++) {
|
|
1202
|
+
currentRow.push(
|
|
1203
|
+
String(img.getValue(column, row, channel)).padStart(padding, ' '),
|
|
1204
|
+
);
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
result.push(`[${currentRow.join(' ')}]`);
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
return `{
|
|
1211
|
+
[\n ${result.join('\n ')}\n ]
|
|
1212
|
+
}`;
|
|
1213
|
+
}
|