Commit 4cb25e95 authored by Jason Newton's avatar Jason Newton

update documentation to latest connected components interface

parent 31857082
...@@ -119,47 +119,37 @@ These values are proved to be invariants to the image scale, rotation, and refle ...@@ -119,47 +119,37 @@ These values are proved to be invariants to the image scale, rotation, and refle
.. seealso:: :ocv:func:`matchShapes` .. seealso:: :ocv:func:`matchShapes`
connectedComponents connectedComponents
----------- -----------------------
computes the connected components labeled image of boolean image I with 4 or 8 way connectivity - returns N, the total computes the connected components labeled image of boolean image ``image`` with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image.
number of labels [0, N-1] where 0 represents the background label. L's value type determines the label type, an important
consideration based on the total number of labels or alternatively the total number of pixels.
.. ocv:function:: uint64 connectedComponents(Mat &L, const Mat &I, int connectivity = 8) .. ocv:function:: int connectedComponents(InputArray image, OutputArray labels, int connectivity = 8, int ltype=CV_32S)
.. ocv:function:: uint64 connectedComponentsWithStats(Mat &L, const Mat &I, std::vector<ConnectedComponentStats> &statsv, int connectivity = 8) .. ocv:function:: int connectedComponentsWithStats(InputArray image, OutputArray labels, OutputArray stats, OutputArray centroids, int connectivity = 8, int ltype=CV_32S)
:param L: destitination Labeled image :param image: the image to be labeled
:param I: the image to be labeled :param labels: destination labeled image
:param connectivity: 8 or 4 for 8-way or 4-way connectivity respectively :param connectivity: 8 or 4 for 8-way or 4-way connectivity respectively
:param statsv: statistics for each label, including the background label :param ltype: output image label type. Currently CV_32S and CV_16U are supported.
Statistics information such as bounding box, area, and centroid is exported via the ``ConnectComponentStats`` structure defined as: :: :param statsv: statistics output for each label, including the background label, see below for available statistics. Statistics are accessed via statsv(label, COLUMN) where available columns are defined below.
* **CC_STAT_LEFT** The leftmost (x) coordinate which is the inclusive start of the bounding box in the horizontal
direction.
* **CC_STAT_TOP** The topmost (y) coordinate which is the inclusive start of the bounding box in the vertical
direction.
* **CC_STAT_WIDTH** The horizontal size of the bounding box
* **CC_STAT_HEIGHT** The vertical size of the bounding box
* **CC_STAT_AREA** The total area (in pixels) of the connected component
:param centroids: floating point centroid (x,y) output for each label, including the background label
class CV_EXPORTS ConnectedComponentStats
{
public:
//! lower left corner column
int lower_x;
//! lower left corner row
int lower_y;
//! upper right corner column
int upper_x;
//! upper right corner row
int upper_y;
//! centroid column
double centroid_x;
//! centroid row
double centroid_y;
//! sum of all columns where the image was non-zero
uint64 integral_x;
//! sum of all rows where the image was non-zero
uint64 integral_y;
//! count of all non-zero pixels
unsigned int area;
};
findContours findContours
---------------- ----------------
......
...@@ -1104,12 +1104,12 @@ CV_EXPORTS_W void matchTemplate( InputArray image, InputArray templ, ...@@ -1104,12 +1104,12 @@ CV_EXPORTS_W void matchTemplate( InputArray image, InputArray templ,
enum { CC_STAT_LEFT=0, CC_STAT_TOP=1, CC_STAT_WIDTH=2, CC_STAT_HEIGHT=3, CC_STAT_AREA=4, CC_STAT_MAX = 5}; enum { CC_STAT_LEFT=0, CC_STAT_TOP=1, CC_STAT_WIDTH=2, CC_STAT_HEIGHT=3, CC_STAT_AREA=4, CC_STAT_MAX = 5};
// computes the connected components labeled image of boolean image I // computes the connected components labeled image of boolean image ``image``
// with 4 or 8 way connectivity - returns N, the total // with 4 or 8 way connectivity - returns N, the total
// number of labels [0, N-1] where 0 represents the background label. // number of labels [0, N-1] where 0 represents the background label.
// L's value type determines the label type, an important // ltype specifies the output label image type, an important
// consideration based on the total number of labels or // consideration based on the total number of labels or
// alternatively the total number of pixels. // alternatively the total number of pixels in the source image.
CV_EXPORTS_W int connectedComponents(InputArray image, OutputArray labels, CV_EXPORTS_W int connectedComponents(InputArray image, OutputArray labels,
int connectivity = 8, int ltype=CV_32S); int connectivity = 8, int ltype=CV_32S);
CV_EXPORTS_W int connectedComponentsWithStats(InputArray image, OutputArray labels, CV_EXPORTS_W int connectedComponentsWithStats(InputArray image, OutputArray labels,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment