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 ==
"createLaplacePyr") {
52 nargchk(nrhs>=4 && (nrhs%2)==0 && nlhs<=1);
54 for (
int i=4; i<nrhs; i+=2) {
55 string key(rhs[i].toString());
57 use_gpu = rhs[i+1].toBool();
60 "Unrecognized option %s", key.
c_str());
63 int num_levels = rhs[3].toInt();
76 else if (method ==
"restoreImageFromLaplacePyr") {
77 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=1);
79 for (
int i=3; i<nrhs; i+=2) {
80 string key(rhs[i].toString());
82 use_gpu = rhs[i+1].toBool();
85 "Unrecognized option %s", key.
c_str());
101 else if (method ==
"overlapRoi") {
103 Point tl1(rhs[2].toPoint()),
104 tl2(rhs[3].toPoint());
105 Size sz1(rhs[4].toSize()),
106 sz2(rhs[5].toSize());
108 bool success =
overlapRoi(tl1, tl2, sz1, sz2, roi);
116 else if (method ==
"resultRoi") {
124 else if (method ==
"resultRoiIntersection") {
132 else if (method ==
"resultTl") {
144 if (method ==
"delete") {
149 else if (method ==
"typeid") {
151 plhs[0] =
MxArray(
string(
typeid(*obj).name()));
153 else if (method ==
"prepare") {
154 nargchk((nrhs==3 || nrhs==4) && nlhs==0);
161 Rect dst_roi(rhs[2].toRect());
165 else if (method ==
"feed") {
169 Point tl(rhs[4].toPoint());
170 obj->
feed(img, mask, tl);
172 else if (method ==
"blend") {
173 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=2);
175 for (
int i=2; i<nrhs; i+=2) {
176 string key(rhs[i].toString());
178 dst = rhs[i+1].toMat(rhs[i+1].isUint8() ?
CV_8U :
CV_16S);
179 else if (key ==
"Mask")
180 dst_mask = rhs[i+1].toMat(
CV_8U);
183 "Unrecognized option %s", key.
c_str());
185 obj->
blend(dst, dst_mask);
190 else if (method ==
"createWeightMaps") {
194 "Only supported for FeatherBlender");
208 plhs[0] =
MxArray(weight_maps_);
214 "Unrecognized operation %s", method.
c_str());
void createLaplacePyrGpu(InputArray img, int num_levels, std::vector< UMat > &pyr)
Common definitions for the stitching module.
void createLaplacePyr(InputArray img, int num_levels, std::vector< UMat > &pyr)
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
Rect createWeightMaps(const std::vector< UMat > &masks, const std::vector< Point > &corners, std::vector< UMat > &weight_maps)
struct mxArray_tag mxArray
Forward declaration for mxArray.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
cv::Ptr< cv::detail::Blender > createBlender(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of Blender using options in arguments.
virtual void feed(InputArray img, InputArray mask, Point tl)
Ptr< Y > dynamicCast() const
map< int, Ptr< Blender > > 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 prepare(const std::vector< Point > &corners, const std::vector< Size > &sizes)
Global constant definitions.
virtual void blend(InputOutputArray dst, InputOutputArray dst_mask)
bool overlapRoi(Point tl1, Point tl2, Size sz1, Size sz2, Rect &roi)
int last_id
Last object id to allocate.
Rect resultRoiIntersection(const std::vector< Point > &corners, const std::vector< Size > &sizes)
void restoreImageFromLaplacePyrGpu(std::vector< UMat > &pyr)
void restoreImageFromLaplacePyr(std::vector< UMat > &pyr)
Point resultTl(const std::vector< Point > &corners)
Rect resultRoi(const std::vector< Point > &corners, const std::vector< UMat > &images)