Skip to content

Commit

Permalink
Merge branch 'path_tracking' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
lxowalle committed Dec 31, 2024
2 parents 99bc40d + 8777cc1 commit 6dbf1fa
Show file tree
Hide file tree
Showing 5 changed files with 1,337 additions and 622 deletions.
15 changes: 4 additions & 11 deletions components/vision/include/maix_image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1310,20 +1310,13 @@ namespace maix::image
/**
* Search the path of line
*
* @param thresholds You can define multiple thresholds.
* For GRAYSCALE format, you can use {{Lmin, Lmax}, ...} to define one or more thresholds.
* For RGB888 format, you can use {{Lmin, Lmax, Amin, Amax, Bmin, Bmax}, ...} to define one or more thresholds.
* Where the upper case L,A,B represent the L,A,B channels of the LAB image format, and min, max represent the minimum and maximum values of the corresponding channels.
* @param detect_pixel_size Before finding the path, the screen is divided into several smaller blocks, each with a width and height of detect_pixel_size. The smaller the detect_pixel_size, the finer the division. the unit is pixels.
* @param point_merge_size Minimum distance between merged point sets. the unit is pixels.
* @param connection_max_size Minimum size allowed for connecting points to form a line. the unit is pixels.
* @param connection_max_distance Minimum distance allowed for point to line. the unit is pixels.
* @param connection_max_angle Minimum angle allowed for connecting points to form a line.
*
* @param threshold Threshold for finding a line, the larger the value the more accurate the line is found
* @param merge_degree Minimum angle difference required when merging multiple lines
* @param min_len_of_new_path The minimum length of a new path, if the crossing length exceeds this value, it is considered a new path.
* @return Return the line when found lines, format is (groupline1, groupline2, ...), you can use LineGroup class methods to do more operations
* @maixpy maix.image.Image.search_line_path
*/
std::vector<image::LineGroup> search_line_path(std::vector<std::vector<int>> thresholds = std::vector<std::vector<int>>(), int detect_pixel_size = 30, int point_merge_size = 15, int connection_max_size = 51, int connection_max_distance = 20, int connection_max_angle = 20);
std::vector<image::LineGroup> search_line_path(int threshold = 30, int merge_degree = 10, int min_len_of_new_path = 10);

/**
* Find circles in image
Expand Down
12 changes: 1 addition & 11 deletions components/vision/include/maix_image_obj.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2838,22 +2838,19 @@ namespace maix::image
int _id;
LineType _type;
std::vector<image::Line> _lines;
std::vector<std::vector<std::vector<int>>> _points;
public:
/**
* LineGroup constructor
*
* @param id The id of line
* @param type The line list type, @see image::LineType
* @param lines The line list
* @param points Point sets of line
* @maixpy maix.image.LineGroup.__init__
*/
LineGroup(int id, image::LineType type, std::vector<image::Line> lines, std::vector<std::vector<std::vector<int>>> points = std::vector<std::vector<std::vector<int>>>()) {
LineGroup(int id, image::LineType type, std::vector<image::Line> lines) {
_id = id;
_type = type;
_lines = lines;
_points = points;
}

~LineGroup(){}
Expand Down Expand Up @@ -2881,12 +2878,5 @@ namespace maix::image
* @maixpy maix.image.LineGroup.lines
*/
std::vector<image::Line> lines() {return _lines;}

/**
* Get the key points of line
* @return returns a list composed of (x,y) coordnates.
* @maixpy maix.image.LineGroup.points
*/
std::vector<std::vector<std::vector<int>>> points() {return _points;}
};
}
Loading

0 comments on commit 6dbf1fa

Please sign in to comment.