Skip to content

Commit

Permalink
Merge pull request #10 from ichiro-its/hotfix/fix-add-contour
Browse files Browse the repository at this point in the history
[Hotfix] - Store Detected Contour
  • Loading branch information
FaaizHaikal authored Mar 4, 2024
2 parents c5ccd3e + 963d728 commit c9f227c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
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]
}
}
6 changes: 2 additions & 4 deletions include/ninshiki_cpp/utils/contours.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ class Contours
explicit Contours(std::vector<std::vector<cv::Point>> contours);
explicit Contours(cv::Mat binary_mat);

std::vector<std::vector<cv::Point>> contours;

cv::Mat get_binary_mat(cv::Size mat_size);
cv::Mat get_binary_mat_line(cv::Size mat_size, int line_size);

std::vector<std::vector<cv::Point>> get_contours();
void set_contours(std::vector<std::vector<cv::Point>> contours);

void set_name(std::string contours_name);

void find(cv::Mat binary_mat);
Expand Down Expand Up @@ -83,7 +82,6 @@ class Contours

private:
std::vector<cv::Point> get_all_point_contour();
std::vector<std::vector<cv::Point>> contours;
std::string name;
};

Expand Down
2 changes: 1 addition & 1 deletion src/ninshiki_cpp/detector/color_detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ bool ColorDetector::load_configuration(const std::string & path)
// Get all config
try {
utils::Color color(
item.value().at("name"),
item.key(),
item.value().at("min_hsv")[0],
item.value().at("max_hsv")[0],
item.value().at("min_hsv")[1],
Expand Down
12 changes: 1 addition & 11 deletions src/ninshiki_cpp/utils/contours.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Contours::Contours()

Contours::Contours(std::vector<std::vector<cv::Point>> contours)
{
set_contours(contours);
contours = contours;
}

Contours::Contours(cv::Mat binary_mat)
Expand Down Expand Up @@ -71,16 +71,6 @@ cv::Mat Contours::get_binary_mat_line(cv::Size mat_size, int line_size)
return binary_mat;
}

std::vector<std::vector<cv::Point>> Contours::get_contours()
{
return contours;
}

void Contours::set_contours(std::vector<std::vector<cv::Point>> contours)
{
this->contours = contours;
}

void Contours::set_name(std::string contours_name)
{
name = contours_name;
Expand Down

0 comments on commit c9f227c

Please sign in to comment.