본문 바로가기
  • Tried. Failed. Logged.
728x90

opencv6

OpenCV - 파이썬 cv2 이미지 속에 특정 이미지 감지하기 def isExistImage(a, b, c=0.65): print("이미지 존재 여부") img_rgb = cv2.imread(a) template = cv2.imread(b) h, w = template.shape[:-1] res = cv2.matchTemplate(img_rgb, template, cv2.TM_CCOEFF_NORMED) threshold = c loc = np.where(res >= threshold) return len( loc[0] ) != 0 print(isExistImage("screen.png", "target.png")) # True or False def getMatchPosition(a, b, c=0.65): print("이미지 위치 가져오기") img_rgb = cv.. 2023. 1. 16.
OpenCV - pyinstaller 빌드 후 cv2가 improt 안되는 오류 해결 pip install opencv-python==4.5.3.56 다운그레이드가 답이다. 출처: https://stackoverflow.com/questions/69855356/recursion-is-detected-during-loading-of-cv2-binary-extensions recursion is detected during loading of "cv2" binary extensions I have a small program which return opencv error after compilation by pyinstaller. But without compilation it's work! I use Python 3.8.10 on Windows 10 Program: import pyauto.. 2022. 6. 27.
OpenCV - 커스텀 Cascade 만들기(CASCADE TRAINER GUI) 및 물체 탐지 아래 링크에서 Cascade Trainer GUI를 자신의 컴퓨터 환경에 맞는 버전으로 설치(64비트가 32비트 버전으로 설치하면 중간에 오류가 생김) https://amin-ahmadi.com/cascade-trainer-gui/ Cascade Trainer GUI - Amin Cascade Trainer GUI 1. Introduction Cascade Trainer GUI is a program that can be used to train, test and improve cascade classifier models. It uses a graphical interface to set the parameters and make it easy to use OpenCV tools for training.. 2022. 5. 19.
OpenCV - 캡챠 문자 검출하기 import cv2 import numpy as numpy import matplotlib.pyplot as plt img = cv2.imread('./characters.PNG') img = cv2.blur(img, (10, 10), anchor=(-1, -1), borderType=cv2.BORDER_DEFAULT) # 블러처리(떨어진 조각을 붙이기) img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # 회색 전환 img_gray = 255 - img_gray # 이미지 반전 res, thr = cv2.threshold(img_gray, 90, 255, cv2.THRESH_BINARY) # 이진화 cv2.imshow('gray', thr) contours, hie.. 2022. 5. 18.
OpenCV - 파이썬 웹캠 눈, 얼굴 인식 import cv2 face_cascade_filename = 'haarcascade_frontalface_default.xml' face_cascasde = cv2.CascadeClassifier( cv2.data.haarcascades + face_cascade_filename) eye_cascade_filename = 'haarcascade_eye.xml' eye_cascade = cv2.CascadeClassifier( cv2.data.haarcascades + eye_cascade_filename) capture = cv2.VideoCapture(0) while cv2.waitKey(33) < 0: ret, frame = capture.read() faces = face_cascasde.dete.. 2022. 2. 2.
OpenCV - 파이썬 웹캠 얼굴 인식 import cv2 cascade_filename = 'haarcascade_frontalface_default.xml' cascasde = cv2.CascadeClassifier( cv2.data.haarcascades + cascade_filename) capture = cv2.VideoCapture(0) while cv2.waitKey(33) < 0: ret, frame = capture.read() faces = cascasde.detectMultiScale(frame, 1.3, 5) for (x, y, w, h) in faces: cv2.rectangle(frame, (x,y), (x + w, y + h), (255,0,0), 2) cv2.imshow('frame', frame) capture... 2022. 2. 2.
728x90