Opencv.js how to get a frame from and past to a API od face recognition?


I have a python code to face recognition working fine. but now I am trying to implement a webpage that will capture a frame using opencv.js and them execute a ajax POST passing this frame capture to my recognition API.

My question is: are there any way in javascript to create a var frame variavel as Frame = por example and this Frame passing to my API?

I tried to get da Frame variable value and when I am debugging daesnt happend.

this is my code example

let video = document.getElementById(‘videoInput’);
let src = new cv.Mat(video.height, video.width, cv.CV_8UC4);
let dst = new cv.Mat(video.height, video.width, cv.CV_8UC1);
let cap = new cv.VideoCapture(video);

const FPS = 30;
function processVideo() {
    try {
        if (!streaming) {
            // clean and stop.
        let begin =;
        // start processing.
        Frame =; #Here I tried to get de value but doesn not set the Frame variable  
        let frameleitura = Frame 
        let delay = 1000/FPS - ( - begin);
        setTimeout(processVideo, delay);
    } catch (err) {

// schedule the first one.
setTimeout(processVideo, 0);

please try to follow the opencv.js tutorials as close as possible

(e.g. reads an image into src, and returns a bool from grab)