diff --git a/OCR/googleOCR.py b/OCR/googleOCR.py index 17653c3..9f41d18 100644 --- a/OCR/googleOCR.py +++ b/OCR/googleOCR.py @@ -198,6 +198,10 @@ def text_pointer(uri, x, y): words = [] for i, text in enumerate(texts): + + if i == 0: # 사진 내 전체 문자는 제외해야함 + continue + print(f"Image Size: {img_width} x {img_height}") word = text.description print('word:', word) @@ -217,6 +221,7 @@ def text_pointer(uri, x, y): print('hand y :', y) for vertex in text.bounding_poly.vertices : + print('vertex x :',vertex.x) print('vertex y :',vertex.y) x_set.add(vertex.x) @@ -247,8 +252,8 @@ def text_pointer(uri, x, y): print('min_x, x, max_x', min_x, x, max_x) print('max_y y', max_y, y) # print("거리 : math.sqrt((abs(x - mid_x) ** 2) + (abs(y - mid_y) ** 2))" ) - # words.append((word, math.sqrt((abs(x - mid_x) ** 2) + (abs(y - mid_y) ** 2)))) # (단어, 단어의 가운데 좌표 값과 손 좌표 간 거리) - words.append((word, abs(y - max_y) + abs(x - mid_x))) + words.append((word, math.sqrt((abs(x - mid_x) ** 2) + (abs(y - mid_y) ** 2)))) # (단어, 단어의 가운데 좌표 값과 손 좌표 간 거리) + #words.append((word, abs(y - max_y) + abs(x - mid_x))) words.sort(key=lambda x: x[1]) # 손과 가장 가까운 단어를 반환 diff --git a/OCR/handLandmark.py b/OCR/handLandmark.py index ec05245..e23b621 100644 --- a/OCR/handLandmark.py +++ b/OCR/handLandmark.py @@ -132,7 +132,7 @@ def get_finger_coordinate(uri): handYset.add(value.y) #min_x = max(handXset) - min_y = max(handYset) + min_y = min(handYset) right_hand_x_coordinate = int(detection_result.hand_landmarks[0][8].x * image_shape[1]) right_hand_y_coordinate = int(min_y * image_shape[0])