Skip to content

Commit

Permalink
fix: fix read color config
Browse files Browse the repository at this point in the history
  • Loading branch information
FaaizHaikal committed Feb 21, 2024
1 parent 5c894b0 commit 37a250b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions data/color_classifier.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"ball": {
"min_hsv": [151, 40, 10],
"max_hsv": [179, 100, 100]
},
"field": {
"min_hsv": [84, 10, 0],
"max_hsv": [116, 100, 100]
},
"line": {
"min_hsv": [180, 0, 55],
"max_hsv": [260, 60, 100]
}
}
3 changes: 2 additions & 1 deletion src/ninshiki_cpp/detector/color_detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ bool ColorDetector::load_configuration(const std::string & path)
nlohmann::json config = nlohmann::json::parse(input);
for (auto & item : config.items()) {
// Get all config
std::string name = item.key();
try {
utils::Color color(
item.value().at("name"),
name,
item.value().at("min_hsv")[0],
item.value().at("max_hsv")[0],
item.value().at("min_hsv")[1],
Expand Down

0 comments on commit 37a250b

Please sign in to comment.