fix(pipeline): 스티칭 버그 3종 수정 + AI 마디번호 스탬프 제거
- [BUG1] _merge_scroll_candidates: 씬전환 가속도 조건 제거 (9→1 세그먼트) - [BUG2] merge_panoramas_list: 매칭 임계치 0.60→0.50 (파노라마 3→1 병합) - [BUG3] _detect_measure_bars: 마디선 최소간격 100px 필터 추가 (17px 오탐 제거) - remove: _stamp_measure_number 호출 제거 (AI 임의 [1][2][3] 스탬프 삭제) - add: sim_stitch.py, simulate_ocr_pipeline.py, verify_fixes.py (진단/검증 스크립트)
This commit is contained in:
@@ -548,11 +548,15 @@ def _detect_measure_bars(gray_pano: np.ndarray) -> List[int]:
|
||||
for c in bar_cols:
|
||||
if not curr: curr.append(c)
|
||||
else:
|
||||
if c - curr[-1] < 10: curr.append(c)
|
||||
# [BUG3 FIX] 클러스터 허용폭 10→30px (마디선은 보통 2~5px 폭 클러스터)
|
||||
if c - curr[-1] < 30: curr.append(c)
|
||||
else:
|
||||
measures.append(int(np.mean(curr)))
|
||||
curr = [c]
|
||||
if curr: measures.append(int(np.mean(curr)))
|
||||
# [BUG3 FIX] 100px 미만 간격 마디선 제거 (음표 기둥 오탐 방지)
|
||||
measures = [x for i, x in enumerate(measures)
|
||||
if i == 0 or x - measures[i-1] >= 100]
|
||||
return measures
|
||||
|
||||
def _stamp_measure_number(measure_bgr: np.ndarray, num: int) -> np.ndarray:
|
||||
@@ -591,8 +595,9 @@ def _merge_scroll_candidates(candidates: List[np.ndarray], min_scroll: int = 5,
|
||||
curr_frame = candidates[i]
|
||||
s_px, conf = _detect_scroll_offset(prev_frame, curr_frame, min_confidence=0.1)
|
||||
|
||||
# 씬 전환 조건: conf 폭락, 가속도>100, 노란마커 증발(>0.4)
|
||||
is_cut = (conf <= 0.15) or (abs(s_px - prev_s_px) > 100) or (prev_conf - conf > 0.4)
|
||||
# [BUG1 FIX] 씬 전환 조건: conf 기반만 사용
|
||||
# abs(s_px - prev_s_px) > 100 제거 — 스크롤 가속도를 씬전환으로 오탐하던 원인
|
||||
is_cut = (conf <= 0.15) or (prev_conf - conf > 0.4)
|
||||
|
||||
if not is_cut:
|
||||
current_segment.append(curr_frame)
|
||||
@@ -635,7 +640,8 @@ def merge_panoramas_list(panoramas):
|
||||
res = cv2.matchTemplate(s_gray, h_gray, cv2.TM_CCOEFF_NORMED)
|
||||
_, max_val, _, max_loc = cv2.minMaxLoc(res)
|
||||
|
||||
if max_val > 0.60:
|
||||
# [BUG2 FIX] 매칭 임계치 0.60 → 0.50 (반복 코러스 구간에서 0.56~0.59 스코어로 분리되던 버그)
|
||||
if max_val > 0.50:
|
||||
match_x_in_search = max_loc[0]
|
||||
absolute_match_x = current_master.shape[1] - search_w + match_x_in_search
|
||||
next_start_idx = current_master.shape[1] - absolute_match_x
|
||||
@@ -717,9 +723,6 @@ def extract_unique_scroll(frames: List[np.ndarray], threshold: float = SIMILARIT
|
||||
gray_m = _extract_print_channel(measure_img)
|
||||
bgr_m = cv2.cvtColor(gray_m, cv2.COLOR_GRAY2BGR)
|
||||
|
||||
bgr_m = _stamp_measure_number(bgr_m, global_measure_counter)
|
||||
global_measure_counter += 1
|
||||
|
||||
if current_row is None:
|
||||
current_row = bgr_m
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user