cycle-handtrack-driver
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -1,2 +0,5 @@ | ||
export { makePoseDetectionDriver, PoseNetParameters } from "./makePoseDetectionDriver"; | ||
export { Keypoint, Pose } from "@tensorflow-models/posenet"; | ||
declare const makeHandTrackDriver: ({ model, modelParams }?: { | ||
model?: any; | ||
modelParams?: {}; | ||
}) => (command$: any) => any; | ||
export { makeHandTrackDriver }; |
@@ -1,2 +0,60 @@ | ||
export { makePoseDetectionDriver } from "./makePoseDetectionDriver"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var xs = require("xstream").default; | ||
var handTrack = require("handtrackjs/dist/handtrack.min.js"); // copied from v0.0.13 | ||
var makeHandTrackDriver = function (_a) { | ||
var _b = _a === void 0 ? {} : _a, _c = _b.model, model = _c === void 0 ? null : _c, _d = _b.modelParams, modelParams = _d === void 0 ? {} : _d; | ||
modelParams = __assign({ flipHorizontal: true, maxNumBoxes: 2, iouThreshold: 0.5, scoreThreshold: 0.6 }, modelParams); | ||
var runDetection = function (model, video, canvas, listener) { | ||
var context = canvas.getContext("2d"); | ||
var runDetectionHelper = function () { | ||
model.detect(video).then(function (predictions) { | ||
listener.next(predictions); | ||
model.renderPredictions(predictions, canvas, context, video); | ||
requestAnimationFrame(runDetectionHelper); | ||
}); | ||
}; | ||
runDetectionHelper(); | ||
}; | ||
return function (command$) { | ||
var output$ = xs.create({ | ||
start: function (listener) { | ||
command$.addListener({ | ||
next: function (cmd) { | ||
if (cmd.type === "start") { | ||
var _a = cmd.elems, video_1 = _a[0], canvas_1 = _a[1]; | ||
handTrack.startVideo(video_1).then(function (status) { | ||
if (status) { | ||
if (!model) { | ||
handTrack.load(modelParams).then(function (model) { | ||
runDetection(model, video_1, canvas_1, listener); | ||
}); | ||
} | ||
else { | ||
runDetection(model, video_1, canvas_1, listener); | ||
} | ||
} | ||
else { | ||
listener.error("Cannot start video"); | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
}, | ||
stop: function () { } | ||
}); | ||
return output$; | ||
}; | ||
}; | ||
export { makeHandTrackDriver }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "cycle-handtrack-driver", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A Cycle.js driver for using victordibia's handtrackjs", | ||
@@ -5,0 +5,0 @@ "author": "Michael Jae-Yoon Chung", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
9
824100
12
3193