본문 바로가기

PY(Python Image Processing)

(43)
hand detect & handling cube image - opencv python mediapipe pygame PyOpenGL PyOpenGL_accelerate numpy / two hands & icosahedron_vertices & fist-stop, palm-rotation import cv2import mediapipe as mpimport numpy as npimport pygamefrom pygame.locals import *from OpenGL.GL import *from OpenGL.GLU import *import mathimport random# MediaPipe 손 검출 초기화mp_hands = mp.solutions.handshands = mp_hands.Hands(static_image_mode=False, max_num_hands=2, min_detection_confidence=0.5)# OpenGL 텍스처 ID 저장texture_id = None# 3D 큐브 데이터vertices = [    [-0.5, -0.5, -0.5], [0.5, -0.5, ..
hand detect & handling cube image - opencv python mediapipe pygame PyOpenGL PyOpenGL_accelerate numpy / one hand & icosahedron_vertices import cv2import mediapipe as mpimport numpy as npimport pygamefrom pygame.locals import *from OpenGL.GL import *from OpenGL.GLU import *import mathimport random# MediaPipe 손 검출 초기화mp_hands = mp.solutions.handshands = mp_hands.Hands(static_image_mode=False, max_num_hands=1, min_detection_confidence=0.5)# OpenGL 텍스처 ID 저장texture_id = None# 3D 큐브 데이터vertices = [    [-0.5, -0.5, -0.5], [0.5, -0.5, ..
hand detect & handling cube image - opencv python mediapipe pygame PyOpenGL PyOpenGL_accelerate numpy import cv2import mediapipe as mpimport numpy as npimport pygamefrom pygame.locals import *from OpenGL.GL import *from OpenGL.GLU import *import mathimport random# MediaPipe 손 검출 초기화mp_hands = mp.solutions.handshands = mp_hands.Hands(static_image_mode=False, max_num_hands=1, min_detection_confidence=0.5)# OpenGL 텍스처 ID 저장texture_id = None# 3D 큐브 데이터vertices = [    [-0.5, -0.5, -0.5], [0.5, -0.5, ..
AR 기능 구현 - python opencv pygame opengl import cv2import numpy as npimport pygamefrom pygame.locals import *from OpenGL.GL import *from OpenGL.GLU import *# 3D 큐브 정점vertices = [    [-1, -1, -1], [1, -1, -1], [1, 1, -1], [-1, 1, -1],    [-1, -1, 1], [1, -1, 1], [1, 1, 1], [-1, 1, 1]]edges = [    (0, 1), (1, 2), (2, 3), (3, 0),    (4, 5), (5, 6), (6, 7), (7, 4),    (0, 4), (1, 5), (2, 6), (3, 7)]# OpenGL 텍스처 ID 저장texture_id = Nonedef in..
optical flow - python, opencv 추상화 및 디자인패턴 적용 - 화살표 방향 수정 import cv2import numpy as npimport tracebackfrom abc import ABC, abstractmethod# ---------------------------# 추상 클래스: 객체 검출# ---------------------------# **디자인 패턴**: 템플릿 메서드 패턴# ObjectDetector는 객체 검출 알고리즘의 공통 인터페이스를 정의하며,# 세부 구현은 하위 클래스에서 수행하도록 설계되었습니다.class ObjectDetector(ABC):    @abstractmethod    def detect_objects(self, frame):        pass# ---------------------------# YOLO 기반 객체 검출 구현# ---..
optical flow - python, opencv 추상화 및 디자인패턴 적용 import cv2import numpy as npimport tracebackfrom abc import ABC, abstractmethod# ---------------------------# 추상 클래스: 객체 검출# ---------------------------# **디자인 패턴**: 템플릿 메서드 패턴# ObjectDetector는 객체 검출 알고리즘의 공통 인터페이스를 정의하며, # 세부 구현은 하위 클래스에서 수행하도록 설계되었습니다.class ObjectDetector(ABC):    @abstractmethod    def detect_objects(self, frame):        pass# ---------------------------# YOLO 기반 객체 검출 구현# --..
optical flow - python, opencv, 추상화 클래스 추가 구현 from abc import ABC, abstractmethod # type: ignoreimport cv2import numpy as np# ---------------------------# 추상 클래스: 객체 검출# ---------------------------class ObjectDetector(ABC):    @abstractmethod    def detect_objects(self, frame):        pass# ---------------------------# YOLO 기반 객체 검출 구현# ---------------------------class YOLOProcessor(ObjectDetector):    def __init__(self, config_path, weight..
optical flow - opencv & python import cv2import numpy as np# YOLO 설정yolo_config = 'D:\\yolov4-tiny.cfg'yolo_weights = 'D:\\yolov4-tiny.weights'yolo_classes = 'D:\\coco.names'with open(yolo_classes, 'r') as f:    classes = [line.strip() for line in f.readlines()]net = cv2.dnn.readNet(yolo_weights, yolo_config)net.setPreferableBackend(cv2.dnn.DNN_BACKEND_OPENCV)net.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)# 동영상 파일 경로video_pat..