Page 971 - 3-3
P. 971
candList=[]
# 최종적인 번호판 7 자리를 넣기위한 리스트
crop3=None
iCount=0
# 번호판이 몇 번째 것 인지 체크하기 위한 변수
for i in stats:
#stats 를 1 개씩 에 대입i
startPos=(i[0],i[1])
# 사각형의 왼쪽 위 좌표
endPos=(i[0]+i[2],i[1]+i[3])
# 사각형의 오른쪽 아래 좌표
if len(stats)>=8 and (iCount is 2 or iCount is 3):
# 번호판이 8 개 이상있고, 번호판이 2 번째 3 번째라면
candList.append(i)
#candList 에 추가
else:
# 아니라면
if i[2]/i[3]<2.2 and i[4]>25:
# 비율이 2.2 보다 작은 사각형을
candList.append(i)
#candList 에 추가
iCount+=1
# 다음 번호판으로 이동
plateTxt=open("plateNum.txt",'w')
# 번호판을 저장할 txt 파일을 연다 읽기 전용으로( )
candList=sorted(candList,key=operator.itemgetter(0))
#x 좌표 기준으로 정렬
lenPlate=len(candList)
# 번호판의 길이를 구한다
if lenPlate<7:
#7 개보다 적다면
print("plate: ",lenPlate)
continue
# 다시 시도
else:
#7 개라면
candList[2][1]*=0.5
- 971 -