From 534ae49736839dc08372c2c8cd194e8fadda7082 Mon Sep 17 00:00:00 2001
From: HyeonSeok Sang <henry914@ajou.ac.kr>
Date: Tue, 4 Jul 2023 12:10:03 +0900
Subject: [PATCH] =?UTF-8?q?=EA=B8=B0=ED=83=80=20=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 back-end/source_code/download.json          | 11 +++--------
 back-end/source_code/modules/fileManager.py | 11 ++++++-----
 back-end/source_code/remove_background.jsx  |  4 ++--
 back-end/source_code/test.py                |  5 +----
 4 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/back-end/source_code/download.json b/back-end/source_code/download.json
index 00a7f86..9140021 100644
--- a/back-end/source_code/download.json
+++ b/back-end/source_code/download.json
@@ -3,14 +3,9 @@
     "brand": "beanpole",
     "product_list": [
         {
-            "name": "남녀공용 베이직 피케 티셔츠 - 블랙",
-            "url": "https://img.ssfshop.com/cmd/LB_750x1000/src/https://img.ssfshop.com/goods/BPBR/23/02/15/GM0023021581678_0_ORGINL_20230327140102442.jpg",
-            "type_of_clothes": "top"
-        },
-        {
-            "name": "바서티 볼드 스트라이프 럭비 티셔츠 - 블루",
-            "url": "https://img.ssfshop.com/cmd/LB_750x1000/src/https://img.ssfshop.com/goods/BPBR/23/01/19/GM0023011962271_0_ORGINL_20230214162711402.jpg",
-            "type_of_clothes": "top"
+            "name": "벨크로 샌들 - 브릭",
+            "url": "https://img.ssfshop.com/cmd/LB_750x1000/src/https://img.ssfshop.com/goods/BPBR/23/03/07/GM0023030755674_0_THNAIL_ORGINL_20230525122715725.jpg",
+            "type_of_clothes": "Shoe"
         }
     ]
 }
\ No newline at end of file
diff --git a/back-end/source_code/modules/fileManager.py b/back-end/source_code/modules/fileManager.py
index 5396d24..6f76dcb 100644
--- a/back-end/source_code/modules/fileManager.py
+++ b/back-end/source_code/modules/fileManager.py
@@ -11,7 +11,8 @@ class ImageDownloader:
             with open(image_path, 'wb') as file:
                 file.write(response.content)
             return os.path.normpath(os.path.abspath(image_path))
-
+        else:
+            print(response.status_code)
 class DocumentManager:
     def save_json_document(self, json_document, file_path):
         abs_path = os.path.abspath(file_path)
@@ -38,10 +39,10 @@ class JsonMaker:
                 "y_offset": finalImage.y_offset,
             },
             "face": {
-                "left_line_pixel": face.left + finalImage.x_offset,
-                "right_line_pixel": face.right + finalImage.x_offset,
-                "top_line_pixel": face.top + finalImage.y_offset,
-                "bottom_line_pixel": face.bottom + finalImage.y_offset,
+                "left_line_pixel": None if face.left is None else face.left + finalImage.x_offset,
+                "right_line_pixel": None if face.right is None else face.right + finalImage.x_offset,
+                "top_line_pixel": None if face.top is None else face.top + finalImage.y_offset,
+                "bottom_line_pixel": None if face.bottom is None else face.bottom + finalImage.y_offset,
             },
             "clothes": {
                 "type_of_clothes": clothes.type_of_clothes,
diff --git a/back-end/source_code/remove_background.jsx b/back-end/source_code/remove_background.jsx
index 9c30b07..5a65663 100644
--- a/back-end/source_code/remove_background.jsx
+++ b/back-end/source_code/remove_background.jsx
@@ -6,7 +6,7 @@
                 var idforceNotify = stringIDToTypeID( "forceNotify" );
                 desc349.putBoolean( idforceNotify, true );
                 var idnull = charIDToTypeID( "null" );
-                desc349.putPath( idnull, new File( "C:\\SDP\\automated_image_processing\\back-end\\source_code\\image_data\\ssfshop\\beanpole\\������� ������ ���� Ƽ���� - ����\\original.jpg" ) );
+                desc349.putPath( idnull, new File( "C:\\SDP\\automated_image_processing\\back-end\\source_code\\image_data\\ssfshop\\beanpole\\��ũ�� ���� - �긯\\original.jpg" ) );
                 var idDocI = charIDToTypeID( "DocI" );
                 desc349.putInteger( idDocI, 72 );
                 var idtemplate = stringIDToTypeID( "template" );
@@ -71,7 +71,7 @@
                 var idPNGF = charIDToTypeID( "PNGF" );
                 desc255.putObject( idAs, idPNGF, desc256 );
                 var idIn = charIDToTypeID( "In  " );
-                desc255.putPath( idIn, new File( "C:\\SDP\\automated_image_processing\\back-end\\source_code\\image_data\\ssfshop\\beanpole\\������� ������ ���� Ƽ���� - ����\\no_background.png" ) );
+                desc255.putPath( idIn, new File( "C:\\SDP\\automated_image_processing\\back-end\\source_code\\image_data\\ssfshop\\beanpole\\��ũ�� ���� - �긯\\no_background.png" ) );
                 var idDocI = charIDToTypeID( "DocI" );
                 desc255.putInteger( idDocI, 59 );
                 var idLwCs = charIDToTypeID( "LwCs" );
diff --git a/back-end/source_code/test.py b/back-end/source_code/test.py
index 9c845b0..bd4b3e4 100644
--- a/back-end/source_code/test.py
+++ b/back-end/source_code/test.py
@@ -35,7 +35,4 @@ for product in shoppingmall_data["product_list"]:
     image_path = imageDownloder.download_image(image_url, save_path, "original.jpg")
     image = imageFactory.create_image(image_path, None, image_url)
 
-    clothesDataList = clothesDetector.localize_objects(image)
-    clothes = clothesDataList.getClothes(product["type_of_clothes"])
-    clothes.denormalizeByImageSize(image)
-    boxDrower.drawBox(image, (clothes.left, clothes.top), (clothes.right, clothes.bottom), "clothes")
\ No newline at end of file
+    no_background_image_path = photoshop_.remove_background(image_path)
\ No newline at end of file
-- 
GitLab