38 int id = rhs[0].toInt();
39 string method(rhs[1].toString());
42 if (method ==
"new") {
45 rhs[2].toString(), rhs.
begin() + 3, rhs.
end());
51 else if (method ==
"matchesGraphAsString") {
54 float conf_threshold = rhs[3].toFloat();
57 for (
int i=0; i<pairwise_matches.
size(); ++i) {
63 pathes, pairwise_matches, conf_threshold));
67 else if (method ==
"leaveBiggestComponent") {
71 float conf_threshold = rhs[4].toFloat();
73 features, pairwise_matches, conf_threshold));
82 if (method ==
"delete") {
87 else if (method ==
"typeid") {
89 plhs[0] =
MxArray(
string(
typeid(*obj).name()));
91 else if (method ==
"collectGarbage") {
95 else if (method ==
"isThreadSafe") {
100 else if (method ==
"match") {
105 obj->operator()(features1, features2, matches_info);
108 else if (method ==
"match_pairwise") {
109 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=1);
111 for (
int i=3; i<nrhs; i+=2) {
112 string key(rhs[i].toString());
114 mask = rhs[i+1].toMat(
CV_8U);
117 "Unrecognized option %s", key.
c_str());
122 plhs[0] =
toStruct(pairwise_matches);
126 "Unrecognized operation %s", method.
c_str());
Common definitions for the stitching module.
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
std::vector< cv::detail::MatchesInfo > MxArrayToVectorMatchesInfo(const MxArray &arr)
Convert MxArray to std::vector<cv::details::MatchesInfo>
int last_id
Last object id to allocate.
struct mxArray_tag mxArray
Forward declaration for mxArray.
bool isThreadSafe() const
MxArray toStruct(const std::vector< cv::ml::DTrees::Node > &nodes)
Convert tree nodes to struct array.
map< int, Ptr< FeaturesMatcher > > obj_
Object container.
LIBMWMEX_API_EXTERN_C void mexErrMsgIdAndTxt(const char *identifier, const char *err_msg,...)
Issue formatted error message with corresponding error identifier and return to MATLAB prompt...
LIBMWMEX_API_EXTERN_C void mexUnlock(void)
Unlock a locked MEX-function so that it can be cleared from memory.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
Global constant definitions.
std::vector< int > leaveBiggestComponent(std::vector< ImageFeatures > &features, std::vector< MatchesInfo > &pairwise_matches, float conf_threshold)
cv::detail::ImageFeatures MxArrayToImageFeatures(const MxArray &arr, mwIndex idx=0)
Convert MxArray to cv::details::ImageFeatures.
std::vector< cv::detail::ImageFeatures > MxArrayToVectorImageFeatures(const MxArray &arr)
Convert MxArray std::vector<cv::details::ImageFeatures>
UMat getUMat(int accessFlags, UMatUsageFlags usageFlags=USAGE_DEFAULT) const
String matchesGraphAsString(std::vector< String > &pathes, std::vector< MatchesInfo > &pairwise_matches, float conf_threshold)
cv::Ptr< cv::detail::FeaturesMatcher > createFeaturesMatcher(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of FeaturesMatcher using options in arguments.
virtual void collectGarbage()