mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Fix black/top hat.
* Depend on both binary and math ops.
This commit is contained in:
parent
ba7a5981ae
commit
c548c336f9
@ -2422,38 +2422,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_close_obj, 2, py_image_close);
|
|||||||
// Math Methods
|
// Math Methods
|
||||||
///////////////
|
///////////////
|
||||||
|
|
||||||
STATIC mp_obj_t py_image_top_hat(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
|
|
||||||
{
|
|
||||||
int arg_ksize =
|
|
||||||
py_helper_arg_to_ksize(args[1]);
|
|
||||||
int arg_threshold =
|
|
||||||
py_helper_keyword_int(n_args, args, 2, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_threshold), 0);
|
|
||||||
image_t *arg_msk =
|
|
||||||
py_helper_keyword_to_image_mutable_mask(n_args, args, 3, kw_args);
|
|
||||||
|
|
||||||
fb_alloc_mark();
|
|
||||||
imlib_top_hat(py_helper_arg_to_image_mutable(args[0]), arg_ksize, arg_threshold, arg_msk);
|
|
||||||
fb_alloc_free_till_mark();
|
|
||||||
return args[0];
|
|
||||||
}
|
|
||||||
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 *args, mp_map_t *kw_args)
|
|
||||||
{
|
|
||||||
int arg_ksize =
|
|
||||||
py_helper_arg_to_ksize(args[1]);
|
|
||||||
int arg_threshold =
|
|
||||||
py_helper_keyword_int(n_args, args, 2, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_threshold), 0);
|
|
||||||
image_t *arg_msk =
|
|
||||||
py_helper_keyword_to_image_mutable_mask(n_args, args, 3, kw_args);
|
|
||||||
|
|
||||||
fb_alloc_mark();
|
|
||||||
imlib_black_hat(py_helper_arg_to_image_mutable(args[0]), arg_ksize, arg_threshold, arg_msk);
|
|
||||||
fb_alloc_free_till_mark();
|
|
||||||
return args[0];
|
|
||||||
}
|
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_black_hat_obj, 2, py_image_black_hat);
|
|
||||||
|
|
||||||
STATIC mp_obj_t py_image_gamma_corr(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
|
STATIC mp_obj_t py_image_gamma_corr(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
|
||||||
{
|
{
|
||||||
image_t *arg_img =
|
image_t *arg_img =
|
||||||
@ -2741,6 +2709,40 @@ STATIC mp_obj_t py_image_blend(uint n_args, const mp_obj_t *args, mp_map_t *kw_a
|
|||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_blend_obj, 2, py_image_blend);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_blend_obj, 2, py_image_blend);
|
||||||
#endif//IMLIB_ENABLE_MATH_OPS
|
#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 *args, mp_map_t *kw_args)
|
||||||
|
{
|
||||||
|
int arg_ksize =
|
||||||
|
py_helper_arg_to_ksize(args[1]);
|
||||||
|
int arg_threshold =
|
||||||
|
py_helper_keyword_int(n_args, args, 2, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_threshold), 0);
|
||||||
|
image_t *arg_msk =
|
||||||
|
py_helper_keyword_to_image_mutable_mask(n_args, args, 3, kw_args);
|
||||||
|
|
||||||
|
fb_alloc_mark();
|
||||||
|
imlib_top_hat(py_helper_arg_to_image_mutable(args[0]), arg_ksize, arg_threshold, arg_msk);
|
||||||
|
fb_alloc_free_till_mark();
|
||||||
|
return args[0];
|
||||||
|
}
|
||||||
|
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 *args, mp_map_t *kw_args)
|
||||||
|
{
|
||||||
|
int arg_ksize =
|
||||||
|
py_helper_arg_to_ksize(args[1]);
|
||||||
|
int arg_threshold =
|
||||||
|
py_helper_keyword_int(n_args, args, 2, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_threshold), 0);
|
||||||
|
image_t *arg_msk =
|
||||||
|
py_helper_keyword_to_image_mutable_mask(n_args, args, 3, kw_args);
|
||||||
|
|
||||||
|
fb_alloc_mark();
|
||||||
|
imlib_black_hat(py_helper_arg_to_image_mutable(args[0]), arg_ksize, arg_threshold, arg_msk);
|
||||||
|
fb_alloc_free_till_mark();
|
||||||
|
return args[0];
|
||||||
|
}
|
||||||
|
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_black_hat_obj, 2, py_image_black_hat);
|
||||||
|
#endif // defined(IMLIB_ENABLE_MATH_OPS) && defined (IMLIB_ENABLE_BINARY_OPS)
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
// Filtering Methods
|
// Filtering Methods
|
||||||
////////////////////
|
////////////////////
|
||||||
@ -6416,8 +6418,6 @@ static const mp_rom_map_elem_t locals_dict_table[] = {
|
|||||||
{MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&py_func_unavailable_obj)},
|
{MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&py_func_unavailable_obj)},
|
||||||
#endif
|
#endif
|
||||||
#ifdef IMLIB_ENABLE_MATH_OPS
|
#ifdef IMLIB_ENABLE_MATH_OPS
|
||||||
{MP_ROM_QSTR(MP_QSTR_top_hat), MP_ROM_PTR(&py_image_top_hat_obj)},
|
|
||||||
{MP_ROM_QSTR(MP_QSTR_black_hat), MP_ROM_PTR(&py_image_black_hat_obj)},
|
|
||||||
/* Math Methods */
|
/* Math Methods */
|
||||||
{MP_ROM_QSTR(MP_QSTR_gamma_corr), MP_ROM_PTR(&py_image_gamma_corr_obj)},
|
{MP_ROM_QSTR(MP_QSTR_gamma_corr), MP_ROM_PTR(&py_image_gamma_corr_obj)},
|
||||||
{MP_ROM_QSTR(MP_QSTR_negate), MP_ROM_PTR(&py_image_negate_obj)},
|
{MP_ROM_QSTR(MP_QSTR_negate), MP_ROM_PTR(&py_image_negate_obj)},
|
||||||
@ -6433,8 +6433,6 @@ static const mp_rom_map_elem_t locals_dict_table[] = {
|
|||||||
{MP_ROM_QSTR(MP_QSTR_difference), MP_ROM_PTR(&py_image_difference_obj)},
|
{MP_ROM_QSTR(MP_QSTR_difference), MP_ROM_PTR(&py_image_difference_obj)},
|
||||||
{MP_ROM_QSTR(MP_QSTR_blend), MP_ROM_PTR(&py_image_blend_obj)},
|
{MP_ROM_QSTR(MP_QSTR_blend), MP_ROM_PTR(&py_image_blend_obj)},
|
||||||
#else
|
#else
|
||||||
{MP_ROM_QSTR(MP_QSTR_top_hat), MP_ROM_PTR(&py_func_unavailable_obj)},
|
|
||||||
{MP_ROM_QSTR(MP_QSTR_black_hat), MP_ROM_PTR(&py_func_unavailable_obj)},
|
|
||||||
{MP_ROM_QSTR(MP_QSTR_negate), MP_ROM_PTR(&py_func_unavailable_obj)},
|
{MP_ROM_QSTR(MP_QSTR_negate), MP_ROM_PTR(&py_func_unavailable_obj)},
|
||||||
{MP_ROM_QSTR(MP_QSTR_assign), MP_ROM_PTR(&py_func_unavailable_obj)},
|
{MP_ROM_QSTR(MP_QSTR_assign), MP_ROM_PTR(&py_func_unavailable_obj)},
|
||||||
{MP_ROM_QSTR(MP_QSTR_replace), MP_ROM_PTR(&py_func_unavailable_obj)},
|
{MP_ROM_QSTR(MP_QSTR_replace), MP_ROM_PTR(&py_func_unavailable_obj)},
|
||||||
@ -6448,6 +6446,13 @@ static const mp_rom_map_elem_t locals_dict_table[] = {
|
|||||||
{MP_ROM_QSTR(MP_QSTR_difference), MP_ROM_PTR(&py_func_unavailable_obj)},
|
{MP_ROM_QSTR(MP_QSTR_difference), MP_ROM_PTR(&py_func_unavailable_obj)},
|
||||||
{MP_ROM_QSTR(MP_QSTR_blend), MP_ROM_PTR(&py_func_unavailable_obj)},
|
{MP_ROM_QSTR(MP_QSTR_blend), MP_ROM_PTR(&py_func_unavailable_obj)},
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(IMLIB_ENABLE_MATH_OPS) && defined (IMLIB_ENABLE_BINARY_OPS)
|
||||||
|
{MP_ROM_QSTR(MP_QSTR_top_hat), MP_ROM_PTR(&py_image_top_hat_obj)},
|
||||||
|
{MP_ROM_QSTR(MP_QSTR_black_hat), MP_ROM_PTR(&py_image_black_hat_obj)},
|
||||||
|
#else
|
||||||
|
{MP_ROM_QSTR(MP_QSTR_top_hat), MP_ROM_PTR(&py_func_unavailable_obj)},
|
||||||
|
{MP_ROM_QSTR(MP_QSTR_black_hat), MP_ROM_PTR(&py_func_unavailable_obj)},
|
||||||
|
#endif //defined(IMLIB_ENABLE_MATH_OPS) && defined (IMLIB_ENABLE_BINARY_OPS)
|
||||||
/* Filtering Methods */
|
/* Filtering Methods */
|
||||||
{MP_ROM_QSTR(MP_QSTR_histeq), MP_ROM_PTR(&py_image_histeq_obj)},
|
{MP_ROM_QSTR(MP_QSTR_histeq), MP_ROM_PTR(&py_image_histeq_obj)},
|
||||||
#ifdef IMLIB_ENABLE_MEAN
|
#ifdef IMLIB_ENABLE_MEAN
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user