{"_id":"@as3long/face-detector","_rev":"6-2fd6445a2a59c5f69654245344b0e001","name":"@as3long/face-detector","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"@as3long/face-detector","version":"1.0.0","keywords":["face","detection","viola-jones","image","computer-vision"],"author":{"name":"as3long"},"license":"MIT","_id":"@as3long/face-detector@1.0.0","maintainers":[{"name":"as3long","email":"as3long@qq.com"}],"dist":{"shasum":"ce2676f40096cfe8ffcfed0d6a9b06c718bd0414","tarball":"https://registry.npmjs.org/@as3long/face-detector/-/face-detector-1.0.0.tgz","fileCount":19,"integrity":"sha512-lnZQhUHqVa6SIYXd6srXVrkToYfFIe/cXPzCIz2U5YXwfr3i67nIsufzqPmxE3vGoDVrjNaDGWHLHdcsR4JrOw==","signatures":[{"sig":"MEUCIQClY5940xBCyj28fLZZtw9po+UCJHUZV81g/kpPF4BCMgIgfdAiWU2vDc4lKY6tkDpSWVa5qxnIf5/Oz+eUvxb73xw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":642604},"main":"dist/cjs/index.js","types":"dist/esm/index.d.ts","module":"dist/esm/index.js","exports":{".":{"types":"./dist/esm/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"0d33d22c6a2aba75ba7352055ddf2a23f1870f04","scripts":{"test":"jest","build":"npm run build:esm && npm run build:cjs","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","prepublishOnly":"npm run build"},"_npmUser":{"name":"as3long","email":"as3long@qq.com"},"_npmVersion":"10.5.0","description":"A face detection library based on Viola-Jones algorithm","directories":{},"_nodeVersion":"24.14.0","dependencies":{"sharp":"^0.33.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.4.2","eslint":"^10.3.0","ts-jest":"^29.4.9","@eslint/js":"^10.0.1","typescript":"^5.0.0","@types/jest":"^30.0.0","@types/node":"^20.0.0","typescript-eslint":"^8.59.3"},"_npmOperationalInternal":{"tmp":"tmp/face-detector_1.0.0_1778651529412_0.18385531015635515","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@as3long/face-detector","version":"1.0.1","keywords":["face","detection","viola-jones","image","computer-vision"],"author":{"name":"as3long"},"license":"MIT","_id":"@as3long/face-detector@1.0.1","maintainers":[{"name":"as3long","email":"as3long@qq.com"}],"dist":{"shasum":"a9fd13680a1cf0356adf5d47e8c59b194f0629c8","tarball":"https://registry.npmjs.org/@as3long/face-detector/-/face-detector-1.0.1.tgz","fileCount":19,"integrity":"sha512-6Jbe5gu+E+MkNqdgOrj8hD5FTozrgjz+KkpfO9APJGJ0E3pNUnDUjgF3l1chsZCrADjQV6toTqx84QBCC6S8/g==","signatures":[{"sig":"MEUCIQCdxjrd7wK+TDeDnXwmyJwT4kWihvQRFAcpgiC2gHcIgQIgaiX8dDOcHQD5UCeQZZKE82afUSTMtKq99kiuhBc9mnA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":642640},"main":"dist/cjs/index.js","types":"dist/esm/index.d.ts","module":"dist/esm/index.js","exports":{".":{"types":"./dist/esm/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"0d33d22c6a2aba75ba7352055ddf2a23f1870f04","scripts":{"test":"jest","build":"npm run build:esm && npm run build:cjs","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","prepublishOnly":"npm run build"},"_npmUser":{"name":"as3long","email":"as3long@qq.com"},"_npmVersion":"10.5.0","description":"A face detection library based on Viola-Jones algorithm","directories":{},"_nodeVersion":"24.14.0","dependencies":{"sharp":"^0.33.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.4.2","eslint":"^10.3.0","ts-jest":"^29.4.9","@eslint/js":"^10.0.1","typescript":"^5.0.0","@types/jest":"^30.0.0","@types/node":"^20.0.0","typescript-eslint":"^8.59.3"},"_npmOperationalInternal":{"tmp":"tmp/face-detector_1.0.1_1778651626423_0.39318607990525334","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@as3long/face-detector","version":"1.0.2","keywords":["face","detection","viola-jones","image","computer-vision"],"author":{"name":"as3long"},"license":"MIT","_id":"@as3long/face-detector@1.0.2","maintainers":[{"name":"as3long","email":"as3long@qq.com"}],"dist":{"shasum":"2a2cd850b814ea155164cc03e61a619f3e586a25","tarball":"https://registry.npmjs.org/@as3long/face-detector/-/face-detector-1.0.2.tgz","fileCount":22,"integrity":"sha512-szC3etirYhudoAg84Jx09qtJGmLqw2lfjrigHMHY428ml+NMoZ3ai58s0SHFtUKA8qXjapOzFG2uj+LS2azp3g==","signatures":[{"sig":"MEYCIQC8d3erfoTCWHUQj6JXRvjjUhuGsWxmGNM74y33qvC1TQIhAOC2of209GNO3AIWqMkJU/6vzhvkTnoPfMAv+mzG8TTi","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":645155},"main":"dist/cjs/index.js","types":"dist/esm/index.d.ts","module":"dist/esm/index.js","exports":{".":{"types":"./dist/esm/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"c017118d128845e9fc5c4d027650ea6e1d818aec","scripts":{"test":"jest","build":"npm run build:esm && npm run build:cjs","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","prepublishOnly":"npm run build"},"_npmUser":{"name":"as3long","email":"as3long@qq.com"},"_npmVersion":"10.5.0","description":"A face detection library based on Viola-Jones algorithm","directories":{},"_nodeVersion":"24.14.0","dependencies":{"sharp":"^0.33.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.4.2","eslint":"^10.3.0","ts-jest":"^29.4.9","@eslint/js":"^10.0.1","typescript":"^5.0.0","@types/jest":"^30.0.0","@types/node":"^20.0.0","typescript-eslint":"^8.59.3"},"_npmOperationalInternal":{"tmp":"tmp/face-detector_1.0.2_1778652739143_0.5376167282297637","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@as3long/face-detector","version":"1.0.3","keywords":["face","detection","viola-jones","image","computer-vision"],"author":{"name":"as3long"},"license":"MIT","_id":"@as3long/face-detector@1.0.3","maintainers":[{"name":"as3long","email":"as3long@qq.com"}],"dist":{"shasum":"dc2b4bf45f52b58c2fddd3579d4a73c3f63eac3d","tarball":"https://registry.npmjs.org/@as3long/face-detector/-/face-detector-1.0.3.tgz","fileCount":24,"integrity":"sha512-y12VEDSoI1z/ylzBKF9md3FOVFmPD3bwwmDbwmk4iwObRIQgKyoguq1TShX9wPXc308VvNzPfKV4GBLk6jQj4w==","signatures":[{"sig":"MEUCIATPfAgRXxgbF4fmy02dcsyjLiTCBoqRULqXMVMaAPewAiEA57Ss1ytB36edlzMF8wTzvrLnjbofI1QCdzLouk7+3rQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":645386},"main":"dist/cjs/index.js","types":"dist/esm/index.d.ts","module":"dist/esm/index.js","exports":{".":{"types":"./dist/esm/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"037bb46c7593c944d96f9d60bf0c9d044dabbf5f","scripts":{"test":"jest","build":"npm run build:esm && npm run build:cjs && node -e \"require('fs').writeFileSync('dist/esm/package.json','{\\\"type\\\":\\\"module\\\"}\\n');require('fs').writeFileSync('dist/cjs/package.json','{\\\"type\\\":\\\"commonjs\\\"}\\n')\"","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","prepublishOnly":"npm run build"},"_npmUser":{"name":"as3long","email":"as3long@qq.com"},"_npmVersion":"10.5.0","description":"A face detection library based on Viola-Jones algorithm","directories":{},"_nodeVersion":"24.14.0","dependencies":{"sharp":"^0.33.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.4.2","eslint":"^10.3.0","ts-jest":"^29.4.9","@eslint/js":"^10.0.1","typescript":"^5.0.0","@types/jest":"^30.0.0","@types/node":"^20.0.0","typescript-eslint":"^8.59.3"},"_npmOperationalInternal":{"tmp":"tmp/face-detector_1.0.3_1778653458449_0.20348609734628287","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@as3long/face-detector","version":"1.1.0","keywords":["face","detection","viola-jones","image","computer-vision"],"author":{"name":"as3long"},"license":"MIT","_id":"@as3long/face-detector@1.1.0","maintainers":[{"name":"as3long","email":"as3long@qq.com"}],"dist":{"shasum":"4ba7c0b75e88398e1590fe3d8f4ead0ca47707dc","tarball":"https://registry.npmjs.org/@as3long/face-detector/-/face-detector-1.1.0.tgz","fileCount":28,"integrity":"sha512-LCwFuuSOscIkOVsccYlTLw9lbNoSY8ZASuUFTeChElZp2CxEqSebRNq9SVP+fOlSLZ77uDuv1DMhC11YNTvBqw==","signatures":[{"sig":"MEUCIQD+rVUB3doNTAYTw9glI0jlRxhBwYwggnJeWzYU3Fb6NQIgbkyGGM2JHTMfG5LS6qgoiNfCYm88R1H0OBQK33QjMso=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":662436},"main":"dist/cjs/index.js","types":"dist/esm/index.d.ts","module":"dist/esm/index.js","exports":{".":{"types":"./dist/esm/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"f5df04ef3c9dbba6e7d694acce492a6b63cfeafa","scripts":{"test":"jest","build":"npm run build:esm && npm run build:cjs && node -e \"require('fs').writeFileSync('dist/esm/package.json','{\\\"type\\\":\\\"module\\\"}\\n');require('fs').writeFileSync('dist/cjs/package.json','{\\\"type\\\":\\\"commonjs\\\"}\\n')\"","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","prepublishOnly":"npm run build"},"_npmUser":{"name":"as3long","email":"as3long@qq.com"},"_npmVersion":"10.5.0","description":"A face detection library based on Viola-Jones algorithm","directories":{},"_nodeVersion":"24.14.0","dependencies":{"sharp":"^0.33.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.4.2","eslint":"^10.3.0","ts-jest":"^29.4.9","@eslint/js":"^10.0.1","typescript":"^5.0.0","@types/jest":"^30.0.0","@types/node":"^20.0.0","typescript-eslint":"^8.59.3"},"_npmOperationalInternal":{"tmp":"tmp/face-detector_1.1.0_1778671923826_0.8619863598119448","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@as3long/face-detector","version":"1.1.1","description":"A face detection library based on Viola-Jones algorithm","main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"dist/esm/index.d.ts","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js","types":"./dist/esm/index.d.ts"}},"scripts":{"build":"npm run build:esm && npm run build:cjs && node -e \"require('fs').writeFileSync('dist/esm/package.json','{\\\"type\\\":\\\"module\\\"}\\n');require('fs').writeFileSync('dist/cjs/package.json','{\\\"type\\\":\\\"commonjs\\\"}\\n')\"","build:esm":"tsc -p tsconfig.esm.json","build:cjs":"tsc -p tsconfig.cjs.json","test":"jest","prepublishOnly":"npm run build"},"keywords":["face","detection","viola-jones","image","computer-vision"],"author":{"name":"as3long"},"license":"MIT","dependencies":{"sharp":"^0.33.0"},"devDependencies":{"@eslint/js":"^10.0.1","@types/jest":"^30.0.0","@types/node":"^20.0.0","eslint":"^10.3.0","jest":"^30.4.2","ts-jest":"^29.4.9","typescript":"^5.0.0","typescript-eslint":"^8.59.3"},"_id":"@as3long/face-detector@1.1.1","gitHead":"b18ec30e86162d483890cad073d0f54e5749775d","_nodeVersion":"24.14.0","_npmVersion":"10.5.0","dist":{"integrity":"sha512-PhbwNQawrA+bWKRymQfRrvySw5we93e2iSx0ZetXYO1VVFLJRO73Mop8eGKFOiiFzwEeoLz2UYj/7RNDn0V48Q==","shasum":"1fa31815b42bb0fe0e2a626a25d5f3f4290bab51","tarball":"https://registry.npmjs.org/@as3long/face-detector/-/face-detector-1.1.1.tgz","fileCount":29,"unpackedSize":664434,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFUDIt9K2fTsxD6Pw6Tm7s5FNyLTQV4aWONCUfd++TvgAiEA0+sEzbjwac/u74CCJmwBjHtQx0+6SbFsTTILZSNGRQw="}]},"_npmUser":{"name":"as3long","email":"as3long@qq.com"},"directories":{},"maintainers":[{"name":"as3long","email":"as3long@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/face-detector_1.1.1_1778673017251_0.9091278757362722"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-13T05:52:09.306Z","modified":"2026-05-13T11:50:17.892Z","1.0.0":"2026-05-13T05:52:09.564Z","1.0.1":"2026-05-13T05:53:46.566Z","1.0.2":"2026-05-13T06:12:19.419Z","1.0.3":"2026-05-13T06:24:18.608Z","1.1.0":"2026-05-13T11:32:03.970Z","1.1.1":"2026-05-13T11:50:17.443Z"},"author":{"name":"as3long"},"license":"MIT","keywords":["face","detection","viola-jones","image","computer-vision"],"description":"A face detection library based on Viola-Jones algorithm","maintainers":[{"name":"as3long","email":"as3long@qq.com"}],"readme":"# @as3long/face-detector\n\nA face detection library based on the Viola-Jones algorithm. Detects faces in images using a cascade of Haar-like features.\n\n## Installation\n\n```bash\nnpm install @as3long/face-detector\n```\n\n## Usage\n\n### ESM\n\n```typescript\nimport { detectFaces, detectBestFace } from '@as3long/face-detector';\n\n// Detect all faces in an image\nconst faces = await detectFaces('path/to/image.jpg');\nconsole.log(faces);\n// [\n//   { x: 100, y: 50, width: 200, height: 200, confidence: 0.82, neighbor: 5 },\n//   ...\n// ]\n\n// With performance/accuracy options\nconst faces2 = await detectFaces('path/to/image.jpg', {\n  maxDimension: 320,         // downscale large images (default 500)\n  minNeighbors: 4,           // require more overlap (default 3)\n  scaleFactor: 1.1,          // finer pyramid scale (default 1.19)\n  step: 2,                   // smaller stride = more scans (default 4)\n});\n\n// Get the best (largest) face\nconst best = await detectBestFace('path/to/image.jpg');\nconsole.log(best);\n// { x: 100, y: 50, width: 200, height: 200 }\n```\n\n### CommonJS\n\n```javascript\nconst { detectFaces, detectBestFace } = require('@as3long/face-detector');\n\nasync function main() {\n  const faces = await detectFaces('path/to/image.jpg');\n  console.log(faces);\n}\n```\n\n## API\n\n### `detectFaces(imagePath: string, options?: DetectOptions): Promise<Detection[]>`\n\nDetects all faces in the given image. Returns an array of detection results.\n\n- `imagePath` - Path to the image file (supported formats: JPEG, PNG, WebP, etc.)\n- `options` - Optional configuration object\n\n**DetectOptions**:\n| Field          | Type     | Default                     | Description                                      |\n|----------------|----------|-----------------------------|--------------------------------------------------|\n| `maxDimension` | `number` | `200`                       | Max image dimension before downscaling (max 500) |\n| `minNeighbors` | `number` | `3`                         | Minimum overlapping detections to keep a face    |\n| `scaleFactor`  | `number` | `1.19` (2^(1/4))            | Scale multiplier between pyramid levels          |\n| `step`         | `number` | `4`                         | Sliding window stride (smaller = more scans)     |\n\n**Detection**:\n| Field       | Type     | Description                          |\n|-------------|----------|--------------------------------------|\n| `x`         | `number` | X coordinate of the face             |\n| `y`         | `number` | Y coordinate of the face             |\n| `width`     | `number` | Width of the face bounding box       |\n| `height`    | `number` | Height of the face bounding box      |\n| `confidence`| `number` | Detection confidence (0-1)           |\n| `neighbor`  | `number` | Number of overlapping detections     |\n\n### `detectBestFace(imagePath: string, options?: DetectOptions): Promise<{ x, y, width, height } | null>`\n\nDetects the largest (most prominent) face in the image. Returns `null` if no face is found.\n\n## Dependencies\n\n- [sharp](https://sharp.pixelplumbing.com/) - High-performance image processing\n\n## License\n\nMIT\n","readmeFilename":"README.md"}