vitis::ai::Segmentation8UC1 - 3.0 English

Vitis AI Library User Guide (UG1354)

Document ID
UG1354
Release Date
2023-01-12
Version
3.0 English
The class of Segmentation8UC1. This class run function run(const cv::Mat& image) return a cv::Mat with the type is cv_8UC1. Sample code:
   auto det =
vitis::ai::Segmentation8UC1::create(vitis::ai::SEGMENTATION_FPN);
  auto img = cv::imread("sample_segmentation.jpg");
   int width = det->getInputWidth();
   int height = det->getInputHeight();
   cv::Mat image;
   cv::resize(img, image, cv::Size(width, height), 0, 0,
              cv::INTER_LINEAR);
   auto result = det->run(image);
   for (auto y = 0; y < result.segmentation.rows; y++) {
     for (auto x = 0; x < result.segmentation.cols; x++) {
           result.segmentation.at<uchar>(y,x) *= 10;
       }
   }
   cv::imwrite("segres.jpg",result.segmentation);

Quick Function Reference

The following table lists all the functions defined in the vitis::ai::Segmentation8UC1 class:

Table 1. Quick Function Reference
Type Member Arguments
std::unique_ptr< Segmentation8UC1 > create
  • const std::string & model_name
  • bool need_preprocess
int getInputWidth
  • void
int getInputHeight
  • void
size_t get_input_batch
  • void
SegmentationResult run
  • const cv::Mat & image
std::vector< SegmentationResult > run
  • const std::vector< cv::Mat > & images