mirror of
https://github.com/jech/galene.git
synced 2024-12-22 15:25:48 +01:00
Add predicate support to filters.
This commit is contained in:
parent
a70a9a13ed
commit
a00b77fc8f
2 changed files with 8 additions and 3 deletions
|
@ -12,7 +12,7 @@ async function loadImageSegmenter() {
|
||||||
imageSegmenter =
|
imageSegmenter =
|
||||||
await module.ImageSegmenter.createFromOptions(vision, {
|
await module.ImageSegmenter.createFromOptions(vision, {
|
||||||
baseOptions: {
|
baseOptions: {
|
||||||
modelAssetPath: '/third-party/tasks-vision/selfie_segmenter.tflite',
|
modelAssetPath: '/third-party/tasks-vision/models/selfie_segmenter.tflite',
|
||||||
},
|
},
|
||||||
outputCategoryMask: true,
|
outputCategoryMask: true,
|
||||||
outputConfidenceMasks: false,
|
outputConfidenceMasks: false,
|
||||||
|
|
|
@ -1025,6 +1025,7 @@ function cancelReconsiderParameters() {
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} filterDefinition
|
* @typedef {Object} filterDefinition
|
||||||
* @property {string} [description]
|
* @property {string} [description]
|
||||||
|
* @property {(this: filterDefinition) => Promise<boolean>} [predicate]
|
||||||
* @property {(this: Filter) => Promise<void>} [init]
|
* @property {(this: Filter) => Promise<void>} [init]
|
||||||
* @property {(this: Filter) => Promise<void>} [cleanup]
|
* @property {(this: Filter) => Promise<void>} [cleanup]
|
||||||
* @property {(this: Filter, src: HTMLVideoElement, ctx: CanvasRenderingContext2D) => Promise<boolean>} draw
|
* @property {(this: Filter, src: HTMLVideoElement, ctx: CanvasRenderingContext2D) => Promise<boolean>} draw
|
||||||
|
@ -1286,9 +1287,13 @@ let filters = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function addFilters() {
|
async function addFilters() {
|
||||||
for(let name in filters) {
|
for(let name in filters) {
|
||||||
let f = filters[name];
|
let f = filters[name];
|
||||||
|
if(f.predicate) {
|
||||||
|
if(!(await f.predicate.call(f)))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
let d = f.description || name;
|
let d = f.description || name;
|
||||||
addSelectOption(getSelectElement('filterselect'), d, name);
|
addSelectOption(getSelectElement('filterselect'), d, name);
|
||||||
}
|
}
|
||||||
|
@ -4220,7 +4225,7 @@ async function start() {
|
||||||
window.history.replaceState(null, '', window.location.pathname);
|
window.history.replaceState(null, '', window.location.pathname);
|
||||||
setTitle(groupStatus.displayName || capitalise(group));
|
setTitle(groupStatus.displayName || capitalise(group));
|
||||||
|
|
||||||
addFilters();
|
await addFilters();
|
||||||
await setMediaChoices(false);
|
await setMediaChoices(false);
|
||||||
reflectSettings();
|
reflectSettings();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue