Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
数独ではじめるアルゴリズム 第三章 OCR
Search
Ryosuke Uchiyama
December 09, 2020
Programming
0
100
数独ではじめるアルゴリズム 第三章 OCR
Ryosuke Uchiyama
December 09, 2020
Tweet
Share
More Decks by Ryosuke Uchiyama
See All by Ryosuke Uchiyama
AWSでサーバレスな書籍管理アプリを作る
step63r
0
35
PythonでSlack通知botを作る
step63r
0
8
ChatGPT実践
step63r
1
330
IoT実践! 行先予定表を電子ペーパーで作る
step63r
0
11
React x Socket.ioで人狼サーバを作る 第一章 フロントエンド実装
step63r
0
11
深層強化学習で東方AI 第一章 DQNの基本
step63r
0
240
Build 2021 プレイバック
step63r
0
31
WPFで実践アプリ開発! 第四章 機能の実装 Part 2
step63r
0
43
WPFで実践アプリ開発! 第三章 機能の実装 Part 1
step63r
0
110
Other Decks in Programming
See All in Programming
tparseでgo testの出力を見やすくする
utgwkk
2
260
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
230
AIコーディングエージェント(skywork)
kondai24
0
190
AI時代を生き抜く 新卒エンジニアの生きる道
coconala_engineer
1
360
まだ間に合う!Claude Code元年をふりかえる
nogu66
5
860
非同期処理の迷宮を抜ける: 初学者がつまづく構造的な原因
pd1xx
1
740
tsgolintはいかにしてtypescript-goの非公開APIを呼び出しているのか
syumai
7
2.3k
AIの誤りが許されない業務システムにおいて“信頼されるAI” を目指す / building-trusted-ai-systems
yuya4
6
3.8k
これだけで丸わかり!LangChain v1.0 アップデートまとめ
os1ma
6
1.9k
ローターアクトEクラブ アメリカンナイト:川端 柚菜 氏(Japan O.K. ローターアクトEクラブ 会長):2720 Japan O.K. ロータリーEクラブ2025年12月1日卓話
2720japanoke
0
740
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
150
ELYZA_Findy AI Engineering Summit登壇資料_AIコーディング時代に「ちゃんと」やること_toB LLMプロダクト開発舞台裏_20251216
elyza
2
390
Featured
See All Featured
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
86
How Software Deployment tools have changed in the past 20 years
geshan
0
29k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
320
Writing Fast Ruby
sferik
630
62k
What's in a price? How to price your products and services
michaelherold
246
13k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.3k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
21
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
0
2.2k
What the history of the web can teach us about the future of AI
inesmontani
PRO
0
370
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
63
The Limits of Empathy - UXLibs8
cassininazir
1
190
Transcript
数独ではじめるアルゴリズム 第三章 OCR Ryosuke Uchiyama step63r
グラフ構造と深さ優先探索(DFS) 0 1 2 3 4 11 5 8 6
7 9 10 12 13 14 前 回 の あ ら す じ
入れられる数字の選択肢が少ないマスから埋めていく 3 6 5 4 8 7 9 4 5
1 9 7 3 5 6 8 9 6 5 4 4 6 5 5 6 5 3 5 3 4 5 6 5 3 4 4 4 6 5 5 5 4 4 5 5 5 4 4 5 5 5 4 7 3 3 4 3 4 4 5 6 4 4 5 6 5 4 4 6 4 5 7 7 4 6 7 7 5 6 6 8 問題 入れられる数字の残数 ここから処理するよりも… この辺から処理した方が速い! 前 回 の あ ら す じ
一意に決まるマスはあらかじめ埋めておく 3 6 5 4 8 7 9 4 5
1 9 7 3 5 6 8 9 問題 5 8 3 6 5 4 8 7 5 9 4 6 5 9 1 5 9 7 3 5 6 8 5 9 5 前処理後の問題 前 回 の あ ら す じ
MVVMパターン View ViewModel Model データ バインディング コマンド メソッド呼出し プロパティ設定 変更通知
変更通知 前 回 の あ ら す じ
Xamarin.Forms Shared C# Backend Shared UI Code iOS Android Windows
前 回 の あ ら す じ
今後やること • UI実装(WPFかXamarinあたり) • モバイル対応(iOSアプリをビルドする環境がない……つらたん……) • OCR(問題をカメラで撮ってAzure Cognitive Servicesとかで盤面認識&自動解答) •
マルチスレッド(たぶんやらないやつ) 前 回 の あ ら す じ
数字の検出
Computer Visionを用いたテキスト抽出 問題発生!
Text = "3", BoundingBox = [ (115, 16), (133, 17),
(132, 39), (114, 38)] どのマスにどの数字が 入るんだ……? 数独のマスも検出する必要があった!
マスの検出
どんなフレームワークが使えるか 案1 Azure Cognitive Servicesの既存モデルを活用 案2 Custom Visionに独自モデルをデプロイ 案3 画像解析ライブラリで交点検出
「数独のマスを検出するAPI」があるわけないので却下。 学習(データ採取)が面倒くさすぎるので却下。 PythonとOpenCVで似たようなことをやったことがあるな? 1)Harrisのコーナー検出 → 精度イマイチ 2)Shi-Tomasiのコーナー検出 → 精度イマイチ 3)Canny → いけそう! 採 用 採 用
XamarinでどうやってOpenCVを使うか Windows ランタイム コンポーネント - UWP applications | Microsoft Docs
Microsoftは神か? OpenCV でのビットマップの処理 - UWP applications | Microsoft Docs 問題発生!
cv::Mat Platform::Collections::Vector マネージ/ネイティブ間のマーシャリング 結局、フレーム検出機能はPythonで実装することに
つくったもの
ソースコード SudokuApp uchi-sudokuapp-functions
全体構成 SudokuApp ローカルストレージ OpenFileAsync RandamAccessStream Function App Cognitive Services DetectSudokuFrame
JSON Response Stream IList<ReadResult>
Demo