Initial commit: ノーコード画像検査アプリ (MVP + 追加機能一式)
検査レシピ=処理/検査ステップの縦リスト(配線なし)。yfoxlib(yfoximg/yfoxbase)使用。 - ビジュアル・パイプライン(カード+適用後サムネイル+緑/赤 合否) - テンプレート/対話式ウィザードでレシピ生成(CTaskDialog) - パラメータのスライダー・ライブ調整 - レシピ保存/読込(*.itr) + 最近使ったファイル(MRU) - 検査範囲(ROI)を複数マウス指定(ドラッグ追加/右クリック削除) - カードのドラッグ並べ替え - 判定結果画像の保存 + 検査ログCSV(項目拡張) - 処理6種+検査3種(明るさ/白画素率/塊の数) - /selftest(実行+レシピ往復+結果画像+複数ROI塊カウント検証)、/demo Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
#pragma once
|
||||
//
|
||||
// Templates.h - 「目的から選ぶ」ための完成済みレシピ。
|
||||
// ユーザーは目的を選ぶだけ。あとは右パネルのスライダーで微調整できる。
|
||||
//
|
||||
#include "Recipe.h"
|
||||
#include "StepCatalog.h"
|
||||
#include <vector>
|
||||
|
||||
namespace core {
|
||||
|
||||
struct RecipeTemplate
|
||||
{
|
||||
CString name; // 目的名
|
||||
CString desc; // 説明
|
||||
Recipe recipe; // 中身
|
||||
};
|
||||
|
||||
inline Step Mk(StepKind k) { return MakeStep(k); }
|
||||
|
||||
inline std::vector<RecipeTemplate> AllTemplates()
|
||||
{
|
||||
std::vector<RecipeTemplate> v;
|
||||
|
||||
// 1) キズ・汚れを見つける
|
||||
{
|
||||
RecipeTemplate t;
|
||||
t.name = L"キズ・汚れを見つける";
|
||||
t.desc = L"白黒化→ノイズ除去→自動二値化し、キズ(白い塊)の数が0個なら合格。";
|
||||
t.recipe.steps.push_back(Mk(StepKind::Grayscale));
|
||||
t.recipe.steps.push_back(Mk(StepKind::Median));
|
||||
t.recipe.steps.push_back(Mk(StepKind::Otsu));
|
||||
{ Step s = Mk(StepKind::InspectBlobCount);
|
||||
s.SetParam(L"thresh", 128); s.SetParam(L"invert", 1); // 暗い欠陥を数える
|
||||
s.SetParam(L"min", 0); s.SetParam(L"max", 0);
|
||||
t.recipe.steps.push_back(s); }
|
||||
v.push_back(t);
|
||||
}
|
||||
|
||||
// 2) 欠け・穴を数える
|
||||
{
|
||||
RecipeTemplate t;
|
||||
t.name = L"欠け・穴を数える";
|
||||
t.desc = L"白黒化→自動二値化し、穴(塊)の数が想定範囲(既定1〜4個)なら合格。";
|
||||
t.recipe.steps.push_back(Mk(StepKind::Grayscale));
|
||||
t.recipe.steps.push_back(Mk(StepKind::Otsu));
|
||||
{ Step s = Mk(StepKind::InspectBlobCount);
|
||||
s.SetParam(L"thresh", 128); s.SetParam(L"invert", 1); // 暗い穴を数える
|
||||
s.SetParam(L"min", 1); s.SetParam(L"max", 4);
|
||||
t.recipe.steps.push_back(s); }
|
||||
v.push_back(t);
|
||||
}
|
||||
|
||||
// 3) 明るさ(ムラ)を確認する
|
||||
{
|
||||
RecipeTemplate t;
|
||||
t.name = L"明るさを確認する";
|
||||
t.desc = L"白黒化し、全体の平均の明るさが範囲(既定80〜180)なら合格。";
|
||||
t.recipe.steps.push_back(Mk(StepKind::Grayscale));
|
||||
{ Step s = Mk(StepKind::InspectBrightness);
|
||||
s.SetParam(L"min", 80); s.SetParam(L"max", 180);
|
||||
t.recipe.steps.push_back(s); }
|
||||
v.push_back(t);
|
||||
}
|
||||
|
||||
// 4) 文字・印字の有無を見る
|
||||
{
|
||||
RecipeTemplate t;
|
||||
t.name = L"文字・印字の有無を見る";
|
||||
t.desc = L"白黒化→二値化し、インク(白い部分)の割合が一定以上あれば合格=印字あり。";
|
||||
t.recipe.steps.push_back(Mk(StepKind::Grayscale));
|
||||
{ Step s = Mk(StepKind::Binarize);
|
||||
s.SetParam(L"lo", 128); s.SetParam(L"hi", 255); s.SetParam(L"invert", 1);
|
||||
t.recipe.steps.push_back(s); }
|
||||
{ Step s = Mk(StepKind::InspectWhiteRatio);
|
||||
s.SetParam(L"thresh", 128); s.SetParam(L"min", 2); s.SetParam(L"max", 100);
|
||||
t.recipe.steps.push_back(s); }
|
||||
v.push_back(t);
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
Reference in New Issue
Block a user