Direct Graphical Models
v.1.7.0
|
Global-features extraction. More...
Functions | |
size_t | getNumLines (const Mat &img, int threshold1=100, int threshold2=50) |
Returns the number of staight lines in the image. More... | |
size_t | getNumCircles (const Mat &img, int threshold1=100, int threshold2=30) |
Returns the number of circles in the source image. More... | |
float | getOpacity (const Mat &img) |
Returns the weighted-mean transparancy of the source image. More... | |
float | getVariance (const Mat &img) |
Retunrs the variance of the source image. More... | |
int | getArea (const Mat &img) |
Returns the number of non-zero pixels in the source image. More... | |
int | getPerimeter (const Mat &img) |
Returns the perimeter of an object in the source image. More... | |
float | getCompactness (const Mat &img) |
Returns the compactness of the object in the source image. More... | |
Global-features extraction.
This namespace collects methods for the global features extraction
int DirectGraphicalModels::fex::global::getArea | ( | const Mat & | img | ) |
Returns the number of non-zero pixels in the source image.
img | The source image of type CV_8UC1 or CV_8UC3. |
Definition at line 155 of file Global.cpp.
float DirectGraphicalModels::fex::global::getCompactness | ( | const Mat & | img | ) |
Returns the compactness of the object in the source image.
The compactness is calculates as follows: \(\frac{P^2}{4\Pi S}\), where P and S are perimeter and area of the object, respectively.
img | The source image of type CV_8UC1 or CV_8UC3. |
Definition at line 194 of file Global.cpp.
size_t DirectGraphicalModels::fex::global::getNumCircles | ( | const Mat & | img, |
int | threshold1 = 100 , |
||
int | threshold2 = 30 |
||
) |
Returns the number of circles in the source image.
img | The source image of type CV_8UC1 or CV_8UC3. |
threshold1 | The higher threshold of the two, passed to the Canny edge detector (the lower one is twice smaller). |
threshold2 | The accumulator threshold for the circle centers at the detection stage. The smaller it is, the more false circles may be detected. Circles, corresponding to the larger accumulator values, will be returned first. |
Definition at line 71 of file Global.cpp.
size_t DirectGraphicalModels::fex::global::getNumLines | ( | const Mat & | img, |
int | threshold1 = 100 , |
||
int | threshold2 = 50 |
||
) |
Returns the number of staight lines in the image.
img | The source image of type CV_8UC1 or CV_8UC3. |
threshold1 | The higher threshold of the two, passed to the Canny edge detector (the lower one is twice smaller). |
threshold2 | The accumulator threshold parameter. Only those lines are detected that get enough votes ( > threshold2). |
Definition at line 5 of file Global.cpp.
float DirectGraphicalModels::fex::global::getOpacity | ( | const Mat & | img | ) |
Returns the weighted-mean transparancy of the source image.
The weighted-mean transparancy is evaluated as follows:
\[ \frac{1}{width \times hight} \sum^{width}_{x = 1}\sum^{height}_{y = 1} (1 - d_{x,y}) \cdot (img_{x,y} - \mu), \]
where \(d_{x,y}\) is the normalized distance between a position \((x,y)\) and the image center.
img | The source image of type CV_8UC1 or CV_8UC3. |
Definition at line 112 of file Global.cpp.
int DirectGraphicalModels::fex::global::getPerimeter | ( | const Mat & | img | ) |
Returns the perimeter of an object in the source image.
This function retunrs the number of edge pixels, assuming a pixel to belong to an edge if any of its neighboring pixels have different value.
img | The source image of type CV_8UC1 or CV_8UC3. |
Definition at line 172 of file Global.cpp.
float DirectGraphicalModels::fex::global::getVariance | ( | const Mat & | img | ) |
Retunrs the variance of the source image.
img | The source image of type CV_8UC1 or CV_8UC3. |
Definition at line 141 of file Global.cpp.