From bf16b6a4fa446e6dca248b03a05dc99654624a1b Mon Sep 17 00:00:00 2001 From: "Kwabena W. Agyeman" Date: Wed, 27 May 2020 22:52:30 -0700 Subject: [PATCH] Get pixel now does debayering for bayer rgbtuple mode --- src/omv/py/py_image.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/omv/py/py_image.c b/src/omv/py/py_image.c index 52e407c0b..e66a3932a 100644 --- a/src/omv/py/py_image.c +++ b/src/omv/py/py_image.c @@ -695,11 +695,11 @@ STATIC mp_obj_t py_image_get_pixel(uint n_args, const mp_obj_t *args, mp_map_t * } case IMAGE_BPP_BAYER: if (arg_rgbtuple) { - int pixel = IMAGE_GET_GRAYSCALE_PIXEL(arg_img, arg_x, arg_y); // Correct! + uint16_t pixel; imlib_bayer_to_rgb565(arg_img, 1, 1, arg_x, arg_y, &pixel); mp_obj_t pixel_tuple[3]; - pixel_tuple[0] = mp_obj_new_int(COLOR_RGB565_TO_R8(COLOR_GRAYSCALE_TO_RGB565(pixel))); - pixel_tuple[1] = mp_obj_new_int(COLOR_RGB565_TO_G8(COLOR_GRAYSCALE_TO_RGB565(pixel))); - pixel_tuple[2] = mp_obj_new_int(COLOR_RGB565_TO_B8(COLOR_GRAYSCALE_TO_RGB565(pixel))); + pixel_tuple[0] = mp_obj_new_int(COLOR_RGB565_TO_R8(pixel)); + pixel_tuple[1] = mp_obj_new_int(COLOR_RGB565_TO_G8(pixel)); + pixel_tuple[2] = mp_obj_new_int(COLOR_RGB565_TO_B8(pixel)); return mp_obj_new_tuple(3, pixel_tuple); } else { return mp_obj_new_int(IMAGE_GET_GRAYSCALE_PIXEL(arg_img, arg_x, arg_y)); // Correct!