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 (
"Minimum", cv::ximgproc::FHT_MIN)
30 (
"Maximum", cv::ximgproc::FHT_MAX)
31 (
"Addition", cv::ximgproc::FHT_ADD)
32 (
"Average", cv::ximgproc::FHT_AVE);
36 (
"Raw", cv::ximgproc::HDO_RAW)
37 (
"Deskew", cv::ximgproc::HDO_DESKEW);
47 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
50 nargchk(nrhs>=1 && (nrhs%2)==1 && nlhs<=1);
53 vector<MxArray> rhs(prhs, prhs+nrhs);
56 int dstMatDepth = CV_32S;
57 int angleRange = cv::ximgproc::ARO_315_135;
58 int op = cv::ximgproc::FHT_ADD;
59 int makeSkew = cv::ximgproc::HDO_DESKEW;
60 for (
int i=1; i<nrhs; i+=2) {
61 string key(rhs[i].toString());
63 dstMatDepth = (rhs[i+1].isChar()) ?
65 else if (key ==
"AngleRange")
66 angleRange = AngleRangeOptionMap[rhs[i+1].toString()];
68 angleRange = HoughOpMap[rhs[i+1].toString()];
69 else if (key ==
"MakeSkew")
70 makeSkew = HoughDeskewOptionMap[rhs[i+1].toString()];
72 mexErrMsgIdAndTxt(
"mexopencv:error",
73 "Unrecognized option %s", key.c_str());
77 Mat src(rhs[0].toMat()), dst;
78 FastHoughTransform(src, dst, dstMatDepth, angleRange, op, makeSkew);
const ConstMap< std::string, int > ClassNameMap
Translates class name used in MATLAB to equivalent OpenCV depth.
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.