Page 968 - 3-3
P. 968
# 사각형 오른쪽 모서리의 좌표
if i[2]/i[3]<0.9:
# 사각형의 비율이 0.9 미만인 사각형을 찾는다
candList.append(i)
# 그 사각형을 candList 에 추가한다
candList=sorted(candList,key=operator.itemgetter(0))
# 사각형들을 x 좌표 기준으로 정렬한다
candList.reverse()
# 배열의 순서를 뒤집는다
plateList=[]
# 찾아낸 번호판들을 저장하기위한 변수 선언
currentList=[]
# 임시로 찾아낸 사각형을 저장하기위한 변수 선언
neiCount=0
# 이웃 사각형의 수 계산에 사용될 변수 선언
for fir in candList:
#candList 를 1 개씩 fir 에 넣는다
plateList=[]
#plateList 초기화
neiList=[]
#neiList 초기화
currentList=fir
#fir 를 현재 리스트로 설정
plateList.append(currentList)
#currentList 를 plateList 에 대입
for sec in candList:
#candList 를 1 개씩 sec 변수에 넣는다
neiList=sec
#neiList 에 sec 를 넣는다
if currentList is neiList:continue
# 현재와 이웃 리스트 노드 가 같다면 비교하지 않고 패스( )
if (abs(currentList[3]-neiList[3])<0.2*currentList[2])and\
(currentList[0]-(neiList[0]+neiList[2])<0.2*currentList[1])and\
(currentList[0]>=neiList[0]):
# 과학지의 알고리즘대로 비교한다
flag=True
#flag 를 True 로 설정
for plate in plateList:
#plateList 를 1 개씩 plate 에 넣는다
- 968 -