nathan-rectangle-scan
v1.1.8
Published
Detect a rectangle in an image at a specific location using Javascript
Downloads
829
Maintainers
Readme
Rectangle scan
Scans an image to see if there is a rectangle in a predefined place.
Setup
npm i nathan-rectangle-scan
const checker = new RectCheck();
const image = new Image();
image.onload = () => alert(checker.check(image, x, y, width, height)) ? "Found a rectangle!" : "Didn't find it"
image.src = "path-to-some-image.jpg";
Demo
Run gulp demo
or visit the Live demo
Options
When instantiating the RectCheck class you can pass an object with options.
const checker = new RectCheck(options)
| name | default | description | | --------------- |:--------:| :---------------------------------------------------------------------------------------- | | edgeThreshhold | 250 | how much of the search area has to be covered in edge for it to be considered valid | | minContrast | 80 | The amount of contrast needed to be considered an edge | | scale | 0.5 | The amount to scale the image by before running the edge detection (lower is faster) | | searchWidth | 30 | The width (on side sides, height on top and bottom) to search for edges around input area |
Building
Building index.js
gulp build
Building the /dist version
gulp build-dist