代码拉取完成,页面将自动刷新
健康码识别(红/黄/蓝/绿)
使用场景:后台将通过收集的所有健康码图片进行批量识别后,将红马、黄码人员通知到指定人,以便后续跟踪 环境:ubuntu20 python3.9 opencv4.5 jdk8
通过Java调用脚本的传参形式实现java和python交互
class:CmdProcessUtils
/**
* 执行python脚本
* @param pythonFile
* @param url
* @return
*/
public synchronized static String invokePython(String pythonFile,String url){
if(org.apache.commons.lang3.StringUtils.isEmpty(url)){
return null;
}
try {
String pythonPath=pythonFile;
String[] args = new String[] { "python3", pythonPath, url};
Process proc = Runtime.getRuntime().exec(args);// 执行py文件
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = null;
StringBuffer buffer=new StringBuffer();
while ((line = in.readLine()) != null) {
buffer.append(line);
}
in.close();
proc.waitFor();
return buffer.toString();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
将脚本上传至服务器,直接调用,将脚本输出的json结果进行接受解析即可
String _regResult = CmdProcessUtils.invokePython("xxx/HeathCodeReg.py", localPath);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。