pull/13383/head
James Bowman 14 years ago
parent 4b350e9a09
commit f385bb97eb
  1. 4
      modules/objdetect/include/opencv2/objdetect/objdetect.hpp
  2. 6
      modules/objdetect/src/datamatrix.cpp
  3. 9
      modules/python/src/cv.cpp

@ -623,14 +623,14 @@ protected:
typedef unsigned char uint8;
class DatamatrixCode {
class DataMatrixCode {
public:
char msg[4];
CvMat *original;
CvMat *corners;
};
#include <deque>
std::deque <DatamatrixCode> findcodes(CvMat *im);
std::deque <DataMatrixCode> cvFindDataMatrix(CvMat *im);
#endif

@ -280,7 +280,7 @@ static deque<CvPoint> trailto(CvMat *v, int x, int y, CvMat *terminal)
return r;
}
deque <DatamatrixCode> findcodes(CvMat *im)
deque <DataMatrixCode> 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 <DatamatrixCode> rc;
deque <DataMatrixCode> 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;

@ -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 <DatamatrixCode> codes = findcodes(image);
std::deque <DataMatrixCode> 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"

Loading…
Cancel
Save