Code

Code/Python

[Python] 다각형, 원 안의 점 확인하기

작성일자 : 22.10.29 1. Polygone in point 다각형 안에 점이 확인 문제에서 나는 넘파이로 그만한 다각형 grid map을 만들어서 채우고 비교해보면 되는거 아냐? 라고 생각했지만 shapely라고 polygone 과 geometry를 그리고 안에 점이 있는 걸 알 수 있는 라이브러리가 있다 from shapely.geometry import Point from shapely.geometry.polygon import Polygon # value x1, y1, x2, y2, x3, y3, rx, ry polyList = [(x1,y1), (x2, y2), (x3, y3)] polygon = Polygon(polyList) point = Point(rx, ry) 2. Circle in..

Code/Python

[Python] 지정 경로에 경로 존재 여부 확인

작성일자 : 23.02.06 import os # 하위 디렉토리는 생성할 수 없음 os.mkdir('./new_folder') # 디렉토리 생성 1 os.makedirs('./a/b/c', exist_ok=True) # 기존에 해당하는 폴더가 있어도 exception 에러 넘어갈 수 있음 exist_ok = True 하면 # 디렉토리 생성 2 def makedirs(path): try: os.makedirs(path) except OSError: if not os.path.isdir(path): raise path = ~/test/ makedirs(path)

Code/Python

[Pytorch] Deep learning Inference

보호되어 있는 글입니다.

capaca
'Code' 카테고리의 글 목록 (2 Page)