8000 GitHub - andriiheonia/pixfinder: This repository is deprecated and no longer maintained.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 8, 2025. It is now read-only.

andriiheonia/pixfinder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOTE: This library is unmaintained and deprecated.

Click to expand library description

This library is a prototype that detects objects in the image in a very naive way (by their color). It was developed for the demo purpose only, it doesn't produce reliable results and it's not meant to be used in production.

API

findAll

Search all objects in the image.

Function Return Description
pix.findAll(<Object> options) Array Detects objects by the given options.

options

Option Type Default Description
img HTMLImageElement | HTMLCanvasElement Loaded image or canvas element that has to be analyzed.
colors Array Colors of objects to find.
tolerance Number 50 Color variation (number of shades). Helps to detect objects not only by strict colors (colors option), but by their shades too.
accuracy Number 2 If accuracy = 1 then Pixfinder analyzes each pixel of the image, if accuracy = 2 then each 2nd pixel, and so on. Large number for better performance and worse quality and vice versa. The number should be a positive integer.
distance Number 10 Distance between objects (in pixels). During the image analysis Pixfinder detects all pixels according to specified colors and then splits them into several objects by distance. If distance between two pixels is shorter than this option then pixels belong to the same object.
clearNoise Boolean | Number false Removes all small objects after the image analysis. If false then noise clearing is disabled. If number is set then all objects that contain less than specified number of pixels will be removed.
concavity Number 10 Determines the concavity of object edges. Internally Pixfinder uses hull.js library to build object boundary. Please see hull.js documentation for more information about this parameter.

find

Starts searching from the start point and returns one object that belongs to this point. This method should be useful for example if you want to highlight object under the mouse cursor.

Function Return Description
pix.find(<Object> options) Array Returns points of the object which belongs to the startPoint.

options

Option Type Default Description
img HTMLImageElement | HTMLCanvasElement Loaded image or canvas element that has to be analyzed.
colors Array Colors of objects to find.
startPoint Point Point from which to start the object pixels search.
tolerance Number 50 Color variation (number of shades). Helps to detect objects not only by strict colors (colors option), but by their shades too.
distance Number 10 Distance between objects (in pixels). If distance between two pixels is shorter than this option then Pixfinder decides that pixels belong to the same object.
concavity Number 10 Determines the concavity of object edges. Internally Pixfinder uses hull.js library to build object boundary. Please see hull.js documentation for more information about this parameter.

util.dom

Various DOM utility functions.

Method Returns Description
onload(<HTMLImageElement> img, <Function> func) Calls func function when img image is loaded.
loaded(<HTMLImageElement> img) Boolean Checks whether img image has been loaded.

Point

Contains information about point.

Property Type Description
x Number The x coordinate.
y Number The y coordinate.

Development

npm install     # install dependencies
npm run build   # build library

Changelog

0.2.8 — 08.02.2025

  • Cleanup and deprecate

0.2.7 — 05.11.2024

  • Remove vulnerable dev dependencies

0.2.6 — 28.10.2019

  • Introduce pixfinder.d.ts

0.2.5 — 01.07.2018

  • Update dependencies;
  • Introduce concavity parameter.

0.2.4 — 30.03.2015

  • Minor package.json and copyright fixes.

0.2.3 — 04.02.2015

  • Minor package.json fixes.

0.2.2 — 04.02.2015

  • Minor package.json fixes.

0.2.1 — 27.10.2014

  • Readme fixes.

0.2.0 — 27.10.2014

  • API changes without backward compatibility.

0.1.0 — 16.05.2014

  • First Pixfinder release (unstable alpha version).

About

This repository is deprecated and no longer maintained.

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  
0