Skip to content

QuicheSama/coco-maskapi

Repository files navigation

coco-maskapi

An unofficial TypeScript port of Coco API's maskApi.c (reference).

Context

Coco API uses a modified version of Run Length Encoding (RLE) to efficiently store image masks. RLE data is further compressed via a modified version of LEB128 (which can be inuitively considered LEB32).

coco-maskapi aims to bring this flavor of mask compression/encoding to web browsers, favoring Canvas ImageData as the data source and target.

maskApi.c Support Parity Status

Function Status
rleEncode 🧑‍🏭 WIP
rleDecode 🧑‍🏭 WIP
rleMerge 🗒️ TODO
rleArea 🗒️ TODO
rleNMS 🗒️ TODO (?)
bbIou 🗒️ TODO
bbNms 🗒️ TODO (?)
rleToBbox 🗒️ TODO
rleFrBbox 🗒️ TODO
uintCompare 🗒️ TODO
rleFrPoly 🗒️ TODO
rleToString 🧑‍🏭 WIP
rleFrString 🧑‍🏭 WIP

Development

pnpm install
pnpm dev

Endpoints

  • /, base example
  • /worst, worst case experimentation