11#include " segmentation.h"
22
33std::tuple<std::vector<std::unique_ptr<SAM>>, SEG::DL_INIT_PARAM,
4- SEG::DL_INIT_PARAM>
4+ SEG::DL_INIT_PARAM, SEG::DL_RESULT, std::vector<SEG::DL_RESULT> >
55Initializer () {
66 std::vector<std::unique_ptr<SAM>> samSegmentors;
77 samSegmentors.push_back (std::make_unique<SAM>());
@@ -11,7 +11,8 @@ Initializer() {
1111 std::unique_ptr<SAM> samSegmentorDecoder = std::make_unique<SAM>();
1212 SEG::DL_INIT_PARAM params_encoder;
1313 SEG::DL_INIT_PARAM params_decoder;
14-
14+ SEG::DL_RESULT res;
15+ std::vector<SEG::DL_RESULT> resSam;
1516 params_encoder.rectConfidenceThreshold = 0.1 ;
1617 params_encoder.iouThreshold = 0.5 ;
1718 params_encoder.modelPath = " /home/amigo//Documents/repos/sam_onnx_ros/build/SAM_encoder.onnx" ;
@@ -31,22 +32,21 @@ Initializer() {
3132 samSegmentorDecoder->CreateSession (params_decoder);
3233 samSegmentors[0 ] = std::move (samSegmentorEncoder);
3334 samSegmentors[1 ] = std::move (samSegmentorDecoder);
34- return {std::move (samSegmentors), params_encoder, params_decoder};
35+ return {std::move (samSegmentors), params_encoder, params_decoder, res, resSam };
3536}
3637
37- std::vector<cv::Mat>
38- SegmentAnything (std::vector<std::unique_ptr<SAM>> &samSegmentors,
38+ void SegmentAnything (std::vector<std::unique_ptr<SAM>> &samSegmentors,
3939 const SEG::DL_INIT_PARAM ¶ms_encoder,
40- const SEG::DL_INIT_PARAM ¶ms_decoder, cv::Mat &img) {
40+ const SEG::DL_INIT_PARAM ¶ms_decoder, const cv::Mat &img, std::vector<SEG::DL_RESULT> &resSam,
41+ SEG::DL_RESULT &res) {
42+
4143
42- std::vector<SEG::DL_RESULT> resSam;
43- SEG::DL_RESULT res;
4444
4545 SEG::MODEL_TYPE modelTypeRef = params_encoder.modelType ;
4646 samSegmentors[0 ]->RunSession (img, resSam, modelTypeRef, res);
4747
4848 modelTypeRef = params_decoder.modelType ;
4949 samSegmentors[1 ]->RunSession (img, resSam, modelTypeRef, res);
5050
51- return std::move (res.masks );
51+ // return std::move(res.masks);
5252}
0 commit comments