we usually use functions that return one or no return value.
More than one different type of return value was recently returned on a project. You can use vector to return multiple parameters of the same type. If you can use the C++11 standard, you can use my method below
(1)import the header file.
More than one different type of return value was recently returned on a project. You can use vector to return multiple parameters of the same type. If you can use the C++11 standard, you can use my method below
(1)import the header file.
#include <tuple>
using namespace std;
(2)defined function,you can refer to the following code:
std::tuple<vector<Mat>, bool,Mat, bool,bool,bool,bool,bool,Mat,Mat,int> Table_Detection(Mat srcImage,double firstblackline_rows_ratio_thresh,bool isHorizonLine,double left_right_cols_ratio_thresh,double up_down_rows_ratio_thresh,Mat srcImageBin);
(3)function,you can refer to the following code:The type returned should be the same as the defined type.
std::tuple<vector<Mat>, bool,Mat, bool,bool,bool,bool,bool,Mat,Mat,int> Table_Detection(Mat srcImage,double firstblackline_rows_ratio_thresh,bool isHorizonLine,double left_right_cols_ratio_thresh,double up_down_rows_ratio_thresh,Mat srcImageBin)
{
;
return std::make_tuple(CUT_Table,table_new,Page_Info,isHorizonLine,table_new_cut,istablerecognition,Integrity_Check_Bottom,Integrity_Check_Top,Bottom_Integrity,Top_Integrity,tablesize);
}
(4)Now,you can call the return value. you can refer to the following code:Define a variable to receive the return parameter,the following code defines is the same as the define function.
std::tuple<vector<Mat>, bool,Mat, bool,bool,bool,bool,bool,Mat,Mat,int> data;
You also can use the auto to define. Auto is an adaptive variable in the C++11 standard.
auto data;
You can use the get method to get the data. you can refer to the following code. The code of the get<0>data actually get is CUT_Table.
std::get<0>(data);
std::get<1>(data);
std::get<2>(data);
I hope I can help you,If you have any questions, please comment on this blog or send me a private message. I will reply in my free time.
Read More:
- Map to vector pair map.second sort
- [leetcode] zigzag transformation
- GCC compilation error unknown type name ‘bool’‘
- (element UI component table) how to add a style to a table
- Modification method of starting value of MySQL auto increment ID
- [Solved] Xcode Reportduplicate symbols for architecture x86_64
- RuntimeError: each element in
- The usage of Matlab function downsample
- R language: na.fail and na.omit
- Lua — using remove to delete table data
- Hive view execution plan
- ValueError: too many values to unpack
- Solution to the problem that SQL database query result field contains new line character, which leads to copy to excel dislocation
- Finding the longest connection path of a string
- Split keyword in ABAP when the separator is at the beginning and end of the string
- How to compare the equality of structures in golang
- Implementation of tupledesc and tuple in mit6.830 lab1 / exercise 1
- Python opencv (3) get image size
- C++:error C2228: left of ‘.str’ must have class/struct/union
- 【error】postgresql relation does not exist