配置增加人脸识别
This commit is contained in:
@@ -224,7 +224,6 @@ public class AvController extends BaseController {
|
||||
||Constants.VIDEO_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(),false))
|
||||
||Constants.VOIP_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(),false))
|
||||
||Constants.SPEAKER_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(),false))
|
||||
||Constants.FACE_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(),false))
|
||||
){
|
||||
if(!validateAvDuration(uploadSrcFile)){
|
||||
addMessage(redirectAttributes,"exceeds_duration_limit");
|
||||
@@ -616,7 +615,55 @@ public class AvController extends BaseController {
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传图片文件,调用脚本压缩图片,返回图片保存路径
|
||||
* @param cfg
|
||||
* @param functionId
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/sample/faceToPicture"})
|
||||
public Map faceToPicture(Model model,@RequestParam("srcFile") CommonsMultipartFile[] srcFile){
|
||||
String sep = System.getProperty("file.separator");
|
||||
String random = UUID.randomUUID()+"";
|
||||
// String srcFilePath = Constants.AV_FILE_PATH+"face"+random+sep+"srcFile";//视频源文件保存路径
|
||||
String srcFilePath = StringUtils.getUserfilesBaseDir()+"face"+sep+"picFile"+sep+random+sep;//视频生成的关键帧图片文件保存路径
|
||||
|
||||
FileUtils.createDirectory(srcFilePath);
|
||||
//保存源文件
|
||||
for (CommonsMultipartFile sinFile : srcFile) {
|
||||
String srcFileAllPath = srcFilePath+sep+random+FileUtils.getSuffix(sinFile.getOriginalFilename(), true);//新的文件名
|
||||
File uploadSrcFile = new File(srcFileAllPath);
|
||||
try {
|
||||
FileCopyUtils.copy(sinFile.getBytes(), uploadSrcFile);
|
||||
} catch (IOException e) {
|
||||
logger.error(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Map map = new HashMap();
|
||||
map.put("picFilePath", srcFilePath);
|
||||
|
||||
//获取图片列表
|
||||
Collection<File> files = FileUtils.listFiles(new File(srcFilePath), null, true);
|
||||
String srcPath = null;
|
||||
for(File f:files){
|
||||
if(srcPath==null){
|
||||
srcPath = f.getName();
|
||||
}else{
|
||||
srcPath += "|"+f.getName();
|
||||
}
|
||||
}
|
||||
//将图片文件列表赋值给生成样例的源文件路径参数
|
||||
map.put("srcPath", srcPath);
|
||||
map.put("status", 1);
|
||||
map.put("msg", "success");
|
||||
|
||||
return map;
|
||||
}
|
||||
@RequestMapping(value = {"/sample/selectVedioPicture"})
|
||||
public String selectVedioPicture(Model model,HttpServletRequest request,String picFilePath,String srcPath){
|
||||
Collection<File> files = FileUtils.listFiles(new File(picFilePath), null, true);
|
||||
|
||||
Reference in New Issue
Block a user