Function:CountInRange

From CUVI Wiki
Revision as of 11:13, 18 April 2013 by Jawad (talk | contribs)

Counts the number of pixels within the given intensity range

Function

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

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

Count.PNG


Example

CuviImage* gimg = cuvi::io::loadImage(path);

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
cuvi::imageStatistics::countInRange(gimg, count, lowerBound, upperBound);