FastDeploy  latest
Fast & Easy to Deploy!
Namespaces | Classes | Functions
fastdeploy::vision Namespace Reference

All C++ FastDeploy Vision Models APIs are defined inside this namespace. More...

Namespaces

 classification
 All object classification model APIs are defined inside this namespace.
 
 detection
 All object detection model APIs are defined inside this namespace.
 
 facedet
 All object face detection model APIs are defined inside this namespace.
 
 keypointdetection
 All keypoint detection model APIs are defined inside this namespace.
 
 matting
 All image/video matting model APIs are defined inside this namespace.
 
 ocr
 All OCR series model APIs are defined inside this namespace.
 
 segmentation
 All segmentation model APIs are defined inside this namespace.
 

Classes

class  BGR2GRAY
 Processor for tansform images from BGR to GRAY. More...
 
class  BGR2RGB
 Processor for tansform images from BGR to RGB. More...
 
class  Cast
 Processor for cast images with given type deafault is float. More...
 
class  CenterCrop
 Processor for crop images in center with given type deafault is float. More...
 
struct  ClassifyResult
 Classify result structure for all the image classify models. More...
 
class  Convert
 Processor for convert images with given paramters. More...
 
class  ConvertAndPermute
 Processor for convert images with given paramters and permute images from HWC to CHW. More...
 
class  Crop
 Processor for crop images with given paramters. More...
 
struct  DetectionResult
 Detection result structure for all the object detection models and instance segmentation models. More...
 
struct  FaceAlignmentResult
 Face Alignment result structure for all the face alignment models. More...
 
struct  FaceDetectionResult
 Face detection result structure for all the face detection models. More...
 
struct  FaceRecognitionResult
 Face recognition result structure for all the Face recognition models. More...
 
struct  FDMatBatch
 FDMatBatch contains batch data for preprocess. More...
 
struct  HeadPoseResult
 HeadPose result structure for all the headpose models. More...
 
class  HWC2CHW
 Processor for transform images from HWC to CHW. More...
 
struct  KeyPointDetectionResult
 KeyPoint Detection result structure for all the keypoint detection models. More...
 
class  LimitByStride
 Processor for LimitByStride images with given paramters. More...
 
class  LimitShort
 Processor for Limit images by short edge with given paramters. More...
 
struct  Mask
 
struct  Mat
 FDMat is a structure for replace cv::Mat. More...
 
struct  MattingResult
 Matting result structure for all the Matting models. More...
 
struct  MOTResult
 MOT(Multi-Object Tracking) result structure for all the MOT models. More...
 
class  Normalize
 Processor for Normalize images with given paramters. More...
 
class  NormalizeAndPermute
 Processor for Normalize and Permute images from HWC to CHW. More...
 
class  Pad
 Processor for padding images. More...
 
class  PadToSize
 Processor for padding images to given size. More...
 
class  Processor
 Processor base class for processors in fastdeploy/vision/common/processors. More...
 
class  ProcessorManager
 ProcessorManager for Preprocess. More...
 
class  Resize
 Processor for Resize images. More...
 
class  ResizeByShort
 Processor for resize images by short edge. More...
 
class  RGB2BGR
 Processor for tansform images from RGB to BGR. More...
 
class  RGB2GRAY
 Processor for tansform images from RGB to GRAY. More...
 
struct  SegmentationResult
 Segmentation result structure for all the segmentation models. More...
 
class  StridePad
 Processor for padding images with stride. More...
 

Functions

void EnableFlyCV ()
 Enable using FlyCV to process image while deploy vision models. Currently, FlyCV in only available on ARM(Linux aarch64/Android), so will fallback to using OpenCV in other platform.
 
void DisableFlyCV ()
 Disable using FlyCV to process image while deploy vision models.
 
void SetProcLibCpuNumThreads (int threads)
 Set the cpu num threads of ProcLib.
 
cv::Mat VisClassification (const cv::Mat &im, const ClassifyResult &result, int top_k=5, float score_threshold=0.0f, float font_size=0.5f)
 Show the visualized results for classification models. More...
 
cv::Mat VisClassification (const cv::Mat &im, const ClassifyResult &result, const std::vector< std::string > &labels, int top_k=5, float score_threshold=0.0f, float font_size=0.5f)
 Show the visualized results with custom labels for classification models. More...
 
cv::Mat VisDetection (const cv::Mat &im, const DetectionResult &result, float score_threshold=0.0, int line_size=1, float font_size=0.5f)
 Show the visualized results for detection models. More...
 
cv::Mat VisDetection (const cv::Mat &im, const DetectionResult &result, const std::vector< std::string > &labels, float score_threshold=0.0, int line_size=1, float font_size=0.5f)
 Show the visualized results with custom labels for detection models. More...
 
cv::Mat VisFaceAlignment (const cv::Mat &im, const FaceAlignmentResult &result, int line_size=1)
 Show the visualized results for face alignment models. More...
 
cv::Mat VisFaceDetection (const cv::Mat &im, const FaceDetectionResult &result, int line_size=1, float font_size=0.5f)
 Show the visualized results for face detection models. More...
 
cv::Mat VisKeypointDetection (const cv::Mat &im, const KeyPointDetectionResult &results, float conf_threshold=0.5f)
 Show the visualized results for key point detection models. More...
 
cv::Mat VisMatting (const cv::Mat &im, const MattingResult &result, bool transparent_background=false, float transparent_threshold=0.999, bool remove_small_connected_area=false)
 Show the visualized results for matting models. More...
 
cv::Mat VisOcr (const cv::Mat &im, const OCRResult &ocr_result, const float score_threshold=0)
 Show the visualized results for Ocr models. More...
 
cv::Mat VisSegmentation (const cv::Mat &im, const SegmentationResult &result, float weight=0.5)
 Show the visualized results for segmentation models. More...
 
cv::Mat SwapBackground (const cv::Mat &im, const cv::Mat &background, const MattingResult &result, bool remove_small_connected_area=false)
 Swap the image background with MattingResult. More...
 
cv::Mat SwapBackground (const cv::Mat &im, const cv::Mat &background, const SegmentationResult &result, int background_label)
 Swap the image background with SegmentationResult. More...
 

Detailed Description

All C++ FastDeploy Vision Models APIs are defined inside this namespace.

Function Documentation

◆ SwapBackground() [1/2]

FASTDEPLOY_DECL cv::Mat fastdeploy::vision::SwapBackground ( const cv::Mat &  im,
const cv::Mat &  background,
const MattingResult result,
bool  remove_small_connected_area = false 
)

Swap the image background with MattingResult.

Parameters
[in]imthe input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
[in]backgroundthe background image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
[in]resultthe MattingResult produced by model
[in]remove_small_connected_areaif remove_small_connected_area==true, the visualized result will not include the small connected areas
Returns
cv::Mat type stores the visualized results

◆ SwapBackground() [2/2]

FASTDEPLOY_DECL cv::Mat fastdeploy::vision::SwapBackground ( const cv::Mat &  im,
const cv::Mat &  background,
const SegmentationResult result,
int  background_label 
)

Swap the image background with SegmentationResult.

Parameters
[in]imthe input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
[in]backgroundthe background image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
[in]resultthe SegmentationResult produced by model
[in]background_labelthe background label number in SegmentationResult
Returns
cv::Mat type stores the visualized results

◆ VisClassification() [1/2]

FASTDEPLOY_DECL cv::Mat fastdeploy::vision::VisClassification ( const cv::Mat &  im,
const ClassifyResult result,
int  top_k = 5,
float  score_threshold = 0.0f,
float  font_size = 0.5f 
)

Show the visualized results for classification models.

Parameters
[in]imthe input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
[in]resultthe result produced by model
[in]top_kthe length of return values, e.g., if topk==2, the result will include the 2 most possible class label for input image.
[in]score_thresholdthreshold for top_k scores, the class will not be shown if the score is less than score_threshold
[in]font_sizefont size
Returns
cv::Mat type stores the visualized results

◆ VisClassification() [2/2]

FASTDEPLOY_DECL cv::Mat fastdeploy::vision::VisClassification ( const cv::Mat &  im,
const ClassifyResult result,
const std::vector< std::string > &  labels,
int  top_k = 5,
float  score_threshold = 0.0f,
float  font_size = 0.5f 
)

Show the visualized results with custom labels for classification models.

Parameters
[in]imthe input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
[in]resultthe result produced by model
[in]labelscustom labels for user, the visualized result will show the corresponding custom labels
[in]top_kthe length of return values, e.g., if topk==2, the result will include the 2 most possible class label for input image.
[in]score_thresholdthreshold for top_k scores, the class will not be shown if the score is less than score_threshold
[in]font_sizefont size
Returns
cv::Mat type stores the visualized results

◆ VisDetection() [1/2]

FASTDEPLOY_DECL cv::Mat fastdeploy::vision::VisDetection ( const cv::Mat &  im,
const DetectionResult result,
float  score_threshold = 0.0,
int  line_size = 1,
float  font_size = 0.5f 
)

Show the visualized results for detection models.

Parameters
[in]imthe input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
[in]resultthe result produced by model
[in]score_thresholdthreshold for result scores, the bounding box will not be shown if the score is less than score_threshold
[in]line_sizeline size for bounding boxes
[in]font_sizefont size for text
Returns
cv::Mat type stores the visualized results

◆ VisDetection() [2/2]

FASTDEPLOY_DECL cv::Mat fastdeploy::vision::VisDetection ( const cv::Mat &  im,
const DetectionResult result,
const std::vector< std::string > &  labels,
float  score_threshold = 0.0,
int  line_size = 1,
float  font_size = 0.5f 
)

Show the visualized results with custom labels for detection models.

Parameters
[in]imthe input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
[in]resultthe result produced by model
[in]labelsthe visualized result will show the bounding box contain class label
[in]score_thresholdthreshold for result scores, the bounding box will not be shown if the score is less than score_threshold
[in]line_sizeline size for bounding boxes
[in]font_sizefont size for text
Returns
cv::Mat type stores the visualized results

◆ VisFaceAlignment()

FASTDEPLOY_DECL cv::Mat fastdeploy::vision::VisFaceAlignment ( const cv::Mat &  im,
const FaceAlignmentResult result,
int  line_size = 1 
)

Show the visualized results for face alignment models.

Parameters
[in]imthe input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
[in]resultthe result produced by model
[in]line_sizeline size for circle point
Returns
cv::Mat type stores the visualized results

◆ VisFaceDetection()

FASTDEPLOY_DECL cv::Mat fastdeploy::vision::VisFaceDetection ( const cv::Mat &  im,
const FaceDetectionResult result,
int  line_size = 1,
float  font_size = 0.5f 
)

Show the visualized results for face detection models.

Parameters
[in]imthe input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
[in]resultthe result produced by model
[in]line_sizeline size for bounding boxes
[in]font_sizefont size for text
Returns
cv::Mat type stores the visualized results

◆ VisKeypointDetection()

FASTDEPLOY_DECL cv::Mat fastdeploy::vision::VisKeypointDetection ( const cv::Mat &  im,
const KeyPointDetectionResult results,
float  conf_threshold = 0.5f 
)

Show the visualized results for key point detection models.

Parameters
[in]imthe input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
[in]resultsthe result produced by model
[in]conf_thresholdthreshold for result scores, the result will not be shown if the score is less than conf_threshold
Returns
cv::Mat type stores the visualized results

◆ VisMatting()

FASTDEPLOY_DECL cv::Mat fastdeploy::vision::VisMatting ( const cv::Mat &  im,
const MattingResult result,
bool  transparent_background = false,
float  transparent_threshold = 0.999,
bool  remove_small_connected_area = false 
)

Show the visualized results for matting models.

Parameters
[in]imthe input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
[in]resultthe result produced by model
[in]transparent_backgroundif transparent_background==true, the background will with transparent color
[in]transparent_thresholdsince the alpha value in MattringResult is a float between [0, 1], transparent_threshold is used to filter background pixel
[in]remove_small_connected_areaif remove_small_connected_area==true, the visualized result will not include the small connected areas
Returns
cv::Mat type stores the visualized results

◆ VisOcr()

FASTDEPLOY_DECL cv::Mat fastdeploy::vision::VisOcr ( const cv::Mat &  im,
const OCRResult &  ocr_result,
const float  score_threshold = 0 
)

Show the visualized results for Ocr models.

Parameters
[in]imthe input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
[in]resultthe result produced by model
Returns
cv::Mat type stores the visualized results

◆ VisSegmentation()

FASTDEPLOY_DECL cv::Mat fastdeploy::vision::VisSegmentation ( const cv::Mat &  im,
const SegmentationResult result,
float  weight = 0.5 
)

Show the visualized results for segmentation models.

Parameters
[in]imthe input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
[in]resultthe result produced by model
[in]weighttransparent weight of visualized result image
Returns
cv::Mat type stores the visualized results