mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-05 16:48:03 +08:00
[Other] Add comments for swap_background api (#941)
* Update keypointdetection result docs * Update im.copy() to im in examples * Update new Api, fastdeploy::vision::Visualize to fastdeploy::vision * Update SwapBackgroundSegmentation && SwapBackgroundMatting to SwapBackground * Update README_CN.md * Update README_CN.md * Add comments for swap_background Api
This commit is contained in:
@@ -161,9 +161,26 @@ FASTDEPLOY_DECL cv::Mat VisOcr(const cv::Mat& im, const OCRResult& ocr_result);
|
|||||||
FASTDEPLOY_DECL cv::Mat VisMOT(const cv::Mat& img, const MOTResult& results,
|
FASTDEPLOY_DECL cv::Mat VisMOT(const cv::Mat& img, const MOTResult& results,
|
||||||
float score_threshold = 0.0f,
|
float score_threshold = 0.0f,
|
||||||
tracking::TrailRecorder* recorder = nullptr);
|
tracking::TrailRecorder* recorder = nullptr);
|
||||||
FASTDEPLOY_DECL cv::Mat SwapBackground(
|
/** \brief Swap the image background with MattingResult
|
||||||
const cv::Mat& im, const cv::Mat& background, const MattingResult& result,
|
*
|
||||||
bool remove_small_connected_area = false);
|
* \param[in] im the input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
|
||||||
|
* \param[in] background the background image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
|
||||||
|
* \param[in] result the MattingResult produced by model
|
||||||
|
* \param[in] remove_small_connected_area if remove_small_connected_area==true, the visualized result will not include the small connected areas
|
||||||
|
* \return cv::Mat type stores the visualized results
|
||||||
|
*/
|
||||||
|
FASTDEPLOY_DECL cv::Mat SwapBackground(const cv::Mat& im,
|
||||||
|
const cv::Mat& background,
|
||||||
|
const MattingResult& result,
|
||||||
|
bool remove_small_connected_area = false);
|
||||||
|
/** \brief Swap the image background with SegmentationResult
|
||||||
|
*
|
||||||
|
* \param[in] im the input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
|
||||||
|
* \param[in] background the background image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
|
||||||
|
* \param[in] result the SegmentationResult produced by model
|
||||||
|
* \param[in] background_label the background label number in SegmentationResult
|
||||||
|
* \return cv::Mat type stores the visualized results
|
||||||
|
*/
|
||||||
FASTDEPLOY_DECL cv::Mat SwapBackground(const cv::Mat& im,
|
FASTDEPLOY_DECL cv::Mat SwapBackground(const cv::Mat& im,
|
||||||
const cv::Mat& background,
|
const cv::Mat& background,
|
||||||
const SegmentationResult& result,
|
const SegmentationResult& result,
|
||||||
|
@@ -138,6 +138,15 @@ def swap_background(im_data,
|
|||||||
result,
|
result,
|
||||||
remove_small_connected_area=False,
|
remove_small_connected_area=False,
|
||||||
background_label=0):
|
background_label=0):
|
||||||
|
"""Swap the image background with MattingResult or SegmentationResult
|
||||||
|
|
||||||
|
:param im_data: (numpy.ndarray)The input image data, 3-D array with layout HWC, BGR format
|
||||||
|
:param background: (numpy.ndarray)The background image data, 3-D array with layout HWC, BGR format
|
||||||
|
:param result: The result produced by model, MattingResult or SegmentationResult
|
||||||
|
:param remove_small_connected_area: (bool) If remove_small_connected_area==True, the visualized result will not include the small connected areas
|
||||||
|
:param background_label: (int)The background label number in SegmentationResult
|
||||||
|
:return: (numpy.ndarray) image with visualized results
|
||||||
|
"""
|
||||||
if isinstance(result, C.vision.MattingResult):
|
if isinstance(result, C.vision.MattingResult):
|
||||||
return C.vision.swap_background(im_data, background, result,
|
return C.vision.swap_background(im_data, background, result,
|
||||||
remove_small_connected_area)
|
remove_small_connected_area)
|
||||||
|
Reference in New Issue
Block a user