본문 바로가기
728x90
반응형

Python286

[Ex] PyAutoGUI - 마우스 이동 및 클릭 1-1. 실행 전 준비Windows 탐색기 또는 macOS Finder를 open해당 창 안에 다음 아이템들을 준비:왼쪽에 작은 텍스트 파일 하나 (예: test.txt)오른쪽에 폴더 하나 (예: target_folder)아이콘 보기 모드는 “아이콘 보기” 또는 “정렬 해제” 등으로 설정해서 위치를 자유롭게 조정.pyautogui.mouseInfo() 또는 pyautogui.position()으로 각 아이콘 중심 좌표를 측정.예: file_x = 400, file_y = 300, folder_x = 700, folder_y = 3001-2. 실습 코드: “파일을 폴더로 드래그하여 옮기기”import pyautoguiimport timeimport pynput# 앞서 "실행 전 준비"에서 측정한 좌표를 여.. 2025. 7. 14.
[Ex] Input_Recoder and Replayer record_user_input_full.py"""마우스와 키보드 입력을 실시간으로 기록하여 JSON 파일로 저장하는 프로그램핵심 특징:- 이벤트 후처리 방식으로 100% 정확한 드래그 감지- mouse_down과 mouse_up 사이의 모든 move 이벤트를 drag로 변경- 적절한 필터링으로 용량과 정확도의 균형 유지- 정확한 시작 키 검증 (소문자 's'만 인식)작동 원리:1. 녹화 중에는 모든 마우스 이동을 'move' 이벤트로 기록2. 저장 전에 이벤트 목록을 분석하여 드래그 구간을 찾음3. mouse_down과 mouse_up 사이의 모든 move를 drag로 변경4. 최종 처리된 이벤트를 JSON 파일로 저장사용법:1. 프로그램 실행2. 's' 키를 눌러 녹화 시작3. 3초 후 자동으로 녹화.. 2025. 7. 14.
pyautogui 기본 사용법 1. PyAutoGUI란?PyAutoGUI는마우스 이동 및 클릭,Keyboard 입력,스크린 캡처 및 단순한 화면 인식 등 다양한 기능을 제공하여반복적인 컴퓨터 작업을 자동화할 수 있는 Python 기반의 강력한 Automation Library임공식 documentation Url: https://pyautogui.readthedocs.io/en/latest/index.html 참고로, macOS나 Linux에 비해 Windows에서 보다 유용한 기능이 먼저 나오는 편임.pyautogui.getActiveWindow()와 같이현재 활성화된 windows의 위치를 얻어오는 기능이 2025.07 현재 Windows에만 가능함.정확히는 Win32Window 객체를 얻어와서 이 객체로부터 위치 및 title .. 2025. 7. 14.
[Py] String Interning Intern(인터닝)은 Python에서 문자열 최적화 기법의 하나로서,동일한 문자열을 메모리에 한 번만 저장하고 여러 변수가 같은 객체를 참조하도록 하는 기법을 가리킴.# Normal case (not interned)a = "hello world"b = "hello world"print(a is b) # False (different objects)print(id(a), id(b)) # Different memory addresses# Interned casea = "hello" # Automatically internedb = "hello"print(a is b) # True (same object)print(id(a), id(b)) # Same memory address 더보기Intern은.. 2025. 7. 7.
cv.undistort()와 cv.initUndistortRectifyMap() + cv.remap() OpenCV는cv.calibrateCamera() 를 통해 얻은camera matrix와 distortion coefficients를 이용하여undistorted image를 생성하는 방법으로다음 2가지를 지원함:cv.undistort()cv.initUndistortRectifyMap() + cv.remap()관련 gist URLhttps://gist.github.com/dsaint31x/5c5dfe8e2a57bd6ffe8560d6a2f3b86b dip_camera_calibration.ipynbdip_camera_calibration.ipynb. GitHub Gist: instantly share code, notes, and snippets.gist.github.com보정하는 distortion들ht.. 2025. 7. 4.
cv.getOptimalNewCameraMatrix() 관련 공식 문서OpenCV 공식 튜토리얼:https://docs.opencv.org/4.x/dc/dbb/tutorial_py_calibration.html OpenCV: Camera CalibrationGoal In this section, we will learn about types of distortion caused by cameras how to find the intrinsic and extrinsic properties of a camera how to undistort images based off these properties Basics Some pinhole cameras introduce significant distortion tdocs.opencv.org OpenCV API 문서.. 2025. 7. 4.
728x90
반응형