#include <osl_canny_ox.h>
Public Member Functions | |
osl_canny_ox (osl_canny_ox_params const ¶ms) | |
void | detect_edges (vil1_image const &image, vcl_list< osl_edge * > *) |
~osl_canny_ox () | |
Protected Member Functions | |
osl_edgel_chain * | Get_NMS_edgelsOX (int n_edgels_NMS, int *x_, int *y_) |
Copy edgels from thick_ image. These edgels are the result of NMS. | |
int | HysteresisOX (osl_edgel_chain *&, int *&) |
Hysteresis follows edgels that lie above the low threshold and have at least one edgel above the high threshold. | |
void | Initial_followOX (int, int, osl_edgel_chain *&, osl_LINK *[], int *&, float) |
Initial follow. Used for the hysteresis part of canny. | |
void | Add_linkOX (int, int, osl_LINK *[]) |
Add link. 'edgel' and 'to' are the indices of the two edges to be linked. | |
void | Link_edgelsOX (vcl_vector< unsigned > const &, vcl_vector< unsigned > const &, osl_LINK *[]) |
Link edgels. | |
int | Get_n_edgels_hysteresisOX (osl_edgel_chain *&, int *&) |
Returns the number of edgels after hysteresis. | |
void | Get_hysteresis_edgelsOX (osl_edgel_chain *&, int *&, osl_edgel_chain *&, int *x_, int *y_) |
Returns the edgels after hysteresis. | |
void | Delete_linksOX (osl_LINK **, int) |
osl_edge * | NO_FollowerOX (osl_edgel_chain *) |
In the case of follow_strategy_OX_ = 0, this function returns an osl_edge * filled from osl_edgel_chain *edgels_Hysteresis. | |
void | FollowerOX (vcl_list< osl_edge * > *) |
Go through every point in the image and for every one which is above a threshold: follow from the point, in one direction and then the other. | |
void | Final_followOX (int, int, vcl_list< int > *, vcl_list< int > *, vcl_list< float > *, int) |
Adds point (x, y) to the current curve, sets its value in the image to zero (any point may be included at most once in at most one curve) then searches for adjacent pixels (in an order intended to make closed curves ordered in a clockwise direction). | |
int | Join_dotsOX (int, int, int, int, int &, int &) |
The point (x, y) is the current curve point; (dx, dy) is the increment in position to (x, y) from the preceding point. | |
void | Scale_imageOX (float **, float) |
Multiply image by scale, and clip at 255. | |
void | Set_image_borderOX (float **, int, float) |
Set size of pixels around image (border) to value, so follow can't overrun. | |
void | Find_junctionsOX () |
Searches for the junctions in the image. | |
void | Find_junction_clustersOX () |
Locate junction clusters using the following method of hysteresis. | |
void | Final_follow (int, int, vcl_list< int > *, vcl_list< int > *, vcl_list< float > *, int) |
Following routine looking for connectiveness of edgel chains and accounts for single pixel gaps in the chains. | |
Static Protected Member Functions | |
static void | Initial_follow (float *const *thin, int xsize, int ysize, float low, int x, int y, vcl_list< int > *xc, vcl_list< int > *yc, vcl_list< float > *grad) |
Following routine looking for connectiveness of edgel chains and accounts for single pixel gaps in the chains. | |
static void | Follow_junctions (int *const *junction, int x, int y, vcl_list< int > *xc, vcl_list< int > *yc) |
Following routine looking for searching out junction clusters. | |
static void | Cluster_centre_of_gravity (int *const *jx, int *const *jy, vcl_list< int > &xc, vcl_list< int > &yc, int &x0, int &y0) |
Finds which member of the lists lies closest to the centre of gravity of the lists. | |
static int | Junction_neighbour (int const *const *junction, int x, int y) |
Determines whether the point (x,y) is a neighbour to a junction. | |
Protected Attributes | |
int | max_width_OX_ |
float * | sub_area_OX_ |
int | edge_min_OX_ |
int | min_length_OX_ |
int | border_size_OX_ |
float | border_value_OX_ |
float | scale_OX_ |
int | follow_strategy_OX_ |
bool | join_flag_OX_ |
int | junction_option_OX_ |
unsigned int | xstart_ |
unsigned int | ystart_ |
unsigned int | xsize_ |
unsigned int | ysize_ |
float ** | smooth_ |
float ** | dx_ |
float ** | dy_ |
float ** | grad_ |
float ** | thick_ |
float ** | thin_ |
float ** | theta_ |
int ** | junction_ |
int ** | jx_ |
int ** | jy_ |
vcl_list< int > * | xjunc_ |
vcl_list< int > * | yjunc_ |
vcl_list< osl_Vertex * > * | vlist_ |
float | gauss_tail_ |
float | sigma_ |
int | width_ |
int | w0_ |
int | k_size_ |
float * | kernel_ |
float | low_ |
float | high_ |
float | jval_ |
int | chain_no_ |
bool | verbose |
Definition at line 50 of file osl_canny_ox.h.
osl_canny_ox::osl_canny_ox | ( | osl_canny_ox_params const & | params | ) |
Definition at line 24 of file osl_canny_ox.cxx.
osl_canny_ox::~osl_canny_ox | ( | ) |
Definition at line 51 of file osl_canny_ox.cxx.
void osl_canny_ox::Add_linkOX | ( | int | edgel, |
int | to, | ||
osl_LINK * | links[] | ||
) | [protected] |
Add link. 'edgel' and 'to' are the indices of the two edges to be linked.
A link with value 'to' becomes the new head of the link-list for 'edgel'. A link with value 'edgel' becomes the new head of the link-list for 'to'.
Definition at line 329 of file osl_canny_ox.cxx.
void osl_canny_base::Cluster_centre_of_gravity | ( | int *const * | jx, |
int *const * | jy, | ||
vcl_list< int > & | xc, | ||
vcl_list< int > & | yc, | ||
int & | x0, | ||
int & | y0 | ||
) | [static, protected, inherited] |
Finds which member of the lists lies closest to the centre of gravity of the lists.
Definition at line 206 of file osl_canny_base.cxx.
void osl_canny_ox::Delete_linksOX | ( | osl_LINK ** | , |
int | |||
) | [protected] |
void osl_canny_ox::detect_edges | ( | vil1_image const & | image, |
vcl_list< osl_edge * > * | edges | ||
) |
Definition at line 75 of file osl_canny_ox.cxx.
void osl_canny_base::Final_follow | ( | int | x, |
int | y, | ||
vcl_list< int > * | xc, | ||
vcl_list< int > * | yc, | ||
vcl_list< float > * | grad, | ||
int | reverse | ||
) | [protected, inherited] |
Following routine looking for connectiveness of edgel chains and accounts for single pixel gaps in the chains.
Definition at line 92 of file osl_canny_base.cxx.
void osl_canny_ox::Final_followOX | ( | int | x, |
int | y, | ||
vcl_list< int > * | xc, | ||
vcl_list< int > * | yc, | ||
vcl_list< float > * | grad, | ||
int | reverse | ||
) | [protected] |
Adds point (x, y) to the current curve, sets its value in the image to zero (any point may be included at most once in at most one curve) then searches for adjacent pixels (in an order intended to make closed curves ordered in a clockwise direction).
If none are found, and we are not at a junction Join_dotsOX() is called to search for non-adjacent pixels. If a new point is found, a recursive call is made to Final_followOX() with that point.
Two strategies can be followed according to follow_strategy_OX_ if follow_strategy_OX_ = 1 then neighbours are checked in the following order (Charlie Rothwell's way)
8 7 6 1 x 5 2 3 4
but if follow_strategy_OX_ = 2 then neighbours are checked in the following order (Nic Pillow's way)
8 6 7 1 x 4 3 2 5
Definition at line 753 of file osl_canny_ox.cxx.
void osl_canny_ox::Find_junction_clustersOX | ( | ) | [protected] |
Locate junction clusters using the following method of hysteresis.
Definition at line 1008 of file osl_canny_ox.cxx.
void osl_canny_ox::Find_junctionsOX | ( | ) | [protected] |
Searches for the junctions in the image.
Definition at line 975 of file osl_canny_ox.cxx.
void osl_canny_base::Follow_junctions | ( | int *const * | junction, |
int | x, | ||
int | y, | ||
vcl_list< int > * | xc, | ||
vcl_list< int > * | yc | ||
) | [static, protected, inherited] |
Following routine looking for searching out junction clusters.
Definition at line 172 of file osl_canny_base.cxx.
void osl_canny_ox::FollowerOX | ( | vcl_list< osl_edge * > * | edges | ) | [protected] |
Go through every point in the image and for every one which is above a threshold: follow from the point, in one direction and then the other.
Definition at line 579 of file osl_canny_ox.cxx.
void osl_canny_ox::Get_hysteresis_edgelsOX | ( | osl_edgel_chain *& | edgels_NMS, |
int *& | status, | ||
osl_edgel_chain *& | edgels_Hysteresis, | ||
int * | x_, | ||
int * | y_ | ||
) | [protected] |
Returns the edgels after hysteresis.
Also fill the image thin_ with the edgels after hysteresis for further processing by the FollowerOX() part.
Definition at line 492 of file osl_canny_ox.cxx.
int osl_canny_ox::Get_n_edgels_hysteresisOX | ( | osl_edgel_chain *& | edgels_NMS, |
int *& | status | ||
) | [protected] |
Returns the number of edgels after hysteresis.
Definition at line 475 of file osl_canny_ox.cxx.
osl_edgel_chain * osl_canny_ox::Get_NMS_edgelsOX | ( | int | n_edgels_NMS, |
int * | x_, | ||
int * | y_ | ||
) | [protected] |
Copy edgels from thick_ image. These edgels are the result of NMS.
Although the edgels are stored in osl_edgel_chain edgels_NMS, they are not actually connected. Also initialises x_ and y_: the pixel locations of the edgels. These are needed later in filling the image thin_ with the edgels after hysteresis.
Definition at line 214 of file osl_canny_ox.cxx.
int osl_canny_ox::HysteresisOX | ( | osl_edgel_chain *& | edgels_NMS, |
int *& | status | ||
) | [protected] |
Hysteresis follows edgels that lie above the low threshold and have at least one edgel above the high threshold.
Definition at line 244 of file osl_canny_ox.cxx.
void osl_canny_base::Initial_follow | ( | float *const * | thin, |
int | xsize, | ||
int | ysize, | ||
float | low, | ||
int | x, | ||
int | y, | ||
vcl_list< int > * | xc, | ||
vcl_list< int > * | yc, | ||
vcl_list< float > * | grad | ||
) | [static, protected, inherited] |
Following routine looking for connectiveness of edgel chains and accounts for single pixel gaps in the chains.
Definition at line 50 of file osl_canny_base.cxx.
void osl_canny_ox::Initial_followOX | ( | int | to, |
int | from, | ||
osl_edgel_chain *& | edgels_NMS, | ||
osl_LINK * | links[], | ||
int *& | status, | ||
float | low | ||
) | [protected] |
Initial follow. Used for the hysteresis part of canny.
Definition at line 306 of file osl_canny_ox.cxx.
int osl_canny_ox::Join_dotsOX | ( | int | x, |
int | y, | ||
int | dx, | ||
int | dy, | ||
int & | xNew, | ||
int & | yNew | ||
) | [protected] |
The point (x, y) is the current curve point; (dx, dy) is the increment in position to (x, y) from the preceding point.
Based on dx and dy, it looks ahead in the same direction (or failing that, similar directions) for another point. On success, xNew and yNew are set to the coordinates of the point found and true is returned; otherwise false is returned.
Definition at line 882 of file osl_canny_ox.cxx.
int osl_canny_base::Junction_neighbour | ( | int const *const * | junction, |
int | x, | ||
int | y | ||
) | [static, protected, inherited] |
Determines whether the point (x,y) is a neighbour to a junction.
Definition at line 252 of file osl_canny_base.cxx.
void osl_canny_ox::Link_edgelsOX | ( | vcl_vector< unsigned > const & | col, |
vcl_vector< unsigned > const & | rows, | ||
osl_LINK * | links[] | ||
) | [protected] |
Link edgels.
First try pixels at distance 1 (direct neighbours), then at sqrt(2) (diagonal), then at 2 (horizontal or vertical), then at sqrt(5) (chess horse). I.e. in the following order:
4 3 4 4 2 1 2 4 3 1 0 1 3 4 2 1 2 4 4 3 4
Definition at line 358 of file osl_canny_ox.cxx.
osl_edge * osl_canny_ox::NO_FollowerOX | ( | osl_edgel_chain * | edgels_Hysteresis | ) | [protected] |
In the case of follow_strategy_OX_ = 0, this function returns an osl_edge * filled from osl_edgel_chain *edgels_Hysteresis.
i.e., the result of the Hysteresis part of Canny is returned in the osl_edge *. The Follow part (FollowerOX) is not executed.
Definition at line 525 of file osl_canny_ox.cxx.
void osl_canny_ox::Scale_imageOX | ( | float ** | image, |
float | scale | ||
) | [protected] |
Multiply image by scale, and clip at 255.
Definition at line 944 of file osl_canny_ox.cxx.
void osl_canny_ox::Set_image_borderOX | ( | float ** | image, |
int | border_size, | ||
float | value | ||
) | [protected] |
Set size of pixels around image (border) to value, so follow can't overrun.
Definition at line 956 of file osl_canny_ox.cxx.
int osl_canny_ox::border_size_OX_ [protected] |
Definition at line 88 of file osl_canny_ox.h.
float osl_canny_ox::border_value_OX_ [protected] |
Definition at line 89 of file osl_canny_ox.h.
int osl_canny_base::chain_no_ [protected, inherited] |
Definition at line 89 of file osl_canny_base.h.
float** osl_canny_base::dx_ [protected, inherited] |
Definition at line 64 of file osl_canny_base.h.
float** osl_canny_base::dy_ [protected, inherited] |
Definition at line 65 of file osl_canny_base.h.
int osl_canny_ox::edge_min_OX_ [protected] |
Definition at line 85 of file osl_canny_ox.h.
int osl_canny_ox::follow_strategy_OX_ [protected] |
Definition at line 93 of file osl_canny_ox.h.
float osl_canny_base::gauss_tail_ [protected, inherited] |
Definition at line 79 of file osl_canny_base.h.
float** osl_canny_base::grad_ [protected, inherited] |
Definition at line 66 of file osl_canny_base.h.
float osl_canny_base::high_ [protected, inherited] |
Definition at line 86 of file osl_canny_base.h.
bool osl_canny_ox::join_flag_OX_ [protected] |
Definition at line 101 of file osl_canny_ox.h.
int** osl_canny_base::junction_ [protected, inherited] |
Definition at line 73 of file osl_canny_base.h.
int osl_canny_ox::junction_option_OX_ [protected] |
Definition at line 102 of file osl_canny_ox.h.
float osl_canny_base::jval_ [protected, inherited] |
Definition at line 88 of file osl_canny_base.h.
int** osl_canny_base::jx_ [protected, inherited] |
Definition at line 74 of file osl_canny_base.h.
int ** osl_canny_base::jy_ [protected, inherited] |
Definition at line 74 of file osl_canny_base.h.
int osl_canny_base::k_size_ [protected, inherited] |
Definition at line 83 of file osl_canny_base.h.
float* osl_canny_base::kernel_ [protected, inherited] |
Definition at line 84 of file osl_canny_base.h.
float osl_canny_base::low_ [protected, inherited] |
Definition at line 85 of file osl_canny_base.h.
int osl_canny_ox::max_width_OX_ [protected] |
Definition at line 82 of file osl_canny_ox.h.
int osl_canny_ox::min_length_OX_ [protected] |
Definition at line 87 of file osl_canny_ox.h.
float osl_canny_ox::scale_OX_ [protected] |
Definition at line 91 of file osl_canny_ox.h.
float osl_canny_base::sigma_ [protected, inherited] |
Definition at line 80 of file osl_canny_base.h.
float** osl_canny_base::smooth_ [protected, inherited] |
Definition at line 63 of file osl_canny_base.h.
float* osl_canny_ox::sub_area_OX_ [protected] |
Definition at line 83 of file osl_canny_ox.h.
float** osl_canny_base::theta_ [protected, inherited] |
Definition at line 70 of file osl_canny_base.h.
float** osl_canny_base::thick_ [protected, inherited] |
Definition at line 68 of file osl_canny_base.h.
float** osl_canny_base::thin_ [protected, inherited] |
Definition at line 69 of file osl_canny_base.h.
bool osl_canny_base::verbose [protected, inherited] |
Definition at line 90 of file osl_canny_base.h.
vcl_list<osl_Vertex*>* osl_canny_base::vlist_ [protected, inherited] |
Definition at line 77 of file osl_canny_base.h.
int osl_canny_base::w0_ [protected, inherited] |
Definition at line 82 of file osl_canny_base.h.
int osl_canny_base::width_ [protected, inherited] |
Definition at line 81 of file osl_canny_base.h.
vcl_list<int>* osl_canny_base::xjunc_ [protected, inherited] |
Definition at line 75 of file osl_canny_base.h.
unsigned int osl_canny_base::xsize_ [protected, inherited] |
Definition at line 61 of file osl_canny_base.h.
unsigned int osl_canny_base::xstart_ [protected, inherited] |
Definition at line 60 of file osl_canny_base.h.
vcl_list<int>* osl_canny_base::yjunc_ [protected, inherited] |
Definition at line 76 of file osl_canny_base.h.
unsigned int osl_canny_base::ysize_ [protected, inherited] |
Definition at line 61 of file osl_canny_base.h.
unsigned int osl_canny_base::ystart_ [protected, inherited] |
Definition at line 60 of file osl_canny_base.h.