Function:Threshold

From CUVI Wiki
Jump to: navigation, search

Clamps image pixel values between specified thresholds.

Function

CuviStatus threshold(const CuviImage& src,
                     CuviImage& dst,
                     const CuviScalar& minThresh,
                     const CuviScalar& maxThresh,
                     const CuviStream& stream = CuviStream());

Parameters

Name Type Description
src const CuviImage& Input Image
dst CuviImage& Destination Image
minThresh const CuviScalar& Minimum value of threshold
maxThresh const CuviScalar& Maximum value of threshold
stream const CuviStream& GPU stream ID for execution

Image Type Support

Input Output
8u 8u
16u 16u

Example

//Creating GPU images
CuviImage gimg = cuvi:io::loadImage(path), gout;
 
CuviScalar minThresh(10,20,20);
CuviScalar maxThresh(100,200,150);
 
//Apply threshold on image pixel values
cuvi::dataExchange::threshold(gimg,gout,minThresh, maxThresh);