Skip to content

Instantly share code, notes, and snippets.

@jefBinomed
Created December 3, 2020 12:52
Show Gist options
  • Save jefBinomed/79156105397732bf2f6c925a41c6c3a7 to your computer and use it in GitHub Desktop.
Save jefBinomed/79156105397732bf2f6c925a41c6c3a7 to your computer and use it in GitHub Desktop.
2020-fugu-detector-helper
class Detector {
/**
* Will create the write dectector object according to the type.
* @param type: the type of detector to use -> see constant TYPES to use the correct types
* @param options: each detector should work with specifics options that could override. Check the desire constant. Note that text detector don't need options
**/
constructor(type, options) {}
/**
* Where the magic happens ;)
* @param image: the source image or canvas where we want to detect something
* @returns a Promise with the result of the detection
**/
detect(image) {}
}
/**
* Helper function to check if the browser supports the feature
* @return true or false according to your browser support
**/
function isAvailable(type) {}
/**
* The managed types
*/
const TYPES = {
face: "face",
text: "text",
barcode: "barcode"
};
/**
* The options of face
* You can override the number of detected faces
* FastMode is to use when you want to have a quick result. The result will be less precise if fastMode is set to true
*/
const OPTIONS_FACE = {
maxDetectedFaces: 1,
fastMode: false
};
/**
* The list if BARCODE format to check. You can reduce this list if you want to speed detection process
**/
const OPTIONS_BARCODE = {
formats: [
"aztec",
"code_128",
"code_39",
"code_93",
"codabar",
"data_matrix",
"ean_13",
"ean_8",
"itf",
"pdf417",
"qr_code",
"upc_a",
"upc_e"
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment