Computer Vision News - May 2022
12 Computer Vision Tool Moving on to the Editor view, you will find the JavaScript code that interacts with the MediaPipe tools. Changing this will allow you to modify the demo. Below, I am reporting the last part of the JS code where the user can change the range or the default values for the parameters. // Present a control panel through which the user can manipulate the solution // options. new controls .ControlPanel(controlsElement, { selfieMode: true, maxNumHands: 3, modelComplexity: 1, minDetectionConfidence: 0.5, minTrackingConfidence: 0.5 }) .add([ new controls.StaticText({title: 'MediaPipe Hands'}), fpsControl, new controls.Toggle({title: 'Selfie Mode', field: 'selfieMode'}), new controls.SourcePicker({ onFrame: async (input: controls.InputImage, size: controls.Rectangle) => { const aspect = size.height / size.width; let width: number, height: number; if (window.innerWidth > window.innerHeight) { height = window.innerHeight; width = height / aspect; } else { width = window.innerWidth; height = width * aspect; } canvasElement.width = width; canvasElement.height = height; await hands.send({image: input}); }, }), new controls.Slider({ title: 'Max Number of Hands', field: 'maxNumHands', range: [1, 4], step: 1 }),
Made with FlippingBook
RkJQdWJsaXNoZXIy NTc3NzU=