Skip to content

Commit

Permalink
분류된 이미지 보여주기
Browse files Browse the repository at this point in the history
  • Loading branch information
bamcasa committed Nov 8, 2020
1 parent 13b5362 commit a9fdcb7
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions show.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import cv2
import os
import numpy as np


base = np.zeros((300, 2000, 3), dtype= np.uint8)
base[:] = 255 #배열 생성부터 값 넣는 방법을 몰라서....

ja = ["ㄱ","ㄴ", "ㄷ", "ㄹ", "ㅁ", "ㅂ", "ㅅ", 'ㅇ', "ㅈ", "ㅊ", "ㅋ", "ㅌ", "ㅍ", "ㅎ", "ㄲ", "ㄸ", "ㅃ", "ㅆ", "ㅉ"]
mo = ["ㅏ", 'ㅑ', 'ㅓ', 'ㅕ', 'ㅗ', 'ㅛ', 'ㅜ', 'ㅠ', 'ㅡ', 'ㅣ', 'ㅐ', 'ㅒ', 'ㅔ', 'ㅖ', 'ㅘ', 'ㅙ', 'ㅚ', 'ㅝ', 'ㅞ', 'ㅟ', 'ㅢ']

x = 0
y = 0

for ja_dir in ja:
if os.path.isdir(f"Classified_image/{ja_dir}"):
path, dirs, files = next(os.walk(f"Classified_image/{ja_dir}"))
#print(f'Classified_image/{ja_dir}/{files[1]}')
ff = np.fromfile(f'Classified_image/{ja_dir}/{files[1]}', np.uint8)
img = cv2.imdecode(ff, cv2.IMREAD_UNCHANGED)
height, width, channel = img.shape
base[y:y+height,x:x+width] = img
x = x + width + 10
else:
print(ja_dir,"이 없음")
x = x + width + 10
y = y + height + 10
x = 0
for mo_dir in mo:
if os.path.isdir(f"Classified_image/{mo_dir}"):
path, dirs, files = next(os.walk(f"Classified_image/{mo_dir}"))
#print(f'Classified_image/{mo_dir}/{files[1]}')
ff = np.fromfile(f'Classified_image/{mo_dir}/{files[1]}', np.uint8)
img = cv2.imdecode(ff, cv2.IMREAD_UNCHANGED)
height, width, channel = img.shape
base[y:y + height, x:x + width] = img
x = x + width + 10
else:
print(mo_dir, "이 없음")
x = x + width + 10

cv2.imshow("img",base)
cv2.waitKey(0)
cv2.destroyAllWindows()

0 comments on commit a9fdcb7

Please sign in to comment.