From: Tomas Musil Date: Tue, 24 Jun 2014 01:14:13 +0000 (+0200) Subject: more comments in pcf.c X-Git-Url: http://git.tomasm.cz/imago.git/commitdiff_plain/6d19451cd1ebad960d015a79f27ab95f86c31d61?ds=sidebyside;hp=ffbceafad3b67b48c3206a232a99065bc4d00a81 more comments in pcf.c --- diff --git a/imago_pack/hough.py b/imago_pack/hough.py index 2f6e63f..77f30b2 100644 --- a/imago_pack/hough.py +++ b/imago_pack/hough.py @@ -8,7 +8,7 @@ import pcf class Hough: def __init__(self, size, dt, init_angle, image): - self.size = size + self.size = size # TODO is this a tuple? This language is crazy self.dt = dt self.initial_angle = init_angle self.image = image diff --git a/pcf.c b/pcf.c index 46fb6f7..cc41aa3 100644 --- a/pcf.c +++ b/pcf.c @@ -1,6 +1,9 @@ #include #include +/* TODO delete or document this + * + */ static PyObject* py_combine(PyObject* self, PyObject* args) { const unsigned char *im_bg; @@ -27,7 +30,7 @@ static PyObject* py_combine(PyObject* self, PyObject* args) /* Hough transform * - * Takes dimentions of the image, the image, TODO size of what?, initial angle and TODO dt is what?. + * Takes dimentions of the image, the image, initial angle and TODO dt is what?. * Computes Hough transform of the image. TODO size etc. * */ @@ -54,6 +57,9 @@ static PyObject* py_hough(PyObject* self, PyObject* args) PyObject *result; if (!PyArg_ParseTuple(args, "(ii)s#dd", &x, &y, &image, &size, &init_angle, &dt)) return NULL; + // x and y are width and height of the image as ints + // Python sends image as (byte)string and since it is not null-terminated, must send its size + // init_angle and dt are doubles matrix = (int*) malloc(size * sizeof(int)); @@ -101,7 +107,10 @@ static PyObject* py_hough(PyObject* self, PyObject* args) return result; } - +/* Edge detection + * + * Takes image size, the image, and the size of TODO what? + */ static PyObject* py_edge(PyObject* self, PyObject* args) { const unsigned char *image; @@ -117,6 +126,8 @@ static PyObject* py_edge(PyObject* self, PyObject* args) PyObject *result; if (!PyArg_ParseTuple(args, "(ii)s#", &x, &y, &image, &size)) return NULL; + // x and y are width and height of the image as ints + // Python sends image as (byte)string and since it is not null-terminated, must send its size n_image = (char*) malloc(size); for (i=0; i < 2 * x; i++) {