From 74d084ee6b0ed51a80a2bc4a19e7cf61972039e9 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Tue, 9 Feb 2016 01:05:34 +0200 Subject: [PATCH] Add frame size check to keypoints --- src/omv/py/py_image.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/omv/py/py_image.c b/src/omv/py/py_image.c index 5ec1dc30b..58603ff89 100644 --- a/src/omv/py/py_image.c +++ b/src/omv/py/py_image.c @@ -683,7 +683,6 @@ static mp_obj_t py_image_find_features(uint n_args, const mp_obj_t *args, mp_map PY_ASSERT_TRUE_MSG(sensor.framesize <= OMV_MAX_INT_FRAME, "This function is only supported on "OMV_MAX_INT_FRAME_STR" and smaller frames"); - /* read arguments */ image = py_image_cobj(args[0]); cascade = py_cascade_cobj(args[1]); @@ -775,9 +774,12 @@ static mp_obj_t py_image_find_keypoints(uint n_args, const mp_obj_t *args, mp_ma rectangle_t roi={0, 0, image->w, image->h}; /* sanity checks */ - PY_ASSERT_TRUE_MSG(image->bpp == 1, + PY_ASSERT_TRUE_MSG(sensor.pixformat == PIXFORMAT_GRAYSCALE, "This function is only supported on GRAYSCALE images"); + PY_ASSERT_TRUE_MSG(sensor.framesize <= OMV_MAX_INT_FRAME, + "This function is only supported on "OMV_MAX_INT_FRAME_STR" and smaller frames"); + /* read var args */ mp_map_elem_t *kw_thresh = mp_map_lookup(kw_args, MP_OBJ_NEW_QSTR(qstr_from_str("threshold")), MP_MAP_LOOKUP); if (kw_thresh != NULL) {