Difference between revisions of "Function:CountInRange"

From CUVI Wiki
Line 80: Line 80:


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


</syntaxhighlight>
</syntaxhighlight>
|}
|}

Revision as of 18:26, 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 = new Cuvi32u[nChannels];
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);