【发布时间】:2022-08-17 19:27:33
【问题描述】:
我正在尝试在 Nodejs 项目中运行 python 脚本。在我的 python 脚本中传递本地视频 URL 时一切正常,但我需要从我的 MongoDB 中检索视频 URL 并将其传递给 python 脚本。有没有办法我可以做到这一点?我进行了一些研究,但找不到解决此问题的方法。
app.get(\'/test\', callName);
function callName(req, res) {
PythonShell.run(\'ai_part/test.py\', null, function (err) {
if (err) throw err;
console.log(\'finished\');
});
}
Python代码:
#Loading the video input
cap = cv2.VideoCapture(\'test.wmv\')
_, img = cap.read()
height, width, _ = img.shape
copy = img.copy()
不知道够不够清楚,但是我需要将从我的mongo数据库获取的视频URL传入python函数\'VideoCapture(url)\'。提前致谢!