Skip to content
Matt Ellen edited this page Feb 27, 2020 · 2 revisions

Takes an ImageData object and three numbers.
Returns an Array of arrays of point like objects.

  • The imageData input is the image that you want to detect continuous regions of.
  • The first number is the minimum difference between two pixel colour values (0 - 255) that constitutes a significant change.
  • The second number is the shortest you want a region to be (for example to filter out individual pixels that have been detected as edges)
  • The third number is the maximum distance between two pixels that means they're in the same region.

The output is an array of arrays of point like objects (e.g. {x:0, y:0}). Each array is a collection of the points for the border of a particular region.

Example

const img = document.getElementById('jsiaImg');
const data = jsia.getImageDataFromImg(img);
const lines = jsia.lineDetection(data, 16, 8, 3);

Clone this wiki locally