Difference between revisions of "Function:CountInRange"
From CUVI Wiki
| Line 5: | Line 5: | ||
|style="font-size:150%;"| | |style="font-size:150%;"| | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
CuviStatus countInRange(CuviImage | CuviStatus countInRange(const CuviImage& image, | ||
Cuvi32u* count, | Cuvi32u* count, | ||
Cuvi32f rangeMin, | const Cuvi32f rangeMin, | ||
Cuvi32f rangeMax, | const Cuvi32f rangeMax, | ||
CuviStream | const CuviStream& stream = NULL); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} | ||
| Line 21: | Line 21: | ||
|- | |- | ||
| image | | image | ||
| CuviImage | | const CuviImage& | ||
| Input Image | | Input Image | ||
|- | |- | ||
| Line 29: | Line 29: | ||
|- | |- | ||
| rangeMin | | rangeMin | ||
| | | const Cuvi32f | ||
| Lower limit of the intensity range | | Lower limit of the intensity range | ||
|- | |- | ||
| rangeMax | | rangeMax | ||
| | | const Cuvi32f | ||
| Upper limit of the intensity range | | Upper limit of the intensity range | ||
|- | |- | ||
| stream | | stream | ||
| CuviStream | | const CuviStream& | ||
| GPU stream ID for execution | | GPU stream ID for execution | ||
| Line 69: | Line 69: | ||
CuviImage* gimg = | CuviImage* gimg = cuvi::io::loadImage(path); | ||
Cuvi32u* count = new Cuvi32u[ | Cuvi32u* count = new Cuvi32u[gimg.channels()]; | ||
const Cuvi32f lowerBound = 25.0f; | |||
const Cuvi32f upperBound = 100.0f; | |||
//Returns number of pixels within the given intensity range | //Returns number of pixels within the given intensity range | ||
cuvi:: | cuvi::imageStatistics::countInRange(gimg, count, lowerBound, upperBound); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} | ||
Revision as of 11:13, 18 April 2013
Counts the number of pixels within the given intensity range
Function
|
Parameters
| Name | Type | Description |
|---|---|---|
| image | const CuviImage& | Input Image |
| count | Cuvi32u* | Computed number of pixels within the given intensity range. Returns an array of 3 values in case of 3-channel image |
| rangeMin | const Cuvi32f | Lower limit of the intensity range |
| rangeMax | const Cuvi32f | Upper limit of the intensity range |
| stream | const CuviStream& | GPU stream ID for execution |
Image Type Support
| Input | Output |
|---|---|
| 8uC1 | Cuvi32u single value |
| 8uC3 | Cuvi32u three values |
Sample
Example
|