Compare commits
6 Commits
b527fe0b28
...
6fa766a39f
Author | SHA1 | Date |
---|---|---|
|
6fa766a39f | |
|
72049f3e91 | |
|
6cb5de01f8 | |
|
0bcf340217 | |
|
994a63c546 | |
|
c1a6dc693d |
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"Source x Target Mapper": "ប្រភប x បន្ថែម Mapper",
|
||||
"select a source image": "ជ្រើសរើសប្រភពរូបភាព",
|
||||
"Preview": "បង្ហាញ",
|
||||
"select a target image or video": "ជ្រើសរើសគោលដៅរូបភាពឬវីដេអូ",
|
||||
"save image output file": "រក្សាទុកលទ្ធផលឯកសាររូបភាព",
|
||||
"save video output file": "រក្សាទុកលទ្ធផលឯកសារវីដេអូ",
|
||||
"select a target image": "ជ្រើសរើសគោលដៅរូបភាព",
|
||||
"source": "ប្រភព",
|
||||
"Select a target": "ជ្រើសរើសគោលដៅ",
|
||||
"Select a face": "ជ្រើសរើសមុខ",
|
||||
"Keep audio": "រម្លងសម្លេង",
|
||||
"Face Enhancer": "ឧបករណ៍ពង្រឹងមុខ",
|
||||
"Many faces": "ទម្រង់មុខច្រើន",
|
||||
"Show FPS": "បង្ហាញ FPS",
|
||||
"Keep fps": "រម្លង fps",
|
||||
"Keep frames": "រម្លងទម្រង់",
|
||||
"Fix Blueish Cam": "ជួសជុល Cam Blueish",
|
||||
"Mouth Mask": "របាំងមាត់",
|
||||
"Show Mouth Mask Box": "បង្ហាញប្រអប់របាំងមាត់",
|
||||
"Start": "ចាប់ផ្ដើម",
|
||||
"Live": "ផ្សាយផ្ទាល់",
|
||||
"Destroy": "លុប",
|
||||
"Map faces": "ផែនទីមុខ",
|
||||
"Processing...": "កំពុងដំណើរការ...",
|
||||
"Processing succeed!": "ការដំណើរការទទួលបានជោគជ័យ!",
|
||||
"Processing ignored!": "ការដំណើរការមិនទទួលបានជោគជ័យ!",
|
||||
"Failed to start camera": "បរាជ័យដើម្បីចាប់ផ្ដើមបើកកាមេរ៉ា",
|
||||
"Please complete pop-up or close it.": "សូមបញ្ចប់ផ្ទាំងផុស ឬបិទវា.",
|
||||
"Getting unique faces": "ការចាប់ផ្ដើមទម្រង់មុខប្លែក",
|
||||
"Please select a source image first": "សូមជ្រើសរើសប្រភពរូបភាពដំបូង",
|
||||
"No faces found in target": "រកអត់ឃើញមុខនៅក្នុងគោលដៅ",
|
||||
"Add": "បន្ថែម",
|
||||
"Clear": "សម្អាត",
|
||||
"Submit": "បញ្ចូន",
|
||||
"Select source image": "ជ្រើសរើសប្រភពរូបភាព",
|
||||
"Select target image": "ជ្រើសរើសគោលដៅរូបភាព",
|
||||
"Please provide mapping!": "សូមផ្ដល់នៅផែនទី",
|
||||
"At least 1 source with target is required!": "ត្រូវការប្រភពយ៉ាងហោចណាស់ ១ ដែលមានគោលដៅ!",
|
||||
"Face could not be detected in last upload!": "មុខមិនអាចភ្ជាប់នៅក្នុងការបង្ហេាះចុងក្រោយ!",
|
||||
"Select Camera:": "ជ្រើសរើសកាមេរ៉ា",
|
||||
"All mappings cleared!": "ផែនទីទាំងអស់ត្រូវបានសម្អាត!",
|
||||
"Mappings successfully submitted!": "ផែនទីត្រូវបានបញ្ជូនជោគជ័យ!",
|
||||
"Source x Target Mapper is already open.": "ប្រភព x Target Mapper បានបើករួចហើយ។"
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"Source x Target Mapper": "Mapeador de Origem x Destino",
|
||||
"select an source image": "Escolha uma imagem de origem",
|
||||
"Preview": "Prévia",
|
||||
"select an target image or video": "Escolha uma imagem ou vídeo de destino",
|
||||
"save image output file": "Salvar imagem final",
|
||||
"save video output file": "Salvar vídeo final",
|
||||
"select an target image": "Escolha uma imagem de destino",
|
||||
"source": "Origem",
|
||||
"Select a target": "Escolha o destino",
|
||||
"Select a face": "Escolha um rosto",
|
||||
"Keep audio": "Manter o áudio original",
|
||||
"Face Enhancer": "Melhorar rosto",
|
||||
"Many faces": "Vários rostos",
|
||||
"Show FPS": "Mostrar FPS",
|
||||
"Keep fps": "Manter FPS",
|
||||
"Keep frames": "Manter frames",
|
||||
"Fix Blueish Cam": "Corrigir tom azulado da câmera",
|
||||
"Mouth Mask": "Máscara da boca",
|
||||
"Show Mouth Mask Box": "Mostrar área da máscara da boca",
|
||||
"Start": "Começar",
|
||||
"Live": "Ao vivo",
|
||||
"Destroy": "Destruir",
|
||||
"Map faces": "Mapear rostos",
|
||||
"Processing...": "Processando...",
|
||||
"Processing succeed!": "Tudo certo!",
|
||||
"Processing ignored!": "Processamento ignorado!",
|
||||
"Failed to start camera": "Não foi possível iniciar a câmera",
|
||||
"Please complete pop-up or close it.": "Finalize ou feche o pop-up",
|
||||
"Getting unique faces": "Buscando rostos diferentes",
|
||||
"Please select a source image first": "Selecione primeiro uma imagem de origem",
|
||||
"No faces found in target": "Nenhum rosto encontrado na imagem de destino",
|
||||
"Add": "Adicionar",
|
||||
"Clear": "Limpar",
|
||||
"Submit": "Enviar",
|
||||
"Select source image": "Escolha a imagem de origem",
|
||||
"Select target image": "Escolha a imagem de destino",
|
||||
"Please provide mapping!": "Você precisa realizar o mapeamento!",
|
||||
"Atleast 1 source with target is required!": "É necessária pelo menos uma origem com um destino!",
|
||||
"At least 1 source with target is required!": "É necessária pelo menos uma origem com um destino!",
|
||||
"Face could not be detected in last upload!": "Não conseguimos detectar o rosto na última imagem!",
|
||||
"Select Camera:": "Escolher câmera:",
|
||||
"All mappings cleared!": "Todos os mapeamentos foram removidos!",
|
||||
"Mappings successfully submitted!": "Mapeamentos enviados com sucesso!",
|
||||
"Source x Target Mapper is already open.": "O Mapeador de Origem x Destino já está aberto."
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"Source x Target Mapper": "ตัวจับคู่ต้นทาง x ปลายทาง",
|
||||
"select a source image": "เลือกรูปภาพต้นฉบับ",
|
||||
"Preview": "ตัวอย่าง",
|
||||
"select a target image or video": "เลือกรูปภาพหรือวิดีโอเป้าหมาย",
|
||||
"save image output file": "บันทึกไฟล์รูปภาพ",
|
||||
"save video output file": "บันทึกไฟล์วิดีโอ",
|
||||
"select a target image": "เลือกรูปภาพเป้าหมาย",
|
||||
"source": "ต้นฉบับ",
|
||||
"Select a target": "เลือกเป้าหมาย",
|
||||
"Select a face": "เลือกใบหน้า",
|
||||
"Keep audio": "เก็บเสียง",
|
||||
"Face Enhancer": "ปรับปรุงใบหน้า",
|
||||
"Many faces": "หลายใบหน้า",
|
||||
"Show FPS": "แสดง FPS",
|
||||
"Keep fps": "คงค่า FPS",
|
||||
"Keep frames": "คงค่าเฟรม",
|
||||
"Fix Blueish Cam": "แก้ไขภาพอมฟ้าจากกล้อง",
|
||||
"Mouth Mask": "มาสก์ปาก",
|
||||
"Show Mouth Mask Box": "แสดงกรอบมาสก์ปาก",
|
||||
"Start": "เริ่ม",
|
||||
"Live": "สด",
|
||||
"Destroy": "หยุด",
|
||||
"Map faces": "จับคู่ใบหน้า",
|
||||
"Processing...": "กำลังประมวลผล...",
|
||||
"Processing succeed!": "ประมวลผลสำเร็จแล้ว!",
|
||||
"Processing ignored!": "การประมวลผลถูกละเว้น",
|
||||
"Failed to start camera": "ไม่สามารถเริ่มกล้องได้",
|
||||
"Please complete pop-up or close it.": "โปรดดำเนินการในป๊อปอัปให้เสร็จสิ้น หรือปิด",
|
||||
"Getting unique faces": "กำลังค้นหาใบหน้าที่ไม่ซ้ำกัน",
|
||||
"Please select a source image first": "โปรดเลือกภาพต้นฉบับก่อน",
|
||||
"No faces found in target": "ไม่พบใบหน้าในภาพเป้าหมาย",
|
||||
"Add": "เพิ่ม",
|
||||
"Clear": "ล้าง",
|
||||
"Submit": "ส่ง",
|
||||
"Select source image": "เลือกภาพต้นฉบับ",
|
||||
"Select target image": "เลือกภาพเป้าหมาย",
|
||||
"Please provide mapping!": "โปรดระบุการจับคู่!",
|
||||
"At least 1 source with target is required!": "ต้องมีการจับคู่ต้นฉบับกับเป้าหมายอย่างน้อย 1 คู่!",
|
||||
"Face could not be detected in last upload!": "ไม่สามารถตรวจพบใบหน้าในไฟล์อัปโหลดล่าสุด!",
|
||||
"Select Camera:": "เลือกกล้อง:",
|
||||
"All mappings cleared!": "ล้างการจับคู่ทั้งหมดแล้ว!",
|
||||
"Mappings successfully submitted!": "ส่งการจับคู่สำเร็จแล้ว!",
|
||||
"Source x Target Mapper is already open.": "ตัวจับคู่ต้นทาง x ปลายทาง เปิดอยู่แล้ว"
|
||||
}
|
|
@ -799,73 +799,39 @@ def webcam_preview(root: ctk.CTk, camera_index: int):
|
|||
|
||||
|
||||
def get_available_cameras():
|
||||
"""Returns a list of available camera names and indices."""
|
||||
"""
|
||||
Safe camera detection for macOS and Unix-like systems that avoids threading and AVX crashes.
|
||||
Returns a tuple of (camera_indices, camera_names).
|
||||
"""
|
||||
import cv2
|
||||
import platform
|
||||
|
||||
if platform.system() == "Windows":
|
||||
try:
|
||||
from pygrabber.dshow_graph import FilterGraph
|
||||
graph = FilterGraph()
|
||||
devices = graph.get_input_devices()
|
||||
|
||||
# Create list of indices and names
|
||||
camera_indices = list(range(len(devices)))
|
||||
camera_names = devices
|
||||
|
||||
# If no cameras found through DirectShow, try OpenCV fallback
|
||||
if not camera_names:
|
||||
# Try to open camera with index -1 and 0
|
||||
test_indices = [-1, 0]
|
||||
working_cameras = []
|
||||
|
||||
for idx in test_indices:
|
||||
cap = cv2.VideoCapture(idx)
|
||||
if cap.isOpened():
|
||||
working_cameras.append(f"Camera {idx}")
|
||||
cap.release()
|
||||
|
||||
if working_cameras:
|
||||
return test_indices[: len(working_cameras)], working_cameras
|
||||
|
||||
# If still no cameras found, return empty lists
|
||||
if not camera_names:
|
||||
return [], ["No cameras found"]
|
||||
|
||||
return camera_indices, camera_names
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error detecting cameras: {str(e)}")
|
||||
return [], ["No cameras found"]
|
||||
else:
|
||||
# Unix-like systems (Linux/Mac) camera detection
|
||||
camera_indices = []
|
||||
camera_names = []
|
||||
|
||||
if platform.system() == "Darwin": # macOS specific handling
|
||||
# Try to open the default FaceTime camera first
|
||||
cap = cv2.VideoCapture(0)
|
||||
if cap.isOpened():
|
||||
camera_indices.append(0)
|
||||
camera_names.append("FaceTime Camera")
|
||||
cap.release()
|
||||
|
||||
# On macOS, additional cameras typically use indices 1 and 2
|
||||
for i in [1, 2]:
|
||||
cap = cv2.VideoCapture(i)
|
||||
if cap.isOpened():
|
||||
camera_indices.append(i)
|
||||
camera_names.append(f"Camera {i}")
|
||||
cap.release()
|
||||
else:
|
||||
# Linux camera detection - test first 10 indices
|
||||
for i in range(10):
|
||||
cap = cv2.VideoCapture(i)
|
||||
if cap.isOpened():
|
||||
camera_indices.append(i)
|
||||
camera_names.append(f"Camera {i}")
|
||||
cap.release()
|
||||
|
||||
if not camera_names:
|
||||
print(f"[Camera Detection Error - Windows]: {e}")
|
||||
return [], ["No cameras found"]
|
||||
|
||||
return camera_indices, camera_names
|
||||
# macOS or Linux
|
||||
try:
|
||||
print("[Info] Safely checking for available cameras...")
|
||||
cap = cv2.VideoCapture(0)
|
||||
if cap is None or not cap.isOpened():
|
||||
print("[Warning] Default camera (index 0) not available.")
|
||||
return [], ["No cameras found"]
|
||||
cap.release()
|
||||
return [0], ["Default Camera (Index 0)"]
|
||||
except Exception as e:
|
||||
print(f"[Camera Detection Error - Unix]: {e}")
|
||||
return [], ["No cameras found"]
|
||||
|
||||
|
||||
def create_webcam_preview(camera_index: int):
|
||||
|
|
Loading…
Reference in New Issue