9 #include "opencv2/ximgproc.hpp" 17 (
"ARO_0_45", cv::ximgproc::ARO_0_45)
18 (
"ARO_45_90", cv::ximgproc::ARO_45_90)
19 (
"ARO_90_135", cv::ximgproc::ARO_90_135)
20 (
"ARO_315_0", cv::ximgproc::ARO_315_0)
21 (
"ARO_315_45", cv::ximgproc::ARO_315_45)
22 (
"ARO_45_135", cv::ximgproc::ARO_45_135)
23 (
"ARO_315_135", cv::ximgproc::ARO_315_135)
24 (
"ARO_CTR_HOR", cv::ximgproc::ARO_CTR_HOR)
25 (
"ARO_CTR_VER", cv::ximgproc::ARO_CTR_VER);
29 (
"Raw", cv::ximgproc::HDO_RAW)
30 (
"Deskew", cv::ximgproc::HDO_DESKEW);
34 (
"Strict", cv::ximgproc::RO_STRICT)
35 (
"IgnoreBorders", cv::ximgproc::RO_IGNORE_BORDERS);
45 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
48 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
51 vector<MxArray> rhs(prhs, prhs+nrhs);
54 int angleRange = cv::ximgproc::ARO_315_135;
55 int makeSkew = cv::ximgproc::HDO_DESKEW;
56 int rules = cv::ximgproc::RO_IGNORE_BORDERS;
57 for (
int i=2; i<nrhs; i+=2) {
58 string key(rhs[i].toString());
59 if (key ==
"AngleRange")
60 angleRange = AngleRangeOptionMap[rhs[i+1].toString()];
61 else if (key ==
"MakeSkew")
62 makeSkew = HoughDeskewOptionMap[rhs[i+1].toString()];
63 else if (key ==
"Rules")
64 rules = RulesOptionMap[rhs[i+1].toString()];
66 mexErrMsgIdAndTxt(
"mexopencv:error",
67 "Unrecognized option %s", key.c_str());
71 Point houghPoint(rhs[0].toPoint());
72 Mat src(rhs[1].toMat());
73 Vec4i line = HoughPoint2Line(houghPoint, src, angleRange, makeSkew, rules);
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/ouput arguments number check.
Global constant definitions.
std::map wrapper with one-line initialization and lookup method.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.