You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
774 B
JavaScript
40 lines
774 B
JavaScript
import { globalObjectCategory } from "./obj_cfg.js";
|
|
|
|
function autoAnnotate(world, done, alg) {
|
|
var xhr = new XMLHttpRequest();
|
|
// we defined the xhr
|
|
xhr.onreadystatechange = function () {
|
|
if (this.readyState != 4) return;
|
|
|
|
if (this.status == 200) {
|
|
let anns = JSON.parse(this.responseText);
|
|
|
|
anns.map(
|
|
(a) =>
|
|
(a.obj_type = globalObjectCategory.guess_obj_type_by_dimension(
|
|
a.psr.scale
|
|
))
|
|
);
|
|
|
|
// load annotations
|
|
world.annotation.reapplyAnnotation(anns);
|
|
|
|
if (done) done();
|
|
}
|
|
};
|
|
|
|
xhr.open(
|
|
"GET",
|
|
"/auto_annotate?" +
|
|
"scene=" +
|
|
world.frameInfo.scene +
|
|
"&frame=" +
|
|
world.frameInfo.frame,
|
|
true
|
|
);
|
|
|
|
xhr.send();
|
|
}
|
|
|
|
export { autoAnnotate };
|