0.2.0 • Published 3 years ago

react-shape-detect v0.2.0

Weekly downloads
66
License
ISC
Repository
github
Last release
3 years ago

react-shape-detect (v0.2)

CI

A React component integration with the Shape Detection API. Provides coordinate data and overlay capabilites.

Install

$ npm i react-shape-detect

Usage

import ShapeDetect from 'react-shape-detect';

const path = 'path-or-url-to-image';
const overlay = 'path-or-url-to-overlay';

const func = function(data) {
  console.log('objects detected: ', data);
}

export default function App() {
  return (
    <ShapeDetect 
      image={path} 
      onRender={func} 
      options={{ 
        type: 'face', 
        overlay: { 
          input: overlay
          options: {
            width: '70%'
          }
        }
      }} 
    />
  );
}

Basic Props

image

string | required

Path to image - network or local.

onRender

function(data: any) | defaults to: (data) => void

Callback is executed with the onLoad event of the <img/> tag. Returns coordinate data from matches on criteria defined in options object.

options

object

Detector type, custom Shape Detector API options, and HTML img tag attributes

{
  type?: string // 'barcode', 'text' // default 'face'
  attributes?: React.CSSProperties,
  resizeDebounce?: number // default 250(ms)
  overlay?: {
    input: string || ReactComponent,
    options?: {
      width?: string, // auto height or set height independently
      height?: string,
      offset?: { // in pixels
        top?: number,
        left?: number
      }
    }
  }
}

License

MIT © Sam Parsons

0.1.13

3 years ago

0.2.0

3 years ago

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.4

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.0

3 years ago

1.0.0

3 years ago

0.0.29

3 years ago

0.0.28

3 years ago

0.0.26

3 years ago

0.0.27

3 years ago

0.0.25

3 years ago

0.0.24

3 years ago

0.0.23

3 years ago

0.0.21

3 years ago

0.0.19

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.1

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.4

3 years ago

0.0.0

3 years ago