Astridkraft commited on
Commit
8133841
·
verified ·
1 Parent(s): 15b22c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -13
app.py CHANGED
@@ -448,22 +448,12 @@ def enhanced_composite_with_sam(original_image, inpaint_result, original_mask,
448
  black_pixels = np.sum(np.array(alpha_mask) == 0)
449
  total_pixels = white_pixels + black_pixels
450
  print(f"🔍 Alpha-Mask Statistik: Weiß={white_pixels} ({white_pixels/total_pixels*100:.1f}%), Schwarz={black_pixels} ({black_pixels/total_pixels*100:.1f}%)")
451
-
452
-
453
- #mask_rgba = mask_inverted.convert("L") # SAM-Maske als Alpha-Kanal also als Löcherfolie
454
-
455
-
456
 
457
  print(f"🔍 Alpha-Maske Werte: min={np.array(alpha_mask).min()}, max={np.array(alpha_mask).max()}")
458
  print(f"🔍 Generierte Person Alpha: {edited_rgba.getchannel('A').getextrema()}")
459
-
460
- # generiere hiermit ein neues transparantes Bild in original BBox-Größe (unsichtbare Trägerfolie)
461
- #temp_image = Image.new("RGBA", original_bbox_size, (0, 0, 0, 0))
462
- # darauf klebe ich die neu generierte Person edited_rgba und SAM-Maske als Löcher-Folie-mask_rgba
463
- #temp_image.paste(edited_rgba, (0, 0), mask_rgba)
464
-
465
- # hiermit hole ich mir den Hintergrund außerhalb der BBox zurück!
466
- #final_image.paste(temp_image, (bbox_coords[0], bbox_coords[1]), temp_image)
467
  final_image.paste(edited_rgba, (bbox_coords[0], bbox_coords[1]), edited_rgba)
468
 
469
  # Debug-Info
 
448
  black_pixels = np.sum(np.array(alpha_mask) == 0)
449
  total_pixels = white_pixels + black_pixels
450
  print(f"🔍 Alpha-Mask Statistik: Weiß={white_pixels} ({white_pixels/total_pixels*100:.1f}%), Schwarz={black_pixels} ({black_pixels/total_pixels*100:.1f}%)")
451
+
 
 
 
 
452
 
453
  print(f"🔍 Alpha-Maske Werte: min={np.array(alpha_mask).min()}, max={np.array(alpha_mask).max()}")
454
  print(f"🔍 Generierte Person Alpha: {edited_rgba.getchannel('A').getextrema()}")
455
+
456
+ # hiermit hole ich mir den Hintergrund außerhalb der BBox zurück
 
 
 
 
 
 
457
  final_image.paste(edited_rgba, (bbox_coords[0], bbox_coords[1]), edited_rgba)
458
 
459
  # Debug-Info