-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect orthogonal lines using RANSAC #1314
base: main
Are you sure you want to change the base?
Conversation
de0a1d2
to
cf101c5
Compare
cf101c5
to
181f222
Compare
einmal mit kalibrierter Kamera testen |
181f222
to
5219fe5
Compare
35a1c74
to
a2c9d72
Compare
let clockwise_normal_vector = Direction::Clockwise | ||
.rotate_vector_90_degrees(direction_vector) | ||
.normalize(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not your change, but I'd expect the rotate_vector_90_degrees
to be a function of a vector taking the Direction
as argument...
Resolve when read, or maybe even open an issue for that? What do you think?
pub direction1: Vector2<Frame>, | ||
pub direction2: Vector2<Frame>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This naming has 90% overlap in the field names. This is easy to mistype...
line1 | ||
.squared_distance_to(point) | ||
.min(line2.squared_distance_to(point)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract to variable to increase readability
PathIntrospect, | ||
PathDeserialize, | ||
)] | ||
pub struct TwoLines<Frame> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't this called Corner
if the docstring calls it corner
?
#[default] | ||
None, | ||
Line(Line2<Frame>), | ||
TwoLines(TwoLines<Frame>), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here: maybe call it Corner
?
if two_lines.direction2.norm() > f32::EPSILON { | ||
Self::TwoLines(two_lines) | ||
} else { | ||
Self::Line(line) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What situation do you want to capture here? Having the same point twice?!
{ | ||
unused_points | ||
.into_iter() | ||
.filter(|point| self.squared_distance_to(**point) <= maximum_score_distance_squared) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be able to do something like
.filter(|point| self.squared_distance_to(**point) <= maximum_score_distance_squared) | |
.filter(|&point| self.squared_distance_to(point) <= maximum_score_distance_squared) |
#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)] | ||
pub enum RansacFeature<Frame> { | ||
#[default] | ||
None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there a None
feature type?! This sounds weird to me...
Why? What?
This PR implements detecting orthogonal lines in the field using RANSAC. This improves the placement of line segments near corners.
Depends on #1334.
Since our
image_to_ground
is currently resulting in orthogonal lines not always being orthogonal, it may currently result in worse line fittings.This feature is currently gated behind the
ransac_fit_two_lines
parameter, which is false by default.ToDo / Known Issues
ransac_iterations
should be increased.Ideas for Next Iterations (Not This PR)
How to Test
Enable recording and upload to a NAO. Watch the replay and have a look at the image panel with the line detection overlay enabled. The green lines show the fitted orthogonal lines, the red ones the fitted lines. Note that only the blue lines are the extracted line segments used for localization.