mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Merge pull request #816 from kwagyeman/kwabena/update_get_pixel_for_bayer
Get pixel now does debayering for bayer rgbtuple mode
This commit is contained in:
commit
ea1fa81f3e
@ -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:
|
case IMAGE_BPP_BAYER:
|
||||||
if (arg_rgbtuple) {
|
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];
|
mp_obj_t pixel_tuple[3];
|
||||||
pixel_tuple[0] = mp_obj_new_int(COLOR_RGB565_TO_R8(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(COLOR_GRAYSCALE_TO_RGB565(pixel)));
|
pixel_tuple[1] = mp_obj_new_int(COLOR_RGB565_TO_G8(pixel));
|
||||||
pixel_tuple[2] = mp_obj_new_int(COLOR_RGB565_TO_B8(COLOR_GRAYSCALE_TO_RGB565(pixel)));
|
pixel_tuple[2] = mp_obj_new_int(COLOR_RGB565_TO_B8(pixel));
|
||||||
return mp_obj_new_tuple(3, pixel_tuple);
|
return mp_obj_new_tuple(3, pixel_tuple);
|
||||||
} else {
|
} else {
|
||||||
return mp_obj_new_int(IMAGE_GET_GRAYSCALE_PIXEL(arg_img, arg_x, arg_y)); // Correct!
|
return mp_obj_new_int(IMAGE_GET_GRAYSCALE_PIXEL(arg_img, arg_x, arg_y)); // Correct!
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user