From f385bb97eb5223272d10e40ec38c5e9c54f9c197 Mon Sep 17 00:00:00 2001 From: James Bowman Date: Thu, 21 Apr 2011 00:47:37 +0000 Subject: [PATCH] datamatrix --- .../objdetect/include/opencv2/objdetect/objdetect.hpp | 4 ++-- modules/objdetect/src/datamatrix.cpp | 6 +++--- modules/python/src/cv.cpp | 9 +++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/modules/objdetect/include/opencv2/objdetect/objdetect.hpp b/modules/objdetect/include/opencv2/objdetect/objdetect.hpp index f67f67da6..055a44dc7 100644 --- a/modules/objdetect/include/opencv2/objdetect/objdetect.hpp +++ b/modules/objdetect/include/opencv2/objdetect/objdetect.hpp @@ -623,14 +623,14 @@ protected: typedef unsigned char uint8; -class DatamatrixCode { +class DataMatrixCode { public: char msg[4]; CvMat *original; CvMat *corners; }; #include -std::deque findcodes(CvMat *im); +std::deque cvFindDataMatrix(CvMat *im); #endif diff --git a/modules/objdetect/src/datamatrix.cpp b/modules/objdetect/src/datamatrix.cpp index 47414e418..3a8390618 100644 --- a/modules/objdetect/src/datamatrix.cpp +++ b/modules/objdetect/src/datamatrix.cpp @@ -280,7 +280,7 @@ static deque trailto(CvMat *v, int x, int y, CvMat *terminal) return r; } -deque findcodes(CvMat *im) +deque cvFindDataMatrix(CvMat *im) { int r = im->rows; int c = im->cols; @@ -409,9 +409,9 @@ endo: ; // end search for this o cvFree(&cxy); cvFree(&ccxy); - deque rc; + deque rc; for (i = 0; i < codes.size(); i++) { - DatamatrixCode cc; + DataMatrixCode cc; strcpy(cc.msg, codes[i].msg); cc.original = codes[i].original; cc.corners = codes[i].sa.perim; diff --git a/modules/python/src/cv.cpp b/modules/python/src/cv.cpp index 7c321703f..3ac32d3d4 100644 --- a/modules/python/src/cv.cpp +++ b/modules/python/src/cv.cpp @@ -3677,7 +3677,7 @@ static PyObject *pycvClipLine(PyObject *self, PyObject *args) } } -static PyObject *pyfindcodes(PyObject *self, PyObject *args) +static PyObject *pyfinddatamatrix(PyObject *self, PyObject *args) { PyObject *pyim; if (!PyArg_ParseTuple(args, "O", &pyim)) @@ -3686,12 +3686,13 @@ static PyObject *pyfindcodes(PyObject *self, PyObject *args) CvMat *image; if (!convert_to_CvMat(pyim, &image, "image")) return NULL; - std::deque codes = findcodes(image); + std::deque codes; + ERRWRAP(codes = cvFindDataMatrix(image)); PyObject *pycodes = PyList_New(codes.size()); int i; for (i = 0; i < codes.size(); i++) { - DatamatrixCode *pc = &codes[i]; + DataMatrixCode *pc = &codes[i]; PyList_SetItem(pycodes, i, Py_BuildValue("(sOO)", pc->msg, FROM_CvMat(pc->corners), FROM_CvMat(pc->original))); } @@ -3992,7 +3993,7 @@ static PyMethodDef methods[] = { //{"_HOGDetect", (PyCFunction)pycvHOGDetect, METH_KEYWORDS, "_HOGDetect(image, svm_classifier, win_stride=block_stride, locations=None, padding=(0,0), win_size=(64,128), block_size=(16,16), block_stride=(8,8), cell_size=(8,8), nbins=9, gammaCorrection=true) -> list_of_points"}, //{"_HOGDetectMultiScale", (PyCFunction)pycvHOGDetectMultiScale, METH_KEYWORDS, "_HOGDetectMultiScale(image, svm_classifier, win_stride=block_stride, scale=1.05, group_threshold=2, padding=(0,0), win_size=(64,128), block_size=(16,16), block_stride=(8,8), cell_size=(8,8), nbins=9, gammaCorrection=true) -> list_of_points"}, - {"findcodes", pyfindcodes, METH_VARARGS}, + {"FindDataMatrix", pyfinddatamatrix, METH_VARARGS}, {"temp_test", temp_test, METH_VARARGS}, #include "generated1.i"