Quellcode durchsuchen

Merge branch 'dev-frontend' of liangyibo/TuKouKouClient into master

潘求垚 vor 11 Monaten
Ursprung
Commit
4141d1893a
3 geänderte Dateien mit 75 neuen und 3 gelöschten Zeilen
  1. 28 1
      electron/api/imageMatting.js
  2. 32 2
      electron/controller/imageMatting.js
  3. 15 0
      electron/controller/utils.js

+ 28 - 1
electron/api/imageMatting.js

@@ -16,5 +16,32 @@ module.exports = {
         'Content-Type':"application/json",
       }
     })
-  }
+  },
+
+
+  //ÈĘ̈ͼ
+  modelFormSegment(data){
+    return post({
+      url: '/model_form_segment',
+      data: data,
+      headers:{
+        'Content-Type':"application/json",
+      }
+    })
+  },
+
+ // ²é½ø¶È
+  searchBacthProgress(data){
+    return post({
+      url: '/search_bacth_progress',
+      data: data,
+      headers:{
+        'Content-Type':"application/json",
+      }
+    })
+  },
+
+
+
+
 }

+ 32 - 2
electron/controller/imageMatting.js

@@ -3,7 +3,7 @@
 const { Controller } = require('ee-core');
 const Log = require('ee-core/log');
 const { dialog } = require('electron');
-const { checkSelectImages,segmentImages }  = require('../api/imageMatting')
+const { checkSelectImages,segmentImages,modelFormSegment }  = require('../api/imageMatting')
 
 /**
  * example
@@ -73,9 +73,39 @@ class ImageMattingController extends Controller {
     Log.info(res.data);
     if( res.data){
       if( res.data.code === 0 && res.data.data){
+
+        console.log("params.image_type");
+        console.log(params.image_type);
+        if(params.image_type == 2){
+
+
+          let modelParams = {
+            "token": params.token,
+            "image_type":  2,  //图像类型;0非服装;1服装 2人台
+            "output_mode":  params.output_type,  //出图模式 ;0透明;1白底
+            "size_mode":  params.size, // 0=>指定大小;1=>最小边框;2原图尺寸
+            "out_width":  params.customWidth, // 宽度
+            "out_height":  params.customHeight, // 高度
+            "need_cutout_images":  res.data.data
+
+          }
+          if(modelParams.size_mode !== 0){
+            delete modelParams.out_width
+            delete modelParams.out_height
+          }
+          const img  = await  modelFormSegment(modelParams)
+
+          if(img.data){
+            return   img.data
+          }
+          return false;
+
+        }
+
+
         const img  = await  segmentImages({
           "token": params.token,
-          "image_type":  params.image_type,  //图像类型;0非服装;1服装
+          "image_type":  params.image_type,  //图像类型;0非服装;1服装 2人台
           "segment_type":  params.segment_type,  //抠图精细度;0普通;1精细
           "output_type":  params.output_type,  //出图模式 ;0透明;1白底
           "need_cutout_images":  res.data.data

+ 15 - 0
electron/controller/utils.js

@@ -4,6 +4,8 @@ const { Controller } = require('ee-core');
 const { shell  } = require('electron');
 const Log = require('ee-core/log');
 const autoUpdater = require('../addon/autoUpdater');
+const { searchBacthProgress }  = require('../api/imageMatting')
+
 
 /**
  * example
@@ -44,6 +46,19 @@ class UtilsController extends Controller {
       return
     }
   }
+
+  async checkProgress(params){
+    console.log('checkProgress')
+    const res  = await  searchBacthProgress(params)
+    console.log(res)
+    if( res.data){
+        return res.data
+    }
+
+    return false;
+
+
+  }
 }
 
 UtilsController.toString = () => '[class ExampleController]';