Difference between revisions of "Function:CountInRange"

From CUVI Wiki
(Created page with "__NOTOC__ Counts the number of pixels within the given intensity range ===Function=== {| |style="font-size:150%;"| <syntaxhighlight lang="cpp"> CuviStatus countInRange(CuviIma...")
 
Line 71: Line 71:
CuviImage* gimg = new CuviImage(size, depth, nChannels);
CuviImage* gimg = new CuviImage(size, depth, nChannels);


Cuvi32u *count = -1;
Cuvi32u count = -1;
Cuvi32f lowerBound = 25;
Cuvi32f lowerBound = 25;
Cuvi32f upperBound = 100;
Cuvi32f upperBound = 100;

Revision as of 07:31, 8 May 2012

Counts the number of pixels within the given intensity range

Function

CuviStatus countInRange(CuviImage* image,
                        Cuvi32u* count,
                        Cuvi32f rangeMin,
                        Cuvi32f rangeMax,
                        CuviStream* stream = NULL);

Parameters

Name Type Description
image 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 Cuvi64f* Lower limit of the intensity range
rangeMax Cuvi64f* Upper limit of the intensity range
stream CuviStream* GPU stream ID for execution

Image Type Support

Input Output
8uC1 Cuvi32u single value
8uC3 Cuvi32u three values

Sample

Count.PNG


Example

CuviImage* gimg = new CuviImage(size, depth, nChannels);

Cuvi32u count = -1;
Cuvi32f lowerBound = 25;
Cuvi32f upperBound = 100;

//Upload input data
gimg->upload(hostImg->imageData, hostImg->widthStep);


//Returns number of pixels within the given intensity range
cuvi::arithmeticLogical::countInRange(gimg, &count, lowerBound, upperBound);