All Projects → Secretmapper → React Image Annotation

Secretmapper / React Image Annotation

Licence: mit
An infinitely customizable image annotation library built on React

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Image Annotation

dart sealed
Dart and Flutter sealed class generator and annotations, with match methods and other utilities. There is also super_enum compatible API.
Stars: ✭ 16 (-92.12%)
Mutual labels:  annotation, annotations
spectree
API spec validator and OpenAPI document generator for Python web frameworks.
Stars: ✭ 190 (-6.4%)
Mutual labels:  annotation, annotations
aptk
A toolkit project to enable you to build annotation processors more easily
Stars: ✭ 28 (-86.21%)
Mutual labels:  annotation, annotations
annotate
Create 3D labelled bounding boxes in RViz
Stars: ✭ 104 (-48.77%)
Mutual labels:  annotation, annotations
Breadcast
Small Broadcast Receiver Library for Android
Stars: ✭ 15 (-92.61%)
Mutual labels:  annotations, annotation
AnnotationProcessing
✔️ㅤ[ARTICLE] Writing your own Annotation Processors in Android
Stars: ✭ 47 (-76.85%)
Mutual labels:  annotation, annotations
AnnotationProcessorStarter
Project to set up basics of a Java annotation processor
Stars: ✭ 19 (-90.64%)
Mutual labels:  annotation, annotations
Memex
Browser Extension to full-text search your browsing history & bookmarks.
Stars: ✭ 3,344 (+1547.29%)
Mutual labels:  annotations, annotation
Label Studio
Label Studio is a multi-type data labeling and annotation tool with standardized output format
Stars: ✭ 7,264 (+3478.33%)
Mutual labels:  annotations, annotation
Cvat
Powerful and efficient Computer Vision Annotation Tool (CVAT)
Stars: ✭ 6,557 (+3130.05%)
Mutual labels:  annotations, annotation
Router
🍭灵活的组件化路由框架.
Stars: ✭ 1,502 (+639.9%)
Mutual labels:  annotations, annotation
Nova
NOVA is a tool for annotating and analyzing behaviours in social interactions. It supports Annotators using Machine Learning already during the coding process. Further it features both, discrete labels and continuous scores and a visuzalization of streams recorded with the SSI Framework.
Stars: ✭ 110 (-45.81%)
Mutual labels:  annotations, annotation
Http Router
🎉 Release 2.0 is released! Very fast HTTP router for PHP 7.1+ (incl. PHP8 with attributes) based on PSR-7 and PSR-15 with support for annotations and OpenApi (Swagger)
Stars: ✭ 124 (-38.92%)
Mutual labels:  annotations, annotation
Sequelize Typescript
Decorators and some other features for sequelize
Stars: ✭ 2,200 (+983.74%)
Mutual labels:  annotations
Drf Typed Views
Use type annotations to validate/deserialize request parameters in Dango REST Framework.
Stars: ✭ 181 (-10.84%)
Mutual labels:  annotations
Kili Playground
Simplest and fastest image and text annotation tool.
Stars: ✭ 166 (-18.23%)
Mutual labels:  annotation
Open Semantic Etl
Python based Open Source ETL tools for file crawling, document processing (text extraction, OCR), content analysis (Entity Extraction & Named Entity Recognition) & data enrichment (annotation) pipelines & ingestor to Solr or Elastic search index & linked data graph database
Stars: ✭ 165 (-18.72%)
Mutual labels:  annotation
Atlas
ATLAS - Three commands to start analysing your metagenome data
Stars: ✭ 187 (-7.88%)
Mutual labels:  annotation
Hover
🚤 Never spend O(n) to annotate data again. Fun and precision come free.
Stars: ✭ 183 (-9.85%)
Mutual labels:  annotation
Beanutils
BeanUtils library is a Java bean copy utility with powerful functionality and high performance.
Stars: ✭ 164 (-19.21%)
Mutual labels:  annotations

React Image Annotation

An infinitely customizable image annotation library built on React

Annotation demo

Installation

npm install --save react-image-annotation
# or
yarn add react-image-annotation

Usage

export default class Simple extends Component {
  state = {
    annotations: [],
    annotation: {}
  }

  onChange = (annotation) => {
    this.setState({ annotation })
  }

  onSubmit = (annotation) => {
    const { geometry, data } = annotation

    this.setState({
      annotation: {},
      annotations: this.state.annotations.concat({
        geometry,
        data: {
          ...data,
          id: Math.random()
        }
      })
    })
  }

  render () {
    return (
      <Root>
        <Annotation
          src={img}
          alt='Two pebbles anthropomorphized holding hands'

          annotations={this.state.annotations}

          type={this.state.type}
          value={this.state.annotation}
          onChange={this.onChange}
          onSubmit={this.onSubmit}
        />
      </Root>
    )
  }
}

Props

Prop Description Default
src Image src attribute
alt Image alt attribute
annotations Array of annotations
value Annotation object currently being created. See annotation object
onChange onChange handler for annotation object
onSubmit onSubmit handler for annotation object
type Selector type. See custom shapes RECTANGLE
allowTouch Set to true to allow the target to handle touch events. This disables one-finger scrolling false
selectors An array of selectors. See adding custom selector logic [RectangleSelector, PointSelector, OvalSelector]
activeAnnotations Array of annotations that will be passed as 'active' (active highlight and shows content)
activeAnnotationComparator Method to compare annotation and activeAnnotation item (from props.activeAnnotations). Return true if it's the annotations are equal (a, b) => a === b
disableAnnotation Set to true to disable creating of annotations (note that no callback methods will be called if this is true) false
disableSelector Set to true to not render Selector false
disableEditor Set to true to not render Editor false
disableOverlay Set to true to not render Overlay false
renderSelector Function that renders Selector Component See custom components
renderEditor Function that renders Editor Component See custom components
renderHighlight Function that renders Highlight Component See custom components
renderContent Function that renders Content See custom components
renderOverlay Function that renders Overlay See custom components
onMouseUp onMouseUp handler on annotation target
onMouseDown onMouseDown handler on annotation target
onMouseMove onMouseMove handler on annotation target
onClick onClick handler on annotation target

Annotation object

An Annotation object is an object that conforms to the object shape

({
  selection: T.object, // temporary object for selector logic
  geometry: T.shape({ // geometry data for annotation
    type: T.string.isRequired // type is used to resolve Highlighter/Selector renderer
  }),
  // auxiliary data object for application.
  // Content data can be stored here (text, image, primary key, etc.)
  data: T.object
})

Using custom components

Annotation supports renderProps for almost every internal component.

This allows you to customize everything about the the look of the annotation interface, and you can even use canvas elements for performance or more complex interaction models.

  • renderSelector - used for selecting annotation area (during annotation creation)
  • renderEditor - appears after annotation area has been selected (during annotation creation)
  • renderHighlight - used to render current annotations in the annotation interface. It is passed an object that contains the property active, which is true if the mouse is hovering over the higlight
  • renderComponent - auxiliary component that appears when mouse is hovering over the highlight. It is passed an object that contains the annotation being hovered over. { annotation }
  • renderOverlay - Component overlay for Annotation (i.e. 'Click and Drag to Annotate')

You can view the default renderProps here

Note: You cannot use :hover selectors in css for components returned by renderSelector and renderHighlight. This is due to the fact that Annotation places DOM layers on top of these components, preventing triggering of :hover

Using custom shapes

Annotation supports three shapes by default, RECTANGLE, POINT and OVAL.

You can switch the shape selector by passing the appropriate type as a property. Default shape TYPEs are accessible on their appropriate selectors:

import {
  PointSelector,
  RectangleSelector,
  OvalSelector
} from 'react-image-annotation/lib/selectors'

<Annotation
  type={PointSelector.TYPE}
/>

Adding custom selector logic

This is an Advanced Topic

The Annotation API allows support for custom shapes that use custom logic such as polygon or freehand selection. This is done by defining your own selection logic and passing it as a selector in the selectors property.

Selectors are objects that must have the following properties:

  • TYPE - string that uniquely identifies this selector (i.e. RECTANGLE)
  • intersects - method that returns true if the mouse point intersects with the annotation geometry
  • area - method that calculates and returns the area of the annotation geometry
  • methods - object that can contain various listener handlers (onMouseUp, onMouseDown, onMouseMove, onClick). These listener handlers are called when triggered in the annotation area. These handlers must be reducer-like methods - returning a new annotation object depending on the change of the method

You can view a defined RectangleSelector here

Connecting selector logic to Redux/MobX

First see Selectors

You can use Selector methods to connect these method logic to your stores. This is due to the fact that selector methods function as reducers, returning new state depending on the event.

Note that it is not necessary to connect the selector logic with redux/mobx. Connecting the annotation and annotations state is more than enough for most use cases.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].