parokshsaxena commited on
Commit
d3da15b
β€’
1 Parent(s): 658ee20

doing color transfer before changing garment

Browse files
Files changed (2) hide show
  1. app.py +3 -0
  2. src/background_processor.py +1 -1
app.py CHANGED
@@ -154,6 +154,9 @@ def start_tryon(human_img_dict,garm_img,garment_des, background_img, is_checked,
154
  #human_img_orig = human_img_dict["background"].convert("RGB") # ImageEditor
155
  human_img_orig = human_img_dict.convert("RGB") # Image
156
 
 
 
 
157
  """
158
  # Derive HEIGHT & WIDTH such that width is not more than 1000. This will cater to both Shein images (4160x6240) of 3:4 AR and model standard images ( 768x1024 ) of 2:3 AR
159
  WIDTH, HEIGHT = human_img_orig.size
 
154
  #human_img_orig = human_img_dict["background"].convert("RGB") # ImageEditor
155
  human_img_orig = human_img_dict.convert("RGB") # Image
156
 
157
+ if background_img:
158
+ human_img_orig = BackgroundProcessor.color_transfer(human_img_orig, background_img)
159
+
160
  """
161
  # Derive HEIGHT & WIDTH such that width is not more than 1000. This will cater to both Shein images (4160x6240) of 3:4 AR and model standard images ( 768x1024 ) of 2:3 AR
162
  WIDTH, HEIGHT = human_img_orig.size
src/background_processor.py CHANGED
@@ -196,7 +196,7 @@ class BackgroundProcessor:
196
  #background_image_pil = background_image_pil.resize((width, height))
197
 
198
  # Do color transfer of background to foreground to adjust lighting condition
199
- foreground_img_pil = cls.color_transfer(foreground_img_pil, background_image_pil)
200
 
201
  foreground_binary = ImageFormatConvertor.pil_image_to_binary_data(foreground_img_pil)
202
  background_binary = ImageFormatConvertor.pil_image_to_binary_data(background_image_pil)
 
196
  #background_image_pil = background_image_pil.resize((width, height))
197
 
198
  # Do color transfer of background to foreground to adjust lighting condition
199
+ #foreground_img_pil = cls.color_transfer(foreground_img_pil, background_image_pil)
200
 
201
  foreground_binary = ImageFormatConvertor.pil_image_to_binary_data(foreground_img_pil)
202
  background_binary = ImageFormatConvertor.pil_image_to_binary_data(background_image_pil)