Skip to content

Commit

Permalink
small fixes in the Worker.ts file
Browse files Browse the repository at this point in the history
  • Loading branch information
kalwalt committed Dec 6, 2024
1 parent 7e5d992 commit 48bdfd6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 29 deletions.
9 changes: 1 addition & 8 deletions dist/src/Workers/Worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/Workers/Worker.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/webarkitCV.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
cameraView.initialize(videoSettingData).then(() => {
console.log(cameraView.getImage())
if (track.isLoaded) {
webarkit.track(track.trackers, cameraView.getImage()).then((t) => {
webarkit.track(track.trackers, cameraView.image).then((t) => {
console.log('tracker: ', t);
window.addEventListener("getMatrix", function (e) {
console.log(e.detail);
Expand Down
28 changes: 10 additions & 18 deletions src/Workers/Worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ ctx.onmessage = (e: MessageEvent<any>) => {
}
case "process": {
next = msg.imagedata;
_msg = msg;
process(msg);
}
}
Expand All @@ -39,26 +38,19 @@ const loadTrackables = (msg: any) => {

ctx.addEventListener("loaded", (e: any) => {
ocv = e.detail.CV;
//process(_msg);
markerResult = ocv.track(_msg);
ctx.postMessage(markerResult);
});

const process = (msg: any) => {
// markerResult = null;
console.log(ocv);
markerResult = null;
if (ocv && ocv.track) {

if (ocv && ocv.track) {
console.log(ocv);

markerResult = ocv.track(msg);
}
console.log(markerResult);
markerResult = ocv.track(msg);
}

if (markerResult != null) {
ctx.postMessage(markerResult);
} else {
ctx.postMessage({ type: "not found" });
}
next = <ImageData>(<unknown>null);
if (markerResult != null) {
ctx.postMessage(markerResult);
} else {
ctx.postMessage({type: "not found"});
}
next = <ImageData>(<unknown>null);
};

0 comments on commit 48bdfd6

Please sign in to comment.