KJB
|
This class contains the three orthogonal vanishing points defining a Manhattan scene, where most or all planes are aligned with three main orthogonal directions. This class optionally contains a set of segments from the scene, assigned to the correct vanishing point. More...
#include <manhattan_world.h>
Public Member Functions | |
Manhattan_world (double ifocal=MW_FOCAL_INIT_VALUE) | |
Manhattan_world (const std::vector< Vanishing_point > &ivpts, double ifocal=MW_FOCAL_INIT_VALUE) | |
Manhattan_world (const Edge_segment_set &isegments, const std::vector< Vanishing_point > &ivpts, double ifocal=MW_FOCAL_INIT_VALUE, double outlier_threshold=MW_OUTLIER_THRESHOLD) | |
Manhattan_world (const char *filename, const Edge_segment_set &isegments, double outlier_threshold=MW_OUTLIER_THRESHOLD) | |
Manhattan_world (const char *filename) | |
Manhattan_world (std::istream &in, const Edge_segment_set &isegments, double outlier_threshold=MW_OUTLIER_THRESHOLD) | |
Manhattan_world (const Manhattan_world &src) | |
Manhattan_world & | operator= (const Manhattan_world &src) |
double | get_focal_length () const |
returns the focal length More... | |
void | set_focal_length (double ifocal) |
returns the focal length More... | |
void | reset_vanishing_points (const std::vector< Vanishing_point > &vpts) |
void | assign_segments_to_vpts (const Edge_segment_set &, double outlier_threshold=MW_OUTLIER_THRESHOLD) |
Assigns each input segment to the vanishing point it converges to, or mark it as an outlier if it does not converge to any vanishing point. More... | |
const std::vector< std::vector < Manhattan_segment > > & | get_assignments () const |
returns the vector of the segments assigned to the correct vanishing point (outliers in the last vector) More... | |
unsigned | num_lines_assigned_to_vp (unsigned vpindex) const |
returns the length of the vector of the segments assigned to the vanishing point More... | |
const std::vector < Vanishing_point > & | get_vanishing_points () const |
Returns the vanishing points. More... | |
const std::vector < Vanishing_point > | get_value_vanishing_points () const |
void | draw_segments_with_vp_assignments (kjb::Image &img, double width=1.0) const |
draws the line segments with different colors according to the vanishing point they are assigned to (green and red for horizontal, blue for vertical, black for outliers). More... | |
void | draw_lines_from_segments_midpoint_to_vp (kjb::Image &img, double width=1.0) const |
Draws a line between the mid point of each segment (excluding outliers) and the vanishing point the segment converges to. Line segments are drawn with different colors according to the vanishing point they are assigned to (green and red for horizontal, blue for vertical, black for outliers). More... | |
void | read (std::istream &in, const Edge_segment_set &isegments, double outlier_threshold=MW_OUTLIER_THRESHOLD) |
Reads this Manhattan world from an input stream. More... | |
void | read (const char *filename, const Edge_segment_set &isegments, double outlier_threshold=MW_OUTLIER_THRESHOLD) |
Reads this Manhattan world from an input file. More... | |
void | read (const char *filename) |
void | read (std::istream &in) |
void | write (std::ostream &out) const |
Writes this Manhattan world to an output stream. More... | |
void | write (const char *out_file) const |
Writes this Manhattan world to an output file. More... | |
const Manhattan_corner & | get_corner_2 (unsigned int i) const |
Returns the ith corner consisting of the intersection of two line segments. More... | |
const Manhattan_corner & | get_corner_3 (unsigned int i) const |
Returns the ith corner consisting of the intersection of three line segments. More... | |
const Manhattan_corner & | get_extra_corner (unsigned int i) const |
const Manhattan_segment & | get_manhattan_segment (unsigned int vp_index, unsigned int segment_index) const |
void | write_manhattan_corner (const Manhattan_corner &corner, std::ostream &out) const |
void | read_manhattan_corner (Manhattan_corner &corner, std::istream &in) const |
void | write_corners (std::ostream &out) const |
void | read_corners (std::istream &in) |
void | draw_corners (kjb::Image &img, bool draw_full_segments=false, double width=1.0) const |
void | draw_corners2 (kjb::Image &img, bool draw_full_segments=false, double width=1.0) const |
void | draw_corners2up (kjb::Image &img, bool draw_full_segments=false, double width=1.0) const |
void | draw_corners3 (kjb::Image &img, bool draw_full_segments=false, double width=1.0) const |
void | draw_corners3up (kjb::Image &img, bool draw_full_segments=false, double width=1.0) const |
void | draw_corners2smart (kjb::Image &img, bool draw_full_segments=false, double width=1.0) const |
void | draw_corners3smart (kjb::Image &img, bool draw_full_segments=false, double width=1.0) const |
void | draw_extra_corners (kjb::Image &img, bool draw_full_segments=false, double width=1.0) const |
bool | create_corner3_from_incomplete (Manhattan_corner &corner, unsigned int index3, bool towards_vp, const kjb::Vector &position, bool check_consistency=true) |
void | create_corners2 () |
Creates corners by checking all possible intersections of two line segments. More... | |
void | create_corners3 () |
Creates corners by checking all possible intersections of three line segments. More... | |
void | create_corners () |
Creates corners by checking all possible intersections of two and three line segments. More... | |
unsigned int | get_num_corners2 () const |
unsigned int | get_num_corners3 () const |
unsigned int | get_num_extra_corners () const |
void | print_corners (std::ostream &out) const |
void | print_corners2 (std::ostream &out) const |
void | print_corners3 (std::ostream &out) const |
void | print_vanishing_points (std::ostream &out) const |
void | get_3D_corner (double z_distance, double princ_x, double princ_y, unsigned int index, bool usecorner3, kjb::Vector &corner3D_1, kjb::Vector &corner3D_2, kjb::Vector &corner3D_3, kjb::Vector &position_3D) const |
const std::vector < Manhattan_corner > & | get_corners3 () const |
const std::vector < Manhattan_corner > & | get_corners2 () const |
const std::vector < Manhattan_corner > & | get_extra_corners () const |
void | set_extra_corners_from_vertical_pairs (const std::vector< Segment_pair > &vpairs) |
Static Public Member Functions | |
static bool | create_corner (Manhattan_corner &corner, const Manhattan_segment &seg1, const Manhattan_segment &seg2, unsigned int index1, unsigned int index2, double max_stretch=MAX_CORNER_SEGMENT_STRETCH) |
Creates a corner from two line segments. Returns false if the segments do not intersect. More... | |
static bool | create_corner3 (Manhattan_corner &corner, const Manhattan_segment &seg3, unsigned int index3, double max_stretch=MAX_CORNER_SEGMENT_STRETCH, double max_perp_stretch=MAX_CORNER_PERP_SEGMENT_STRETCH) |
Creates a corner from an already existing corner and a line segment. Returns false if the segment does not intersect the corner position. More... | |
This class contains the three orthogonal vanishing points defining a Manhattan scene, where most or all planes are aligned with three main orthogonal directions. This class optionally contains a set of segments from the scene, assigned to the correct vanishing point.
|
inline |
|
inline |
Manhattan_world::Manhattan_world | ( | const Edge_segment_set & | isegments, |
const std::vector< Vanishing_point > & | ivpts, | ||
double | ifocal = MW_FOCAL_INIT_VALUE , |
||
double | outlier_threshold = MW_OUTLIER_THRESHOLD |
||
) |
|
inline |
|
inline |
|
inline |
|
inline |
void Manhattan_world::assign_segments_to_vpts | ( | const Edge_segment_set & | isegments, |
double | outlier_threshold = MW_OUTLIER_THRESHOLD |
||
) |
Assigns each input segment to the vanishing point it converges to, or mark it as an outlier if it does not converge to any vanishing point.
|
static |
Creates a corner from two line segments. Returns false if the segments do not intersect.
Creates corners by checking all possible intersections of two line segments
corner | Will contain the corner |
seg1 | The first line segment |
seg2 | The second line segment |
index1 | The index of the vanishing point seg1 converges to |
index2 | The index of the vanishing point seg2 converges to |
max_stretch | The maximum stretch applicable to a line segment in order to consider the intersection as a corner |
|
static |
Creates a corner from an already existing corner and a line segment. Returns false if the segment does not intersect the corner position.
Creates a corner from an already existing corner and a line segment. Returns false if the segment does not intersect the corner position
corner | The corner. It will be adapted if the third segment intersects it |
seg3 | The line segment |
index3 | The index of the vanishing point seg3 converges to |
max_stretch | The maximum stretch applicable to a line segment in order to consider the intersection as a corner |
max_perp_stretch | The maximum tolerated distance between the line seg3 lies on and the corner position |
bool Manhattan_world::create_corner3_from_incomplete | ( | Manhattan_corner & | corner, |
unsigned int | index3, | ||
bool | towards_vp, | ||
const kjb::Vector & | position, | ||
bool | check_consistency = true |
||
) |
void Manhattan_world::create_corners | ( | ) |
Creates corners by checking all possible intersections of two and three line segments.
void Manhattan_world::create_corners2 | ( | ) |
Creates corners by checking all possible intersections of two line segments.
void Manhattan_world::create_corners3 | ( | ) |
Creates corners by checking all possible intersections of three line segments.
void Manhattan_world::draw_corners | ( | kjb::Image & | img, |
bool | draw_full_segments = false , |
||
double | width = 1.0 |
||
) | const |
void Manhattan_world::draw_corners2 | ( | kjb::Image & | img, |
bool | draw_full_segments = false , |
||
double | width = 1.0 |
||
) | const |
void Manhattan_world::draw_corners2smart | ( | kjb::Image & | img, |
bool | draw_full_segments = false , |
||
double | width = 1.0 |
||
) | const |
void Manhattan_world::draw_corners2up | ( | kjb::Image & | img, |
bool | draw_full_segments = false , |
||
double | width = 1.0 |
||
) | const |
void Manhattan_world::draw_corners3 | ( | kjb::Image & | img, |
bool | draw_full_segments = false , |
||
double | width = 1.0 |
||
) | const |
void Manhattan_world::draw_corners3smart | ( | kjb::Image & | img, |
bool | draw_full_segments = false , |
||
double | width = 1.0 |
||
) | const |
void Manhattan_world::draw_corners3up | ( | kjb::Image & | img, |
bool | draw_full_segments = false , |
||
double | width = 1.0 |
||
) | const |
void Manhattan_world::draw_extra_corners | ( | kjb::Image & | img, |
bool | draw_full_segments = false , |
||
double | width = 1.0 |
||
) | const |
void Manhattan_world::draw_lines_from_segments_midpoint_to_vp | ( | kjb::Image & | img, |
double | width = 1.0 |
||
) | const |
Draws a line between the mid point of each segment (excluding outliers) and the vanishing point the segment converges to. Line segments are drawn with different colors according to the vanishing point they are assigned to (green and red for horizontal, blue for vertical, black for outliers).
img | the image to draw the segments on |
width | the width to use when drawing the line segments |
void Manhattan_world::draw_segments_with_vp_assignments | ( | kjb::Image & | img, |
double | width = 1.0 |
||
) | const |
draws the line segments with different colors according to the vanishing point they are assigned to (green and red for horizontal, blue for vertical, black for outliers).
Draws the line segments with different colors according to the vanishing point they are assigned to (green and red for horizontal, blue for vertical, black for outliers).
img | the image to draw the segments on |
width | the width to use when drawing the line segments |
void Manhattan_world::get_3D_corner | ( | double | z_distance, |
double | princ_x, | ||
double | princ_y, | ||
unsigned int | index, | ||
bool | usecorner3, | ||
kjb::Vector & | corner3D_1, | ||
kjb::Vector & | corner3D_2, | ||
kjb::Vector & | corner3D_3, | ||
kjb::Vector & | position_3D | ||
) | const |
|
inline |
returns the vector of the segments assigned to the correct vanishing point (outliers in the last vector)
|
inline |
Returns the ith corner consisting of the intersection of two line segments.
|
inline |
Returns the ith corner consisting of the intersection of three line segments.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
returns the focal length
const Manhattan_segment & Manhattan_world::get_manhattan_segment | ( | unsigned int | vp_index, |
unsigned int | segment_index | ||
) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Returns the vanishing points.
|
inline |
returns the length of the vector of the segments assigned to the vanishing point
|
inline |
|
inline |
void Manhattan_world::print_corners2 | ( | std::ostream & | out | ) | const |
void Manhattan_world::print_corners3 | ( | std::ostream & | out | ) | const |
void Manhattan_world::print_vanishing_points | ( | std::ostream & | out | ) | const |
void Manhattan_world::read | ( | std::istream & | in, |
const Edge_segment_set & | isegments, | ||
double | outlier_threshold = MW_OUTLIER_THRESHOLD |
||
) |
Reads this Manhattan world from an input stream.
Reads this Manhattan world from an input stream.
in | the input stream to read this Manhattan world from |
void Manhattan_world::read | ( | const char * | filename, |
const Edge_segment_set & | isegments, | ||
double | outlier_threshold = MW_OUTLIER_THRESHOLD |
||
) |
Reads this Manhattan world from an input file.
Reads this Manhattan world from an input file.
in | the input stream to read this Manhattan world from |
void Manhattan_world::read | ( | const char * | filename | ) |
Reads this Manhattan world from an input stream.
in | the input stream to read this Manhattan world from |
void Manhattan_world::read | ( | std::istream & | in | ) |
void Manhattan_world::read_corners | ( | std::istream & | in | ) |
void Manhattan_world::read_manhattan_corner | ( | Manhattan_corner & | corner, |
std::istream & | in | ||
) | const |
|
inline |
void Manhattan_world::set_extra_corners_from_vertical_pairs | ( | const std::vector< Segment_pair > & | vpairs | ) |
|
inline |
returns the focal length
void Manhattan_world::write | ( | std::ostream & | out | ) | const |
Writes this Manhattan world to an output stream.
Writes this Manhattan world to an input stream.
out | the output stream to write this Manhattan world to |
|
inline |
Writes this Manhattan world to an output file.
void Manhattan_world::write_corners | ( | std::ostream & | out | ) | const |
void Manhattan_world::write_manhattan_corner | ( | const Manhattan_corner & | corner, |
std::ostream & | out | ||
) | const |