본문 바로가기
728x90

Python9

[Python] strip() " 1 ".strip() ==> 1 "$$1$$".strip('$') ==> 1 공백 또는 매개변수로 전달된 문자를 제거후 리턴 2023. 11. 22.
[Python] Youtube Downloader 유투브 다운로드코드 . 다음에는 UI 를 입혀보자. from pytube import YouTube import ssl ssl._create_default_https_context = ssl._create_unverified_context video_url = 'https://www.youtube.com/watch?v=Ytwyq3xWM4U' youTube = YouTube(video_url) video = youTube.streams.filter(progressive=True, file_extension='mp4').first() vTitle = youTube.title vRating = youTube.rating vLength = youTube.length vViews = youTube.views vD.. 2023. 9. 5.
[Python] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992) 에러 파이썬 코드 작성 실행시 아래와 같은 에러 발생 대처법 아래의 코드를 상단에 삽입하여 우회 import ssl ssl._create_default_https_context = ssl._create_unverified_context 2023. 9. 5.
[OpenCV] Python - Flip Image import cv2 img = cv2.imread('panda.png', cv2.IMREAD_COLOR) # code == 0 상하 res = cv2.flip(img, 0) # code 0 좌우 cv2.imshow('panda', img) cv2.imshow('reverse', res) cv2.waitKey() cv2.destroyAllWindows() 2023. 8. 23.
[OpenCV] Python - ImageRead 프로젝트 생성시, 위와같은 샘플 코드가 같이 생성되는데, 모두 삭제한다. import cv2 기입할경우 빨간줄 나오는데, 마우스 커서를 데면 아래와 같이 설치 가능하다 import cv2 img = cv2.imread('Lenna.png', cv2.IMREAD_ANYCOLOR) cv2.imshow('Lenna', img) height, width, channel = img.shape print(height, width, channel) cv2.waitKey() cv2.destroyAllWindows() Read Flags 더보기 cv2.IMREAD_UNCHANGED : 원본 사용 cv2.IMREAD_GRAYSCALE : 1 채널, 그레이스케일 적용 cv2.IMREAD_COLOR : 3 채널, BGR 이미.. 2023. 8. 23.
[OpenCV] Python - Image read/write import cv2 import numpy as np import matplotlib.pyplot as plt img_basic = cv2.imread('Lenna.png', cv2.IMREAD_COLOR) cv2.imshow('Image Basic', img_basic) cv2.waitKey() cv2.imwrite('result1.png', img_basic) img_gray = cv2.cvtColor(img_basic, cv2.COLOR_BGR2GRAY) cv2.imshow('Image Gray', img_gray) cv2.waitKey() cv2.imwrite('result2.png', img_gray) cv2.destroyAllWindows() 2023. 8. 22.
728x90