mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Add imlib flag to enable/disable math ops.
This commit is contained in:
parent
2f6c871e31
commit
a69bfc3709
@ -9,6 +9,9 @@
|
||||
#ifndef __IMLIB_CONFIG_H__
|
||||
#define __IMLIB_CONFIG_H__
|
||||
|
||||
// Enable math ops
|
||||
#define IMLIB_ENABLE_MATH_OPS
|
||||
|
||||
// Enable flood_fill()
|
||||
#define IMLIB_ENABLE_FLOOD_FILL
|
||||
|
||||
|
||||
@ -9,6 +9,9 @@
|
||||
#ifndef __IMLIB_CONFIG_H__
|
||||
#define __IMLIB_CONFIG_H__
|
||||
|
||||
// Enable math ops
|
||||
#define IMLIB_ENABLE_MATH_OPS
|
||||
|
||||
// Enable flood_fill()
|
||||
#define IMLIB_ENABLE_FLOOD_FILL
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
|
||||
#include "imlib.h"
|
||||
|
||||
#ifdef IMLIB_ENABLE_MATH_OPS
|
||||
void imlib_negate(image_t *img)
|
||||
{
|
||||
switch(img->bpp) {
|
||||
@ -635,3 +636,4 @@ void imlib_blend(image_t *img, const char *path, image_t *other, int scalar, flo
|
||||
state.mask = mask;
|
||||
imlib_image_operation(img, path, other, scalar, imlib_blend_line_op, &state);
|
||||
}
|
||||
#endif //IMLIB_ENABLE_MATH_OPS
|
||||
|
||||
@ -1759,6 +1759,11 @@ STATIC mp_obj_t py_image_close(uint n_args, const mp_obj_t *args, mp_map_t *kw_a
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_close_obj, 2, py_image_close);
|
||||
|
||||
#ifdef IMLIB_ENABLE_MATH_OPS
|
||||
///////////////
|
||||
// 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 =
|
||||
@ -1791,10 +1796,6 @@ STATIC mp_obj_t py_image_black_hat(uint n_args, const mp_obj_t *args, mp_map_t *
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_black_hat_obj, 2, py_image_black_hat);
|
||||
|
||||
///////////////
|
||||
// Math Methods
|
||||
///////////////
|
||||
|
||||
STATIC mp_obj_t py_image_negate(mp_obj_t img_obj)
|
||||
{
|
||||
fb_alloc_mark();
|
||||
@ -2041,6 +2042,7 @@ STATIC mp_obj_t py_image_blend(uint n_args, const mp_obj_t *args, mp_map_t *kw_a
|
||||
return args[0];
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_blend_obj, 2, py_image_blend);
|
||||
#endif//IMLIB_ENABLE_MATH_OPS
|
||||
|
||||
////////////////////
|
||||
// Filtering Methods
|
||||
@ -5288,6 +5290,7 @@ static const mp_rom_map_elem_t locals_dict_table[] = {
|
||||
{MP_ROM_QSTR(MP_QSTR_dilate), MP_ROM_PTR(&py_image_dilate_obj)},
|
||||
{MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&py_image_open_obj)},
|
||||
{MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&py_image_close_obj)},
|
||||
#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 */
|
||||
@ -5301,6 +5304,20 @@ static const mp_rom_map_elem_t locals_dict_table[] = {
|
||||
{MP_ROM_QSTR(MP_QSTR_max), MP_ROM_PTR(&py_image_max_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)},
|
||||
#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_replace), MP_ROM_PTR(&py_func_unavailable_obj)},
|
||||
{MP_ROM_QSTR(MP_QSTR_add), MP_ROM_PTR(&py_func_unavailable_obj)},
|
||||
{MP_ROM_QSTR(MP_QSTR_sub), MP_ROM_PTR(&py_func_unavailable_obj)},
|
||||
{MP_ROM_QSTR(MP_QSTR_mul), MP_ROM_PTR(&py_func_unavailable_obj)},
|
||||
{MP_ROM_QSTR(MP_QSTR_div), MP_ROM_PTR(&py_func_unavailable_obj)},
|
||||
{MP_ROM_QSTR(MP_QSTR_min), MP_ROM_PTR(&py_func_unavailable_obj)},
|
||||
{MP_ROM_QSTR(MP_QSTR_max), 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)},
|
||||
#endif
|
||||
/* Filtering Methods */
|
||||
{MP_ROM_QSTR(MP_QSTR_histeq), MP_ROM_PTR(&py_image_histeq_obj)},
|
||||
{MP_ROM_QSTR(MP_QSTR_mean), MP_ROM_PTR(&py_image_mean_obj)},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user