feat: Integrated Stream asset and Kai animation system
This commit is contained in:
42
scripts/process_pipe_stream.py
Normal file
42
scripts/process_pipe_stream.py
Normal file
@@ -0,0 +1,42 @@
|
||||
import cv2
|
||||
import numpy as np
|
||||
import os
|
||||
import shutil
|
||||
|
||||
def process_pipe_stream():
|
||||
src_path = '/Users/davidkotnik/.gemini/antigravity/brain/07019d04-a214-43ab-9565-86f4e8f17e5b/uploaded_media_1769607894587.jpg'
|
||||
|
||||
print(f"Loading {src_path}")
|
||||
img = cv2.imread(src_path)
|
||||
if img is None:
|
||||
print("Failed to load image")
|
||||
return
|
||||
|
||||
# BG Removal
|
||||
img = cv2.cvtColor(img, cv2.COLOR_BGR2BGRA)
|
||||
|
||||
# Sample top-left for BG color (looks like light gray)
|
||||
bg_color = img[0,0][:3]
|
||||
print(f"BG Color: {bg_color}")
|
||||
|
||||
tol = 30
|
||||
lower = np.clip(bg_color - tol, 0, 255)
|
||||
upper = np.clip(bg_color + tol, 0, 255)
|
||||
mask = cv2.inRange(img[:,:,:3], lower, upper)
|
||||
img[mask > 0, 3] = 0
|
||||
|
||||
# Save
|
||||
dest_name = 'stream_pipe.png'
|
||||
targets = [
|
||||
'/Users/davidkotnik/repos/novafarma/main/assets',
|
||||
'/Users/davidkotnik/repos/novafarma/assets/DEMO_FAZA1/Environment'
|
||||
]
|
||||
|
||||
for t in targets:
|
||||
if not os.path.exists(t): os.makedirs(t, exist_ok=True)
|
||||
final_path = os.path.join(t, dest_name)
|
||||
cv2.imwrite(final_path, img)
|
||||
print(f"Saved to {final_path}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
process_pipe_stream()
|
||||
Reference in New Issue
Block a user