|
@@ -0,0 +1,53 @@
|
|
|
+package com.fdkankan.modeling.service.impl;
|
|
|
+
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.fdkankan.common.util.CmdUtils;
|
|
|
+import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
+import com.fdkankan.model.utils.ComputerUtil;
|
|
|
+import com.fdkankan.model.utils.CreateObjUtil;
|
|
|
+import com.fdkankan.modeling.service.IAiService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.io.File;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Service
|
|
|
+public class AiServiceImpl implements IAiService {
|
|
|
+
|
|
|
+ public final static String PANO_DETECT = "bash /home/ubuntu/bin/PotreeConverter.sh pano_detect %s %s";
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void detectScenePano(String path) {
|
|
|
+ try {
|
|
|
+ String resultsPath = path + File.separator + "results" + File.separator;
|
|
|
+ String highPath = resultsPath + "high" + File.separator;
|
|
|
+ String aiWorkPath = highPath + "ai" + File.separator;
|
|
|
+ FileUtil.mkdir(aiWorkPath);
|
|
|
+ List<File> files = FileUtil.loopFiles(highPath);
|
|
|
+ if(CollUtil.isEmpty(files)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (File file : files) {
|
|
|
+ String absolutePath = file.getAbsolutePath();
|
|
|
+ try {
|
|
|
+ String name = FileUtil.getName(absolutePath);
|
|
|
+ String prefix = FileUtil.getPrefix(name);
|
|
|
+ String outPath = aiWorkPath + prefix + File.separator;
|
|
|
+ FileUtil.mkdir(outPath);
|
|
|
+ String detectPath = outPath + "detect.json";
|
|
|
+ String cmd = String.format(PANO_DETECT, absolutePath, detectPath);
|
|
|
+ CmdUtils.callLine(cmd, 50);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("ai识别报错,inPath:{}", absolutePath, e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("ai识别报错", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|