|
|
|
|
@ -737,7 +737,7 @@ static mp_obj_t py_image_bytearray(mp_obj_t img_obj) {
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_1(py_image_bytearray_obj, py_image_bytearray);
|
|
|
|
|
|
|
|
|
|
#if defined(MODULE_ULAB_ENABLED) && (ULAB_MAX_DIMS == 4)
|
|
|
|
|
static mp_obj_t py_image_to_ndarray(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_to_ndarray(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
enum { ARG_dtype, ARG_buffer };
|
|
|
|
|
static const mp_arg_t allowed_args[] = {
|
|
|
|
|
{ MP_QSTR_dtype, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_rom_obj = MP_ROM_NONE } },
|
|
|
|
|
@ -875,7 +875,7 @@ static mp_obj_t py_image_to_ndarray(uint n_args, const mp_obj_t *pos_args, mp_ma
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_ndarray_obj, 1, py_image_to_ndarray);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_get_pixel(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_get_pixel(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_UNCOMPRESSED);
|
|
|
|
|
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
@ -954,7 +954,7 @@ static mp_obj_t py_image_get_pixel(uint n_args, const mp_obj_t *args, mp_map_t *
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_get_pixel_obj, 2, py_image_get_pixel);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_set_pixel(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_set_pixel(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_UNCOMPRESSED);
|
|
|
|
|
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
@ -992,7 +992,7 @@ static mp_obj_t py_image_set_pixel(uint n_args, const mp_obj_t *args, mp_map_t *
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_set_pixel_obj, 2, py_image_set_pixel);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_to(pixformat_t pixfmt, mp_rom_obj_t default_color_palette, bool default_copy,
|
|
|
|
|
uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
enum {
|
|
|
|
|
ARG_x_scale, ARG_y_scale, ARG_roi, ARG_channel, ARG_alpha, ARG_color_palette, ARG_alpha_palette, ARG_hint,
|
|
|
|
|
ARG_copy, ARG_copy_to_fb, ARG_quality, ARG_encode_for_ide, ARG_subsampling
|
|
|
|
|
@ -1181,72 +1181,72 @@ static mp_obj_t py_image_to(pixformat_t pixfmt, mp_rom_obj_t default_color_palet
|
|
|
|
|
return py_image_from_struct(&dst_img);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_to_bitmap(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_to_bitmap(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_to(PIXFORMAT_BINARY, MP_ROM_NONE, false, n_args, args, kw_args);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_bitmap_obj, 1, py_image_to_bitmap);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_to_grayscale(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_to_grayscale(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_to(PIXFORMAT_GRAYSCALE, MP_ROM_NONE, false, n_args, args, kw_args);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_grayscale_obj, 1, py_image_to_grayscale);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_to_rgb565(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_to_rgb565(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_to(PIXFORMAT_RGB565, MP_ROM_NONE, false, n_args, args, kw_args);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_rgb565_obj, 1, py_image_to_rgb565);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_to_rainbow(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_to_rainbow(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_to(PIXFORMAT_RGB565, MP_ROM_INT(COLOR_PALETTE_RAINBOW), false, n_args, args, kw_args);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_rainbow_obj, 1, py_image_to_rainbow);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_to_ironbow(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_to_ironbow(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_to(PIXFORMAT_RGB565, MP_ROM_INT(COLOR_PALETTE_IRONBOW), false, n_args, args, kw_args);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_ironbow_obj, 1, py_image_to_ironbow);
|
|
|
|
|
|
|
|
|
|
#if (MICROPY_PY_TOF == 1)
|
|
|
|
|
static mp_obj_t py_image_to_depth(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_to_depth(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_to(PIXFORMAT_RGB565, MP_ROM_INT(COLOR_PALETTE_DEPTH), false, n_args, args, kw_args);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_depth_obj, 1, py_image_to_depth);
|
|
|
|
|
#endif // MICROPY_PY_TOF == 1
|
|
|
|
|
|
|
|
|
|
#if (OMV_GENX320_ENABLE == 1)
|
|
|
|
|
static mp_obj_t py_image_to_evt_dark(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_to_evt_dark(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_to(PIXFORMAT_RGB565, MP_ROM_INT(COLOR_PALETTE_EVT_DARK), false, n_args, args, kw_args);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_evt_dark_obj, 1, py_image_to_evt_dark);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_to_evt_light(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_to_evt_light(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_to(PIXFORMAT_RGB565, MP_ROM_INT(COLOR_PALETTE_EVT_LIGHT), false, n_args, args, kw_args);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_evt_light_obj, 1, py_image_to_evt_light);
|
|
|
|
|
#endif // OMV_GENX320_ENABLE == 1
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_to_jpeg(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_to_jpeg(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_to(PIXFORMAT_JPEG, MP_ROM_NONE, false, n_args, args, kw_args);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_jpeg_obj, 1, py_image_to_jpeg);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_to_png(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_to_png(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_to(PIXFORMAT_PNG, MP_ROM_NONE, false, n_args, args, kw_args);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_png_obj, 1, py_image_to_png);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_copy(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_copy(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_to(PIXFORMAT_INVALID, MP_ROM_NONE, true, n_args, args, kw_args);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_copy_obj, 1, py_image_copy);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_crop(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_crop(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_to(PIXFORMAT_INVALID, MP_ROM_NONE, false, n_args, args, kw_args);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_crop_obj, 1, py_image_crop);
|
|
|
|
|
|
|
|
|
|
#if defined(IMLIB_ENABLE_IMAGE_FILE_IO)
|
|
|
|
|
static mp_obj_t py_image_save(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_save(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_image_cobj(args[0]);
|
|
|
|
|
const char *path = mp_obj_str_get_str(args[1]);
|
|
|
|
|
|
|
|
|
|
@ -1274,7 +1274,7 @@ static MP_DEFINE_CONST_FUN_OBJ_1(py_image_flush_obj, py_image_flush);
|
|
|
|
|
// Drawing Methods
|
|
|
|
|
//////////////////
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_clear(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_clear(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_UNCOMPRESSED);
|
|
|
|
|
|
|
|
|
|
image_t *arg_msk =
|
|
|
|
|
@ -1290,7 +1290,7 @@ static mp_obj_t py_image_clear(uint n_args, const mp_obj_t *args, mp_map_t *kw_a
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_clear_obj, 1, py_image_clear);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_draw_line(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_draw_line(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
@ -1310,7 +1310,7 @@ static mp_obj_t py_image_draw_line(uint n_args, const mp_obj_t *args, mp_map_t *
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_line_obj, 2, py_image_draw_line);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_draw_rectangle(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_draw_rectangle(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
@ -1332,7 +1332,7 @@ static mp_obj_t py_image_draw_rectangle(uint n_args, const mp_obj_t *args, mp_ma
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_rectangle_obj, 2, py_image_draw_rectangle);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_draw_circle(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_draw_circle(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
@ -1353,7 +1353,7 @@ static mp_obj_t py_image_draw_circle(uint n_args, const mp_obj_t *args, mp_map_t
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_circle_obj, 2, py_image_draw_circle);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_draw_ellipse(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_draw_ellipse(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
@ -1376,7 +1376,7 @@ static mp_obj_t py_image_draw_ellipse(uint n_args, const mp_obj_t *args, mp_map_
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_ellipse_obj, 2, py_image_draw_ellipse);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_draw_string(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_draw_string(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
@ -1417,7 +1417,7 @@ static mp_obj_t py_image_draw_string(uint n_args, const mp_obj_t *args, mp_map_t
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_string_obj, 2, py_image_draw_string);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_draw_cross(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_draw_cross(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
@ -1438,7 +1438,7 @@ static mp_obj_t py_image_draw_cross(uint n_args, const mp_obj_t *args, mp_map_t
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_cross_obj, 2, py_image_draw_cross);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_draw_arrow(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_draw_arrow(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
@ -1476,7 +1476,7 @@ static mp_obj_t py_image_draw_arrow(uint n_args, const mp_obj_t *args, mp_map_t
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_arrow_obj, 2, py_image_draw_arrow);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_draw_edges(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_draw_edges(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
mp_obj_t *corners, *p0, *p1, *p2, *p3;
|
|
|
|
|
@ -1521,7 +1521,7 @@ static mp_obj_t py_image_draw_edges(uint n_args, const mp_obj_t *args, mp_map_t
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_edges_obj, 2, py_image_draw_edges);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_draw_keypoints(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_draw_keypoints(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
int arg_c =
|
|
|
|
|
@ -1570,7 +1570,7 @@ static mp_obj_t py_image_draw_keypoints(uint n_args, const mp_obj_t *args, mp_ma
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_keypoints_obj, 2, py_image_draw_keypoints);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_mask_rectangle(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_mask_rectangle(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
int arg_rx;
|
|
|
|
|
int arg_ry;
|
|
|
|
|
@ -1606,7 +1606,7 @@ static mp_obj_t py_image_mask_rectangle(uint n_args, const mp_obj_t *args, mp_ma
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_mask_rectangle_obj, 1, py_image_mask_rectangle);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_mask_circle(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_mask_circle(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
int arg_cx;
|
|
|
|
|
int arg_cy;
|
|
|
|
|
@ -1639,7 +1639,7 @@ static mp_obj_t py_image_mask_circle(uint n_args, const mp_obj_t *args, mp_map_t
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_mask_circle_obj, 1, py_image_mask_circle);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_mask_ellipse(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_mask_ellipse(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
int arg_cx;
|
|
|
|
|
int arg_cy;
|
|
|
|
|
@ -1679,7 +1679,7 @@ static mp_obj_t py_image_mask_ellipse(uint n_args, const mp_obj_t *args, mp_map_
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_mask_ellipse_obj, 1, py_image_mask_ellipse);
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_FLOOD_FILL
|
|
|
|
|
static mp_obj_t py_image_flood_fill(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_flood_fill(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
@ -1714,7 +1714,7 @@ static mp_obj_t py_image_flood_fill(uint n_args, const mp_obj_t *args, mp_map_t
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_flood_fill_obj, 2, py_image_flood_fill);
|
|
|
|
|
#endif // IMLIB_ENABLE_FLOOD_FILL
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_line_op(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args,
|
|
|
|
|
static mp_obj_t py_image_line_op(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args,
|
|
|
|
|
imlib_draw_row_callback_t callback) {
|
|
|
|
|
enum {
|
|
|
|
|
ARG_image, ARG_x, ARG_y, ARG_x_scale, ARG_y_scale, ARG_roi,
|
|
|
|
|
@ -1819,7 +1819,7 @@ static mp_obj_t py_image_line_op(uint n_args, const mp_obj_t *pos_args, mp_map_t
|
|
|
|
|
return pos_args[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_draw_image(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_draw_image(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_line_op(n_args, pos_args, kw_args, NULL);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_image_obj, 1, py_image_draw_image);
|
|
|
|
|
@ -1829,7 +1829,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_image_obj, 1, py_image_draw_imag
|
|
|
|
|
// ISP Methods
|
|
|
|
|
//////////////
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_awb(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_awb(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
enum { ARG_max };
|
|
|
|
|
static const mp_arg_t allowed_args[] = {
|
|
|
|
|
{ MP_QSTR_max, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} },
|
|
|
|
|
@ -1904,7 +1904,7 @@ static mp_obj_t py_ccm(mp_obj_t img_obj, mp_obj_t ccm_obj) {
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_2(py_ccm_obj, py_ccm);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_gamma(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_gamma(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
enum { ARG_gamma, ARG_contrast, ARG_brightness };
|
|
|
|
|
static const mp_arg_t allowed_args[] = {
|
|
|
|
|
{ MP_QSTR_gamma, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_rom_obj = MP_ROM_NONE } },
|
|
|
|
|
@ -1935,7 +1935,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_gamma_obj, 1, py_image_gamma);
|
|
|
|
|
// Binary Methods
|
|
|
|
|
/////////////////
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_binary(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_binary(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
enum { ARG_thresholds, ARG_invert, ARG_zero, ARG_mask, ARG_to_bitmap, ARG_copy };
|
|
|
|
|
static const mp_arg_t allowed_args[] = {
|
|
|
|
|
{ MP_QSTR_thresholds, MP_ARG_OBJ | MP_ARG_REQUIRED, },
|
|
|
|
|
@ -2013,37 +2013,37 @@ static mp_obj_t py_image_invert(mp_obj_t img_obj) {
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_1(py_image_invert_obj, py_image_invert);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_b_and(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_b_and(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_line_op(n_args, pos_args, kw_args, imlib_b_and_line_op);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_and_obj, 1, py_image_b_and);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_b_nand(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_b_nand(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_line_op(n_args, pos_args, kw_args, imlib_b_nand_line_op);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_nand_obj, 1, py_image_b_nand);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_b_or(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_b_or(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_line_op(n_args, pos_args, kw_args, imlib_b_or_line_op);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_or_obj, 1, py_image_b_or);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_b_nor(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_b_nor(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_line_op(n_args, pos_args, kw_args, imlib_b_nor_line_op);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_nor_obj, 1, py_image_b_nor);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_b_xor(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_b_xor(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_line_op(n_args, pos_args, kw_args, imlib_b_xor_line_op);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_xor_obj, 1, py_image_b_xor);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_b_xnor(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_b_xnor(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_line_op(n_args, pos_args, kw_args, imlib_b_xnor_line_op);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_xnor_obj, 1, py_image_b_xnor);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_binary_morph_op(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args,
|
|
|
|
|
static mp_obj_t py_image_binary_morph_op(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args,
|
|
|
|
|
binary_morph_op_t op) {
|
|
|
|
|
enum { ARG_threshold, ARG_mask };
|
|
|
|
|
static const mp_arg_t allowed_args[] = {
|
|
|
|
|
@ -2068,22 +2068,22 @@ static mp_obj_t py_image_binary_morph_op(uint n_args, const mp_obj_t *pos_args,
|
|
|
|
|
return pos_args[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_erode(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_erode(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_binary_morph_op(n_args, pos_args, kw_args, imlib_erode);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_erode_obj, 2, py_image_erode);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_dilate(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_dilate(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_binary_morph_op(n_args, pos_args, kw_args, imlib_dilate);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_dilate_obj, 2, py_image_dilate);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_open(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_open(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_binary_morph_op(n_args, pos_args, kw_args, imlib_open);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_open_obj, 2, py_image_open);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_close(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_close(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_binary_morph_op(n_args, pos_args, kw_args, imlib_close);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_close_obj, 2, py_image_close);
|
|
|
|
|
@ -2094,44 +2094,44 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_close_obj, 2, py_image_close);
|
|
|
|
|
// Math Methods
|
|
|
|
|
///////////////
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_add(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_add(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_line_op(n_args, pos_args, kw_args, imlib_add_line_op);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_add_obj, 1, py_image_add);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_sub(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_sub(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_line_op(n_args, pos_args, kw_args, imlib_sub_line_op);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_sub_obj, 1, py_image_sub);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_rsub(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_rsub(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_line_op(n_args, pos_args, kw_args, imlib_rsub_line_op);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_rsub_obj, 1, py_image_rsub);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_min(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_min(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_line_op(n_args, pos_args, kw_args, imlib_min_line_op);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_min_obj, 1, py_image_min);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_max(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_max(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_line_op(n_args, pos_args, kw_args, imlib_max_line_op);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_max_obj, 1, py_image_max);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_difference(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_difference(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_line_op(n_args, pos_args, kw_args, imlib_difference_line_op);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_difference_obj, 1, py_image_difference);
|
|
|
|
|
#endif // IMLIB_ENABLE_MATH_OPS
|
|
|
|
|
|
|
|
|
|
#if defined(IMLIB_ENABLE_MATH_OPS) && defined(IMLIB_ENABLE_BINARY_OPS)
|
|
|
|
|
static mp_obj_t py_image_top_hat(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_top_hat(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_binary_morph_op(n_args, pos_args, kw_args, imlib_top_hat);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_top_hat_obj, 2, py_image_top_hat);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_black_hat(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_black_hat(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
return py_image_binary_morph_op(n_args, pos_args, kw_args, imlib_black_hat);
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_black_hat_obj, 2, py_image_black_hat);
|
|
|
|
|
@ -2141,7 +2141,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_black_hat_obj, 2, py_image_black_hat)
|
|
|
|
|
// Filtering Methods
|
|
|
|
|
////////////////////
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_histeq(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_histeq(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img =
|
|
|
|
|
py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
bool arg_adaptive =
|
|
|
|
|
@ -2163,7 +2163,7 @@ static mp_obj_t py_image_histeq(uint n_args, const mp_obj_t *args, mp_map_t *kw_
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_histeq_obj, 1, py_image_histeq);
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_MEAN
|
|
|
|
|
static mp_obj_t py_image_mean(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_mean(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img =
|
|
|
|
|
py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
int arg_ksize =
|
|
|
|
|
@ -2186,7 +2186,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_mean_obj, 2, py_image_mean);
|
|
|
|
|
#endif // IMLIB_ENABLE_MEAN
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_MEDIAN
|
|
|
|
|
static mp_obj_t py_image_median(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_median(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img =
|
|
|
|
|
py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
int arg_ksize =
|
|
|
|
|
@ -2212,7 +2212,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_median_obj, 2, py_image_median);
|
|
|
|
|
#endif // IMLIB_ENABLE_MEDIAN
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_MODE
|
|
|
|
|
static mp_obj_t py_image_mode(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_mode(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img =
|
|
|
|
|
py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
int arg_ksize =
|
|
|
|
|
@ -2235,7 +2235,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_mode_obj, 2, py_image_mode);
|
|
|
|
|
#endif // IMLIB_ENABLE_MODE
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_MIDPOINT
|
|
|
|
|
static mp_obj_t py_image_midpoint(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_midpoint(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img =
|
|
|
|
|
py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
int arg_ksize =
|
|
|
|
|
@ -2261,7 +2261,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_midpoint_obj, 2, py_image_midpoint);
|
|
|
|
|
#endif // IMLIB_ENABLE_MIDPOINT
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_MORPH
|
|
|
|
|
static mp_obj_t py_image_morph(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_morph(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
enum { ARG_mul, ARG_add, ARG_threshold, ARG_offset, ARG_invert, ARG_mask };
|
|
|
|
|
static const mp_arg_t allowed_args[] = {
|
|
|
|
|
{ MP_QSTR_mul, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_rom_obj = MP_ROM_NONE } },
|
|
|
|
|
@ -2338,7 +2338,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_morph_obj, 3, py_image_morph);
|
|
|
|
|
#endif // IMLIB_ENABLE_MORPH
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_GAUSSIAN
|
|
|
|
|
static mp_obj_t py_image_gaussian(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_gaussian(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
enum { ARG_unsharp, ARG_mul, ARG_add, ARG_threshold, ARG_offset, ARG_invert, ARG_mask };
|
|
|
|
|
static const mp_arg_t allowed_args[] = {
|
|
|
|
|
{ MP_QSTR_unsharp, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false } },
|
|
|
|
|
@ -2405,7 +2405,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_gaussian_obj, 2, py_image_gaussian);
|
|
|
|
|
#endif // IMLIB_ENABLE_GAUSSIAN
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_LAPLACIAN
|
|
|
|
|
static mp_obj_t py_image_laplacian(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_laplacian(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
enum { ARG_sharpen, ARG_mul, ARG_add, ARG_threshold, ARG_offset, ARG_invert, ARG_mask };
|
|
|
|
|
static const mp_arg_t allowed_args[] = {
|
|
|
|
|
{ MP_QSTR_sharpen, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false } },
|
|
|
|
|
@ -2473,7 +2473,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_laplacian_obj, 2, py_image_laplacian)
|
|
|
|
|
#endif // IMLIB_ENABLE_LAPLACIAN
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_BILATERAL
|
|
|
|
|
static mp_obj_t py_image_bilateral(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_bilateral(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img =
|
|
|
|
|
py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
int arg_ksize =
|
|
|
|
|
@ -2505,7 +2505,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_bilateral_obj, 2, py_image_bilateral)
|
|
|
|
|
////////////////////
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_LINPOLAR
|
|
|
|
|
static mp_obj_t py_image_linpolar(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_linpolar(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img =
|
|
|
|
|
py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
PY_ASSERT_FALSE_MSG(arg_img->w % 2, "Width must be even!");
|
|
|
|
|
@ -2522,7 +2522,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_linpolar_obj, 1, py_image_linpolar);
|
|
|
|
|
#endif // IMLIB_ENABLE_LINPOLAR
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_LOGPOLAR
|
|
|
|
|
static mp_obj_t py_image_logpolar(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_logpolar(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img =
|
|
|
|
|
py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
PY_ASSERT_FALSE_MSG(arg_img->w % 2, "Width must be even!");
|
|
|
|
|
@ -2539,7 +2539,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_logpolar_obj, 1, py_image_logpolar);
|
|
|
|
|
#endif // IMLIB_ENABLE_LOGPOLAR
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_LENS_CORR
|
|
|
|
|
static mp_obj_t py_image_lens_corr(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_lens_corr(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img =
|
|
|
|
|
py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
PY_ASSERT_FALSE_MSG(arg_img->w % 2, "Width must be even!");
|
|
|
|
|
@ -2565,7 +2565,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_lens_corr_obj, 1, py_image_lens_corr)
|
|
|
|
|
#endif // IMLIB_ENABLE_LENS_CORR
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_ROTATION_CORR
|
|
|
|
|
static mp_obj_t py_image_rotation_corr(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_rotation_corr(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img =
|
|
|
|
|
py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
float arg_x_rotation =
|
|
|
|
|
@ -2680,7 +2680,7 @@ static MP_DEFINE_CONST_OBJ_TYPE(
|
|
|
|
|
locals_dict, &py_similarity_locals_dict
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_get_similarity(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_get_similarity(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
|
|
|
|
enum {
|
|
|
|
|
ARG_image, ARG_x, ARG_y, ARG_x_scale, ARG_y_scale, ARG_roi,
|
|
|
|
|
ARG_channel, ARG_alpha, ARG_color_palette, ARG_alpha_palette, ARG_hint, ARG_dssim
|
|
|
|
|
@ -3498,7 +3498,7 @@ static MP_DEFINE_CONST_OBJ_TYPE(
|
|
|
|
|
locals_dict, &py_histogram_locals_dict
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_get_histogram(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_get_histogram(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
list_t thresholds;
|
|
|
|
|
@ -3599,7 +3599,7 @@ static mp_obj_t py_image_get_histogram(uint n_args, const mp_obj_t *args, mp_map
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_get_histogram_obj, 1, py_image_get_histogram);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_get_statistics(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_get_statistics(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
list_t thresholds;
|
|
|
|
|
@ -3830,7 +3830,7 @@ static MP_DEFINE_CONST_OBJ_TYPE(
|
|
|
|
|
locals_dict, &py_line_locals_dict
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_get_regression(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_get_regression(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
list_t thresholds;
|
|
|
|
|
@ -4428,7 +4428,7 @@ static bool py_image_find_blobs_merge_cb(void *fun_obj, find_blobs_list_lnk_data
|
|
|
|
|
return mp_obj_is_true(mp_call_function_2(fun_obj, py_blob_new(blob0), py_blob_new(blob1)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_find_blobs(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_find_blobs(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
list_t thresholds;
|
|
|
|
|
@ -4505,7 +4505,7 @@ static mp_obj_t py_image_find_blobs(uint n_args, const mp_obj_t *args, mp_map_t
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_blobs_obj, 2, py_image_find_blobs);
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_FIND_LINES
|
|
|
|
|
static mp_obj_t py_image_find_lines(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_find_lines(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
rectangle_t roi;
|
|
|
|
|
@ -4551,7 +4551,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_lines_obj, 1, py_image_find_line
|
|
|
|
|
#endif // IMLIB_ENABLE_FIND_LINES
|
|
|
|
|
|
|
|
|
|
#if defined(IMLIB_ENABLE_FIND_LINE_SEGMENTS) && (!defined(OMV_NO_GPL))
|
|
|
|
|
static mp_obj_t py_image_find_line_segments(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_find_line_segments(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_image_cobj(args[0]);
|
|
|
|
|
|
|
|
|
|
rectangle_t roi;
|
|
|
|
|
@ -4678,7 +4678,7 @@ static MP_DEFINE_CONST_OBJ_TYPE(
|
|
|
|
|
locals_dict, &py_circle_locals_dict
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_find_circles(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_find_circles(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
rectangle_t roi;
|
|
|
|
|
@ -4827,7 +4827,7 @@ static MP_DEFINE_CONST_OBJ_TYPE(
|
|
|
|
|
locals_dict, &py_rect_locals_dict
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_find_rects(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_find_rects(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_image_cobj(args[0]);
|
|
|
|
|
|
|
|
|
|
rectangle_t roi;
|
|
|
|
|
@ -5042,7 +5042,7 @@ static MP_DEFINE_CONST_OBJ_TYPE(
|
|
|
|
|
locals_dict, &py_qrcode_locals_dict
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_find_qrcodes(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_find_qrcodes(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_image_cobj(args[0]);
|
|
|
|
|
|
|
|
|
|
rectangle_t roi;
|
|
|
|
|
@ -5255,7 +5255,7 @@ static MP_DEFINE_CONST_OBJ_TYPE(
|
|
|
|
|
print, py_apriltag_print
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_find_apriltags(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_find_apriltags(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_image_cobj(args[0]);
|
|
|
|
|
|
|
|
|
|
rectangle_t roi;
|
|
|
|
|
@ -5473,7 +5473,7 @@ static MP_DEFINE_CONST_OBJ_TYPE(
|
|
|
|
|
locals_dict, &py_datamatrix_locals_dict
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_find_datamatrices(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_find_datamatrices(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_image_cobj(args[0]);
|
|
|
|
|
|
|
|
|
|
rectangle_t roi;
|
|
|
|
|
@ -5654,7 +5654,7 @@ static MP_DEFINE_CONST_OBJ_TYPE(
|
|
|
|
|
locals_dict, &py_barcode_locals_dict
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_find_barcodes(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_find_barcodes(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_image_cobj(args[0]);
|
|
|
|
|
|
|
|
|
|
rectangle_t roi;
|
|
|
|
|
@ -5790,7 +5790,7 @@ static MP_DEFINE_CONST_OBJ_TYPE(
|
|
|
|
|
locals_dict, &py_displacement_locals_dict
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_find_displacement(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_find_displacement(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
image_t *arg_template_img = py_helper_arg_to_image(args[1], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
@ -5827,7 +5827,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_displacement_obj, 2, py_image_fi
|
|
|
|
|
#endif // IMLIB_ENABLE_FIND_DISPLACEMENT
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_FIND_TEMPLATE
|
|
|
|
|
static mp_obj_t py_image_find_template(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_find_template(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_GRAYSCALE);
|
|
|
|
|
image_t *arg_template = py_helper_arg_to_image(args[1], ARG_IMAGE_GRAYSCALE);
|
|
|
|
|
float arg_thresh = mp_obj_get_float(args[2]);
|
|
|
|
|
@ -5872,7 +5872,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_template_obj, 3, py_image_find_t
|
|
|
|
|
#endif // IMLIB_FIND_TEMPLATE
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_FEATURES
|
|
|
|
|
static mp_obj_t py_image_find_features(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_find_features(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
cascade_t *cascade = py_cascade_cobj(args[1]);
|
|
|
|
|
cascade->threshold = py_helper_keyword_float(n_args, args, 2, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_threshold), 0.5f);
|
|
|
|
|
@ -5908,7 +5908,7 @@ static mp_obj_t py_image_find_features(uint n_args, const mp_obj_t *args, mp_map
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_features_obj, 2, py_image_find_features);
|
|
|
|
|
#endif // IMLIB_ENABLE_FEATURES
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_find_eye(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_find_eye(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_GRAYSCALE);
|
|
|
|
|
|
|
|
|
|
rectangle_t roi;
|
|
|
|
|
@ -5927,7 +5927,7 @@ static mp_obj_t py_image_find_eye(uint n_args, const mp_obj_t *args, mp_map_t *k
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_eye_obj, 2, py_image_find_eye);
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_FIND_LBP
|
|
|
|
|
static mp_obj_t py_image_find_lbp(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_find_lbp(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_GRAYSCALE);
|
|
|
|
|
|
|
|
|
|
rectangle_t roi;
|
|
|
|
|
@ -5942,7 +5942,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_lbp_obj, 2, py_image_find_lbp);
|
|
|
|
|
#endif // IMLIB_ENABLE_FIND_LBP
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_FIND_KEYPOINTS
|
|
|
|
|
static mp_obj_t py_image_find_keypoints(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_find_keypoints(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
|
|
|
|
|
rectangle_t roi;
|
|
|
|
|
@ -5983,7 +5983,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_keypoints_obj, 1, py_image_find_
|
|
|
|
|
#endif // IMLIB_ENABLE_FIND_KEYPOINTS
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_BINARY_OPS
|
|
|
|
|
static mp_obj_t py_image_find_edges(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_find_edges(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_GRAYSCALE);
|
|
|
|
|
edge_detector_t edge_type = mp_obj_get_int(args[1]);
|
|
|
|
|
|
|
|
|
|
@ -6022,7 +6022,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_edges_obj, 2, py_image_find_edge
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_HOG
|
|
|
|
|
static mp_obj_t py_image_find_hog(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_find_hog(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_GRAYSCALE);
|
|
|
|
|
|
|
|
|
|
rectangle_t roi;
|
|
|
|
|
@ -6040,7 +6040,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_hog_obj, 1, py_image_find_hog);
|
|
|
|
|
#endif // IMLIB_ENABLE_HOG
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_SELECTIVE_SEARCH
|
|
|
|
|
static mp_obj_t py_image_selective_search(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_selective_search(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE);
|
|
|
|
|
int t = py_helper_keyword_int(n_args, args, 1, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_threshold), 500);
|
|
|
|
|
int s = py_helper_keyword_int(n_args, args, 2, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_size), 20);
|
|
|
|
|
@ -6069,7 +6069,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_selective_search_obj, 1, py_image_sel
|
|
|
|
|
#endif // IMLIB_ENABLE_SELECTIVE_SEARCH
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_STEREO_DISPARITY
|
|
|
|
|
static mp_obj_t py_image_stereo_disparity(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_stereo_disparity(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
image_t *img = py_helper_arg_to_image(args[0], ARG_IMAGE_GRAYSCALE);
|
|
|
|
|
|
|
|
|
|
if (img->w % 2) {
|
|
|
|
|
@ -6633,7 +6633,7 @@ mp_obj_t py_image_grayscale_to_yuv(mp_obj_t arg) {
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_1(py_image_grayscale_to_yuv_obj, py_image_grayscale_to_yuv);
|
|
|
|
|
|
|
|
|
|
mp_obj_t py_image_rgb_to_binary(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
mp_obj_t py_image_rgb_to_binary(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
py_helper_consume_array(n_args, args, 0, 3, &arg_vec);
|
|
|
|
|
uint8_t r = mp_obj_get_int(arg_vec[0]) & 255;
|
|
|
|
|
@ -6644,7 +6644,7 @@ mp_obj_t py_image_rgb_to_binary(uint n_args, const mp_obj_t *args, mp_map_t *kw_
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_rgb_to_binary_obj, 1, py_image_rgb_to_binary);
|
|
|
|
|
|
|
|
|
|
mp_obj_t py_image_rgb_to_grayscale(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
mp_obj_t py_image_rgb_to_grayscale(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
py_helper_consume_array(n_args, args, 0, 3, &arg_vec);
|
|
|
|
|
uint8_t r = mp_obj_get_int(arg_vec[0]) & 255;
|
|
|
|
|
@ -6655,7 +6655,7 @@ mp_obj_t py_image_rgb_to_grayscale(uint n_args, const mp_obj_t *args, mp_map_t *
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_rgb_to_grayscale_obj, 1, py_image_rgb_to_grayscale);
|
|
|
|
|
|
|
|
|
|
mp_obj_t py_image_rgb_to_lab(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
mp_obj_t py_image_rgb_to_lab(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
py_helper_consume_array(n_args, args, 0, 3, &arg_vec);
|
|
|
|
|
uint8_t r = mp_obj_get_int(arg_vec[0]) & 255;
|
|
|
|
|
@ -6669,7 +6669,7 @@ mp_obj_t py_image_rgb_to_lab(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_rgb_to_lab_obj, 1, py_image_rgb_to_lab);
|
|
|
|
|
|
|
|
|
|
mp_obj_t py_image_rgb_to_yuv(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
mp_obj_t py_image_rgb_to_yuv(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
py_helper_consume_array(n_args, args, 0, 3, &arg_vec);
|
|
|
|
|
uint8_t r = mp_obj_get_int(arg_vec[0]) & 255;
|
|
|
|
|
@ -6683,7 +6683,7 @@ mp_obj_t py_image_rgb_to_yuv(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_rgb_to_yuv_obj, 1, py_image_rgb_to_yuv);
|
|
|
|
|
|
|
|
|
|
mp_obj_t py_image_lab_to_binary(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
mp_obj_t py_image_lab_to_binary(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
py_helper_consume_array(n_args, args, 0, 3, &arg_vec);
|
|
|
|
|
int8_t l = (mp_obj_get_int(arg_vec[0]) & 255) % 100;
|
|
|
|
|
@ -6694,7 +6694,7 @@ mp_obj_t py_image_lab_to_binary(uint n_args, const mp_obj_t *args, mp_map_t *kw_
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_lab_to_binary_obj, 1, py_image_lab_to_binary);
|
|
|
|
|
|
|
|
|
|
mp_obj_t py_image_lab_to_grayscale(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
mp_obj_t py_image_lab_to_grayscale(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
py_helper_consume_array(n_args, args, 0, 3, &arg_vec);
|
|
|
|
|
int8_t l = (mp_obj_get_int(arg_vec[0]) & 255) % 100;
|
|
|
|
|
@ -6705,7 +6705,7 @@ mp_obj_t py_image_lab_to_grayscale(uint n_args, const mp_obj_t *args, mp_map_t *
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_lab_to_grayscale_obj, 1, py_image_lab_to_grayscale);
|
|
|
|
|
|
|
|
|
|
mp_obj_t py_image_lab_to_rgb(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
mp_obj_t py_image_lab_to_rgb(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
py_helper_consume_array(n_args, args, 0, 3, &arg_vec);
|
|
|
|
|
int8_t l = (mp_obj_get_int(arg_vec[0]) & 255) % 100;
|
|
|
|
|
@ -6719,7 +6719,7 @@ mp_obj_t py_image_lab_to_rgb(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_lab_to_rgb_obj, 1, py_image_lab_to_rgb);
|
|
|
|
|
|
|
|
|
|
mp_obj_t py_image_lab_to_yuv(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
mp_obj_t py_image_lab_to_yuv(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
py_helper_consume_array(n_args, args, 0, 3, &arg_vec);
|
|
|
|
|
int8_t l = (mp_obj_get_int(arg_vec[0]) & 255) % 100;
|
|
|
|
|
@ -6733,7 +6733,7 @@ mp_obj_t py_image_lab_to_yuv(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_lab_to_yuv_obj, 1, py_image_lab_to_yuv);
|
|
|
|
|
|
|
|
|
|
mp_obj_t py_image_yuv_to_binary(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
mp_obj_t py_image_yuv_to_binary(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
py_helper_consume_array(n_args, args, 0, 3, &arg_vec);
|
|
|
|
|
int8_t y = mp_obj_get_int(arg_vec[0]) & 255;
|
|
|
|
|
@ -6744,7 +6744,7 @@ mp_obj_t py_image_yuv_to_binary(uint n_args, const mp_obj_t *args, mp_map_t *kw_
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_yuv_to_binary_obj, 1, py_image_yuv_to_binary);
|
|
|
|
|
|
|
|
|
|
mp_obj_t py_image_yuv_to_grayscale(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
mp_obj_t py_image_yuv_to_grayscale(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
py_helper_consume_array(n_args, args, 0, 3, &arg_vec);
|
|
|
|
|
int8_t y = mp_obj_get_int(arg_vec[0]) & 255;
|
|
|
|
|
@ -6755,7 +6755,7 @@ mp_obj_t py_image_yuv_to_grayscale(uint n_args, const mp_obj_t *args, mp_map_t *
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_yuv_to_grayscale_obj, 1, py_image_yuv_to_grayscale);
|
|
|
|
|
|
|
|
|
|
mp_obj_t py_image_yuv_to_rgb(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
mp_obj_t py_image_yuv_to_rgb(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
py_helper_consume_array(n_args, args, 0, 3, &arg_vec);
|
|
|
|
|
int8_t y = mp_obj_get_int(arg_vec[0]) & 255;
|
|
|
|
|
@ -6769,7 +6769,7 @@ mp_obj_t py_image_yuv_to_rgb(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_yuv_to_rgb_obj, 1, py_image_yuv_to_rgb);
|
|
|
|
|
|
|
|
|
|
mp_obj_t py_image_yuv_to_lab(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
mp_obj_t py_image_yuv_to_lab(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
const mp_obj_t *arg_vec;
|
|
|
|
|
py_helper_consume_array(n_args, args, 0, 3, &arg_vec);
|
|
|
|
|
int8_t y = mp_obj_get_int(arg_vec[0]) & 255;
|
|
|
|
|
@ -6802,7 +6802,7 @@ mp_obj_t py_image_from_struct(image_t *img) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef IMLIB_ENABLE_FEATURES
|
|
|
|
|
mp_obj_t py_image_load_cascade(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
mp_obj_t py_image_load_cascade(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
cascade_t cascade;
|
|
|
|
|
const char *path = mp_obj_str_get_str(args[0]);
|
|
|
|
|
|
|
|
|
|
@ -6836,7 +6836,7 @@ static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_load_cascade_obj, 1, py_image_load_ca
|
|
|
|
|
|
|
|
|
|
#if defined(IMLIB_ENABLE_DESCRIPTOR)
|
|
|
|
|
#if defined(IMLIB_ENABLE_IMAGE_FILE_IO)
|
|
|
|
|
mp_obj_t py_image_load_descriptor(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
mp_obj_t py_image_load_descriptor(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
FIL fp;
|
|
|
|
|
FRESULT res = FR_OK;
|
|
|
|
|
|
|
|
|
|
@ -6898,7 +6898,7 @@ mp_obj_t py_image_load_descriptor(uint n_args, const mp_obj_t *args, mp_map_t *k
|
|
|
|
|
}
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_load_descriptor_obj, 1, py_image_load_descriptor);
|
|
|
|
|
|
|
|
|
|
mp_obj_t py_image_save_descriptor(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
mp_obj_t py_image_save_descriptor(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
FIL fp;
|
|
|
|
|
FRESULT res = FR_OK;
|
|
|
|
|
|
|
|
|
|
@ -6956,7 +6956,7 @@ mp_obj_t py_image_save_descriptor(uint n_args, const mp_obj_t *args, mp_map_t *k
|
|
|
|
|
static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_save_descriptor_obj, 2, py_image_save_descriptor);
|
|
|
|
|
#endif //IMLIB_ENABLE_IMAGE_FILE_IO
|
|
|
|
|
|
|
|
|
|
static mp_obj_t py_image_match_descriptor(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
static mp_obj_t py_image_match_descriptor(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
|
|
|
|
mp_obj_t match_obj = mp_const_none;
|
|
|
|
|
const mp_obj_type_t *desc1_type = mp_obj_get_type(args[0]);
|
|
|
|
|
const mp_obj_type_t *desc2_type = mp_obj_get_type(args[1]);
|
|
|
|
|
|