OCR表示安定化をバッファ方式から追跡方式(OcrTextTracker)へ置き換え#648
Merged
Conversation
Owner
Author
|
@copilot 説明とタイトルを日本語で記載して。 |
Contributor
タイトルと説明を日本語に更新しました。バッファ関連設定の削除だけでなく、OCRテキスト追跡を |
Contributor
There was a problem hiding this comment.
Pull request overview
本PRは、従来のフレームバッファ方式(OcrBufferFilter)を廃止し、OCR直後にテキスト領域を継続追跡して安定化する方式(OcrTextTracker)へ置き換えることで、OCR表示の安定性と性能を改善しつつ、不要になった設定項目・リソースを整理し、追跡品質をテストで担保する変更です(Issue #643対応)。
Changes:
OcrBufferFilterを削除し、IOcrTextTracker/OcrTextTrackerを追加して OCR 後段に追跡処理を導入- One-shot モードおよびバッファ関連パラメータ(
BufferSize,IsSuppressVibe,IsEnableRecover)を削除し、設定/UI/リソース/Designer を整理 - 追跡精度・性能特性を検証するテストプロジェクト(
WindowTranslator.Tests)を追加
Reviewed changes
Copilot reviewed 59 out of 61 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| WindowTranslator/Program.cs | IOcrTextTracker のDI登録を追加 |
| WindowTranslator/Modules/Main/MainViewModelBase.cs | OCR直後に追跡処理を挿入し、表示ONで追跡状態をリセット |
| WindowTranslator/Modules/Ocr/IOcrTextTracker.cs | 追跡処理インターフェースを新規追加 |
| WindowTranslator/Modules/Ocr/OcrTextTracker.cs | テキスト領域の1対1割当て+分割/統合/復帰を含む追跡ロジックを新規追加 |
| WindowTranslator/Modules/Ocr/OcrBufferFilter.cs | 旧バッファ方式フィルターを削除 |
| WindowTranslator/FilterPriority.cs | OcrBufferFilter の優先度定義を削除 |
| WindowTranslator/Modules/Settings/AllSettingsViewModel.cs | One-shot設定の保存/表示を削除 |
| WindowTranslator/Modules/ErrorReport/ErrorReportViewModel.cs | エラーレポート出力から One-shot 設定を削除 |
| WindowTranslator/Properties/Resources.resx | One-shot のリソースキー削除 |
| WindowTranslator/Properties/Resources.en.resx | 同上(英語) |
| WindowTranslator/Properties/Resources.ar.resx | 同上(アラビア語) |
| WindowTranslator/Properties/Resources.cs.resx | 同上(チェコ語) |
| WindowTranslator/Properties/Resources.de.resx | 同上(ドイツ語) |
| WindowTranslator/Properties/Resources.es.resx | 同上(スペイン語) |
| WindowTranslator/Properties/Resources.fa.resx | 同上(ペルシア語) |
| WindowTranslator/Properties/Resources.fil.resx | 同上(フィリピン語) |
| WindowTranslator/Properties/Resources.fr.resx | 同上(フランス語) |
| WindowTranslator/Properties/Resources.hi.resx | 同上(ヒンディー語) |
| WindowTranslator/Properties/Resources.hu.resx | 同上(ハンガリー語) |
| WindowTranslator/Properties/Resources.id.resx | 同上(インドネシア語) |
| WindowTranslator/Properties/Resources.ko.resx | 同上(韓国語) |
| WindowTranslator/Properties/Resources.ms.resx | 同上(マレー語) |
| WindowTranslator/Properties/Resources.pl.resx | 同上(ポーランド語) |
| WindowTranslator/Properties/Resources.pt-BR.resx | 同上(ポルトガル語) |
| WindowTranslator/Properties/Resources.ru.resx | 同上(ロシア語) |
| WindowTranslator/Properties/Resources.th.resx | 同上(タイ語) |
| WindowTranslator/Properties/Resources.tr.resx | 同上(トルコ語) |
| WindowTranslator/Properties/Resources.vi.resx | 同上(ベトナム語) |
| WindowTranslator/Properties/Resources.zh-CN.resx | 同上(中国語・簡体) |
| WindowTranslator/Properties/Resources.zh-TW.resx | 同上(中国語・繁体) |
| WindowTranslator/Properties/Resources.Designer.cs | One-shot のプロパティを削除し生成コードを同期 |
| WindowTranslator.Abstractions/Modules/IOcrModule.cs | BasicOcrParam からバッファ関連パラメータを削除 |
| WindowTranslator.Abstractions/UserSettings.cs | TargetSettings.IsOneShotMode を削除 |
| WindowTranslator.Abstractions/Properties/Resources.resx | バッファ関連キーを削除 |
| WindowTranslator.Abstractions/Properties/Resources.en.resx | 同上(英語) |
| WindowTranslator.Abstractions/Properties/Resources.ar.resx | 同上(アラビア語) |
| WindowTranslator.Abstractions/Properties/Resources.cs.resx | 同上(チェコ語) |
| WindowTranslator.Abstractions/Properties/Resources.de.resx | 同上(ドイツ語) |
| WindowTranslator.Abstractions/Properties/Resources.es.resx | 同上(スペイン語) |
| WindowTranslator.Abstractions/Properties/Resources.fa.resx | 同上(ペルシア語) |
| WindowTranslator.Abstractions/Properties/Resources.fil.resx | 同上(フィリピン語) |
| WindowTranslator.Abstractions/Properties/Resources.fr.resx | 同上(フランス語) |
| WindowTranslator.Abstractions/Properties/Resources.hi.resx | 同上(ヒンディー語) |
| WindowTranslator.Abstractions/Properties/Resources.hu.resx | 同上(ハンガリー語) |
| WindowTranslator.Abstractions/Properties/Resources.id.resx | 同上(インドネシア語) |
| WindowTranslator.Abstractions/Properties/Resources.ko.resx | 同上(韓国語) |
| WindowTranslator.Abstractions/Properties/Resources.ms.resx | 同上(マレー語) |
| WindowTranslator.Abstractions/Properties/Resources.pl.resx | 同上(ポーランド語) |
| WindowTranslator.Abstractions/Properties/Resources.pt-BR.resx | 同上(ポルトガル語) |
| WindowTranslator.Abstractions/Properties/Resources.ru.resx | 同上(ロシア語) |
| WindowTranslator.Abstractions/Properties/Resources.th.resx | 同上(タイ語) |
| WindowTranslator.Abstractions/Properties/Resources.tr.resx | 同上(トルコ語) |
| WindowTranslator.Abstractions/Properties/Resources.vi.resx | 同上(ベトナム語) |
| WindowTranslator.Abstractions/Properties/Resources.zh-CN.resx | 同上(中国語・簡体) |
| WindowTranslator.Abstractions/Properties/Resources.zh-TW.resx | 同上(中国語・繁体) |
| WindowTranslator.Abstractions/Properties/Resources.Designer.cs | バッファ関連プロパティを削除し生成コードを同期 |
| WindowTranslator.Tests/WindowTranslator.Tests.csproj | テストプロジェクトを新規追加 |
| WindowTranslator.Tests/OcrTextTrackerAccuracyTests.cs | 追跡の精度/性能/互換性を検証するテストを追加 |
| WindowTranslator.Tests/OcrTrackingAccuracyScenarios.cs | シナリオベースの精度計測データを追加 |
| WindowTranslator.Tests/RandomizedOcrTrackingAccuracyScenarios.cs | 乱数シナリオ生成・精度評価を追加 |
| WindowTranslator.sln | テストプロジェクトをソリューションに追加 |
Files not reviewed (2)
- WindowTranslator.Abstractions/Properties/Resources.Designer.cs: Generated file
- WindowTranslator/Properties/Resources.Designer.cs: Generated file
Freeesia
commented
Jul 19, 2026
Freeesia
left a comment
Owner
Author
There was a problem hiding this comment.
OcrTextTracker.csをレビューしました。
全体として非常に良くできた実装だと思います。
- 1対1割当はハンガリアン法(JV法)による最小コスト割当で、候補の列挙順に依存しない決定的な対応付けになっている
- 分割・統合・休眠復元はビットマスクDP(
SelectStructureComponent)で資源数最大→スコア最大の順に厳密に選択され、状態数もMaxStructureSelectionStatesで制限済み lockによるスレッド保護、Resetでの状態全消去、RemoveTrackTreeでの休眠子トラックの連鎖削除など、ライフサイクル管理も一貫している- 組合せ生成は
MaxStructureCandidates=6で上限が抑えられており爆発しない
明確なバグは見つかりませんでした。インラインで数点、性能と一貫性についてコメントしています。
This was referenced Jul 20, 2026
Freeesia
marked this pull request as ready for review
July 22, 2026 15:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
OcrBufferFilter(直近フレームのOCR結果を平坦化して類似検索する方式)を廃止し、テキスト領域をフレーム間で継続追跡するOcrTextTrackerに置き換える。issue #643 の設計方針に基づく実装。主な変更
追跡処理の新規実装(
IOcrTextTracker/OcrTextTracker)IOcrModule.RecognizeAsyncの直後に変更(MainViewModelBase)。DIにはScopedで登録。旧実装・関連機能の削除
OcrBufferFilter(IFilterModule、Levenshtein類似度によるバッファ内重複検索・振動抑制・復元処理)を削除。BasicOcrParamのBufferSize/IsSuppressVibe/IsEnableRecoverと、対応する全言語のリソース文字列を削除。TargetSettings.IsOneShotMode(One-shotモード)と関連コード(設定画面、初回キャプチャ制御、エラーレポート出力)を削除。テスト
WindowTranslator.Testsを追加。OcrBufferFilter相当ロジック(テスト内に再実装した比較用モデル)との比較で、基本シナリオは80.06%→100.00%、ランダム化シナリオ平均は74.60%→89.82%。動作確認
dotnet test WindowTranslator.Tests: 59件すべて成功dotnet build WindowTranslator/WindowTranslator.csproj --no-restore: 成功(0エラー)Close #643