
black washer 3d model
import numpy as np from PIL import Image, ImageFilter from scipy import ndimage import trimesh, os src = "/mnt/data/a_clean_high_resolution_centered_isolated_vecto.png" im = Image.open(src).convert("RGB") a = np.asarray(im) # Recadrer pour obtenir le badge ; conserver l'œillet intégré et le corps circulaire entier. crop = im.crop((45, 0, 1215, 1215)) W = 300 H = int(round(crop.height * W / crop.width)) small = crop.resize((W, H), Image.Resampling.LANCZOS) rgb = np.asarray(small).astype(np.float32) gray = rgb.mean(axis=2) / 255.0 # Séparer le badge foncé du fond blanc ; le centre blanc de l'œillet reste un trou. masque = gris < 0,88 masque = ndimage.binary_fill_holes(masque) # Restaure explicitement le trou de l'œillet, centré par rapport à l'image de référence. # Approxime sa position par rapport au recadrage. trou_cx = int((623-45) * L / 1170) trou_cy = int((100-0) * H / 1215) Y, X = np.ogrid[:H, :L] masque &= ((X-trou_cx)**2 + (Y-trou_cy)**2) > (int(43*L/1170))**2 masque = ndimage.binary_closing(masque, itérations=2) mas
4K·PBR·Tripo H3.1