我正致力于一个面对面的承认项目,该项目将基因(镜子)发送到录像中。 然而,我找不到把当地储存送到弗拉斯克的正确途径。 没有人会提出一些建议,说明我如何用地方储存来改变网络运动?
The python visit_taker.py which contained the gen_frame methods:
`def gen_frame(): cap = cv2.VideoCapture(0) # This is what I want to change using localstorage face_recognizer = Face_Recognizer()
while True:
success, frame = cap.read()
if not success:
break
face_recognizer.process(frame)
ret, buffer = cv2.imencode( .jpg , frame)
frame = buffer.tobytes()
yield (b --frame
b Content-Type: image/jpeg
+ frame + b
)`
这里是《 j法》:
`window.addEventListener("DOMContentLoaded", function () { var webcamSelect = document.getElementById("webcamSelect");
webcamSelect.addEventListener("change", function () {
var selectedWebcamIndex = webcamSelect.selectedIndex;
localStorage.setItem("selectedWebcamIndex", selectedWebcamIndex);
});
navigator.mediaDevices
.enumerateDevices()
.then((devices) => {
var videoDevices = devices.filter(
(device) => device.kind === "videoinput",
);
videoDevices.forEach((device, index) => {
var option = document.createElement("option");
option.value = index;
option.text = device.label || `Webcam ${index + 1}`;
webcamSelect.appendChild(option);
});
var selectedWebcamIndex = localStorage.getItem(
"selectedWebcamIndex",
);
if (selectedWebcamIndex) {
webcamSelect.selectedIndex = selectedWebcamIndex;
}
})
.catch((error) => {
console.error("Error enumerating devices:", error);
});
}); ` app.py:
@app.route(/video_feed ) def视频_feed():回报反应(gen_frame()、米梅类=多部分/x-ixed-replace;边界=frame
我利用 j子进行审判,但没有工作。