AIを活用した日本語文書解析エンジンを提供するYomiToku 0.16.0がリリースされました.このバージョンの新機能で歪み補正機能がつきました.
🚀 機能追加
feat: add geometric correction (dewarping) preprocessing for photogra… @kotaro-kinoshita (#267)
ページ検知・幾何補正(歪み補正)
–dewarp を指定すると、カメラで撮影した画像から複数の書類(見開きの左右のページ、並べたレシートや名刺など)の領域を検知し、書類ごとに湾曲・カール・傾き・台形の歪みを補正したうえで、ページごとにドキュメント解析(OCR・レイアウト解析)を行います。1 枚の写真に複数の書類が写っていても、撮影し直したり切り出したりすることなく、それぞれを独立した平らな文書として解析できます。紙の輪郭を抽出して四隅を射影変換するだけの単純な補正ではなく、紙面全体の歪みを推定する非線形な補正のため、紙の湾曲やカールも平らに戻せます。紙の一部が画像の外に見切れている写真や、影・照明ムラのある写真にもロバストです。
導入
README.mdにはpip install yomitokuが案内されています.
自分はpipxで入れていたので pipx upgrade で更新します.
$ pipx upgrade yomitoku
upgraded package yomitoku from 0.15.1 to 0.16.2 (location: /home/matoken/.local/pipx/venvs/yomitoku)
$ pipx list | grep yomitoku
package yomitoku 0.16.2, installed using Python 3.14.10
- yomitoku
- yomitoku_extract
- yomitoku_extract_with_llm
- yomitoku_mcp
- yomitoku_tableNote | 0.16.0, 0.16.1 のときはPyPIが更新されていなかったので更新できていませんでした.sourceからbuildするとモデルの取得に失敗していました. |
`--dewarp* のオプションが増えています.$ yomitoku
usage: yomitoku [-h] [-f FORMAT] [-v] [-o OUTDIR] [-l] [-d DEVICE] [--td_cfg TD_CFG] [--tr_cfg TR_CFG] [--lp_cfg LP_CFG] [--tsr_cfg TSR_CFG] [--tr_name TR_NAME] [--td_name TD_NAME] [--ignore_line_break] [--figure] [--figure_letter]
[--figure_width FIGURE_WIDTH] [--figure_dir FIGURE_DIR] [--encoding ENCODING] [--combine] [--ignore_meta] [--split_text_across_cells] [--reading_order {auto,left2right,top2bottom,right2left}] [--font_path FONT_PATH]
[--pdf_quality {high,middle,low}] [--dpi DPI] [--pages PAGES] [--enable-rec-orientation-fallback] [--rec-orientation-fallback-thresh REC_ORIENTATION_FALLBACK_THRESH] [--disable-repetition-stop] [--ignore_ruby]
[--ruby_threshold RUBY_THRESHOLD] [--dewarp] [--dewarp_coordinate {dewarped,photo}] [--dewarp_model {pagenet_v1,uvdoc_v1}] [--dewarp_cfg DEWARP_CFG]
arg1
yomitoku: error: the following arguments are required: arg1YomiToku 歪み補正を試す
早速試します.初回実行時はモデルのダウンロードが行われます.
$ yomitoku IMG_20261105_052440714_MFNR.jpg -f md -o results -v --dewarp 2026-11-10 18:15:52,756 - yomitoku.base - INFO - Initialize TextDetector Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads. 2026-11-10 18:15:54,463 - yomitoku.base - WARNING - CUDA is not available. Use CPU instead. 2026-11-10 18:15:54,467 - yomitoku.base - INFO - Initialize TextRecognizer model.safetensors: downloading bytes: ████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 191MB, 900kB/s model.safetensors: reconstructing file: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 201MB / 201MB, 13.8MB/s 2026-11-10 18:20:36,816 - yomitoku.base - WARNING - CUDA is not available. Use CPU instead. 2026-11-10 18:20:36,820 - yomitoku.base - INFO - Initialize LayoutParser 2026-11-10 18:20:38,608 - yomitoku.base - WARNING - CUDA is not available. Use CPU instead. 2026-11-10 18:20:38,613 - yomitoku.base - INFO - Initialize TableStructureRecognizer 2026-11-10 18:20:39,895 - yomitoku.base - WARNING - CUDA is not available. Use CPU instead. 2026-11-10 18:20:39,906 - yomitoku.base - INFO - Initialize PageDewarper model.safetensors: downloading bytes: ████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 41.1MB, 879kB/s model.safetensors: reconstructing file: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 43.9MB / 43.9MB, 3.05MB/s 2026-11-10 18:21:39,510 - yomitoku.base - WARNING - CUDA is not available. Use CPU instead. 2026-11-10 18:21:39,512 - yomitoku.cli.main - INFO - Output directory: results 2026-11-10 18:21:39,512 - yomitoku.cli.main - INFO - Processing file: IMG_20261105_052440714_MFNR.jpg 2026-11-10 18:21:43,968 - yomitoku.base - INFO - PageDewarper __call__ elapsed_time: 4.1905553340911865 2026-11-10 18:21:46,815 - yomitoku.base - INFO - LayoutParser __call__ elapsed_time: 2.8465828895568848 2026-11-10 18:21:46,906 - yomitoku.base - INFO - TableStructureRecognizer __call__ elapsed_time: 0.07313704490661621 2026-11-10 18:21:49,201 - yomitoku.base - INFO - TextDetector __call__ elapsed_time: 5.232101917266846 2026-11-10 18:21:56,776 - yomitoku.base - INFO - TextRecognizer __call__ elapsed_time: 7.564051151275635 2026-11-10 18:21:57,103 - yomitoku.cli.main - INFO - Output file: results/_IMG_20261105_052440714_MFNR_p1_dewarp_grid.jpg 2026-11-10 18:21:57,173 - yomitoku.cli.main - INFO - Output file: results/_IMG_20261105_052440714_MFNR_p1_dewarped.jpg 2026-11-10 18:21:57,239 - yomitoku.cli.main - INFO - Output file: results/_IMG_20261105_052440714_MFNR_p1_ocr.jpg 2026-11-10 18:21:57,323 - yomitoku.cli.main - INFO - Output file: results/_IMG_20261105_052440714_MFNR_p1_layout.jpg 2026-11-10 18:21:57,330 - yomitoku.cli.main - INFO - Total Processing time: 17.82 sec
今回レシートをまるめて試してみました.はじめ画像が90度横になってしまっていたのですがそのまま.でも文字起こしはいまいちだったので縦にして再度行いました.正しい角度のほうが精度いい感じです.

$ cat results/_IMG_20261105_052440714_MFNR-tate_p1.md まちなかバーク 領 収 証 入庫日時 2026年11月02日 18時27分<br>出庫日時 2026年11月02日 21時52分<br>No.01\-000395 券No.02\-473787 駐車料金\(一般 \) 割引<br>\(サービス1\) 料金計 投入現金<br>釣銭額 全て消費税10%適用対象<br>登録番号:T6340001014199<br>株式会社 まちづくり鹿屋 600円 5枚 500円引 100円 100円<br>0円 10180
雑誌などで裁断せず開いた状態の画像なんかも試してみようと思います.