mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Merge pull request #2006 from kwagyeman/kwabena/refactor_palette_constants
modules: Move palette constants to the image module.
This commit is contained in:
commit
a1b95152cb
@ -23,6 +23,7 @@
|
||||
|
||||
import sensor
|
||||
import time
|
||||
import image
|
||||
|
||||
# Color Tracking Thresholds (Grayscale Min, Grayscale Max)
|
||||
threshold_list = [(200, 255)]
|
||||
@ -86,7 +87,7 @@ while True:
|
||||
),
|
||||
)
|
||||
)
|
||||
img.to_rainbow(color_palette=sensor.PALETTE_IRONBOW) # color it
|
||||
img.to_rainbow(color_palette=image.PALETTE_IRONBOW) # color it
|
||||
# Draw stuff on the colored image
|
||||
for blob in blobs:
|
||||
img.draw_rectangle(blob.rect())
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
import sensor
|
||||
import time
|
||||
import display
|
||||
import image
|
||||
|
||||
# Color Tracking Thresholds (Grayscale Min, Grayscale Max)
|
||||
threshold_list = [(200, 255)]
|
||||
@ -88,7 +89,7 @@ while True:
|
||||
),
|
||||
)
|
||||
)
|
||||
img.to_rainbow(color_palette=sensor.PALETTE_IRONBOW) # color it
|
||||
img.to_rainbow(color_palette=image.PALETTE_IRONBOW) # color it
|
||||
# Draw stuff on the colored image
|
||||
for blob in blobs:
|
||||
img.draw_rectangle(blob.rect())
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
import sensor
|
||||
import time
|
||||
import image
|
||||
|
||||
# Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)
|
||||
threshold_list = [(70, 100, -30, 40, 20, 100)]
|
||||
@ -32,7 +33,7 @@ print(
|
||||
+ ("Yes" if sensor.ioctl(sensor.IOCTL_LEPTON_GET_RADIOMETRY) else "No")
|
||||
)
|
||||
# Make the color palette cool
|
||||
sensor.set_color_palette(sensor.PALETTE_IRONBOW)
|
||||
sensor.set_color_palette(image.PALETTE_IRONBOW)
|
||||
|
||||
sensor.set_pixformat(sensor.RGB565)
|
||||
sensor.set_framesize(sensor.QQVGA)
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
import sensor
|
||||
import time
|
||||
import display
|
||||
import image
|
||||
|
||||
# Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)
|
||||
threshold_list = [(70, 100, -30, 40, 20, 100)]
|
||||
@ -33,7 +34,7 @@ print(
|
||||
+ ("Yes" if sensor.ioctl(sensor.IOCTL_LEPTON_GET_RADIOMETRY) else "No")
|
||||
)
|
||||
# Make the color palette cool
|
||||
sensor.set_color_palette(sensor.PALETTE_IRONBOW)
|
||||
sensor.set_color_palette(image.PALETTE_IRONBOW)
|
||||
|
||||
sensor.set_pixformat(sensor.RGB565)
|
||||
sensor.set_framesize(sensor.LCD)
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
|
||||
import sensor
|
||||
import time
|
||||
import image
|
||||
|
||||
# Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)
|
||||
threshold_list = [(70, 100, -30, 40, 20, 100)]
|
||||
@ -50,7 +51,7 @@ print(
|
||||
+ ("Yes" if sensor.ioctl(sensor.IOCTL_LEPTON_GET_RADIOMETRY) else "No")
|
||||
)
|
||||
# Make the color palette cool
|
||||
sensor.set_color_palette(sensor.PALETTE_IRONBOW)
|
||||
sensor.set_color_palette(image.PALETTE_IRONBOW)
|
||||
|
||||
sensor.set_pixformat(sensor.RGB565)
|
||||
sensor.set_framesize(sensor.QQVGA)
|
||||
|
||||
@ -77,7 +77,7 @@ while True:
|
||||
y_bounce,
|
||||
rgb_channel=-1,
|
||||
alpha=alpha_value // alpha_div,
|
||||
color_palette=sensor.PALETTE_IRONBOW,
|
||||
color_palette=image.PALETTE_IRONBOW,
|
||||
hint=hint | image.CENTER,
|
||||
)
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ while True:
|
||||
y_bounce,
|
||||
rgb_channel=-1,
|
||||
alpha=alpha_value // alpha_div,
|
||||
color_palette=sensor.PALETTE_IRONBOW,
|
||||
color_palette=image.PALETTE_IRONBOW,
|
||||
alpha_palette=alpha_lut,
|
||||
hint=hint | image.CENTER,
|
||||
)
|
||||
|
||||
@ -41,7 +41,7 @@ while True:
|
||||
img = fir.snapshot(
|
||||
x_size=w,
|
||||
y_size=h,
|
||||
color_palette=fir.PALETTE_IRONBOW,
|
||||
color_palette=image.PALETTE_IRONBOW,
|
||||
hint=drawing_hint,
|
||||
copy_to_fb=True,
|
||||
)
|
||||
|
||||
@ -29,7 +29,7 @@ while True:
|
||||
img = fir.snapshot(
|
||||
x_size=w,
|
||||
y_size=h,
|
||||
color_palette=fir.PALETTE_IRONBOW,
|
||||
color_palette=image.PALETTE_IRONBOW,
|
||||
hint=drawing_hint,
|
||||
copy_to_fb=True,
|
||||
)
|
||||
|
||||
@ -41,7 +41,7 @@ while True:
|
||||
img = fir.snapshot(
|
||||
x_size=w,
|
||||
y_size=h,
|
||||
color_palette=fir.PALETTE_IRONBOW,
|
||||
color_palette=image.PALETTE_IRONBOW,
|
||||
hint=drawing_hint,
|
||||
copy_to_fb=True,
|
||||
)
|
||||
|
||||
@ -57,7 +57,7 @@ static const char fresh_main_py[] =
|
||||
" x_scale = img.width() / fir_img.width()\n"
|
||||
" y_scale = img.height() / fir_img.height()\n"
|
||||
" img.draw_image(fir_img, 0, 0, x_scale = x_scale, y_scale = y_scale,\n"
|
||||
" color_palette = sensor.PALETTE_IRONBOW,\n"
|
||||
" color_palette = image.PALETTE_IRONBOW,\n"
|
||||
" alpha_palette = alpha_pal,\n"
|
||||
" hint = image.BICUBIC)\n"
|
||||
"\n"
|
||||
|
||||
@ -1243,10 +1243,6 @@ STATIC const mp_rom_map_elem_t globals_dict_table[] = {
|
||||
#if (OMV_ENABLE_FIR_LEPTON == 1)
|
||||
{ MP_ROM_QSTR(MP_QSTR_FIR_LEPTON), MP_ROM_INT(FIR_LEPTON) },
|
||||
#endif
|
||||
{ MP_ROM_QSTR(MP_QSTR_PALETTE_RAINBOW), MP_ROM_INT(COLOR_PALETTE_RAINBOW) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PALETTE_IRONBOW), MP_ROM_INT(COLOR_PALETTE_IRONBOW) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GRAYSCALE), MP_ROM_INT(PIXFORMAT_GRAYSCALE) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RGB565), MP_ROM_INT(PIXFORMAT_RGB565) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&py_fir_init_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&py_fir_deinit_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_type), MP_ROM_PTR(&py_fir_type_obj) },
|
||||
|
||||
@ -7210,6 +7210,8 @@ static const mp_rom_map_elem_t globals_dict_table[] = {
|
||||
{MP_ROM_QSTR(MP_QSTR_YUV422), MP_ROM_INT(PIXFORMAT_YUV422)}, /* 2BPP/YUV422*/
|
||||
{MP_ROM_QSTR(MP_QSTR_JPEG), MP_ROM_INT(PIXFORMAT_JPEG)}, /* JPEG/COMPRESSED*/
|
||||
{MP_ROM_QSTR(MP_QSTR_PNG), MP_ROM_INT(PIXFORMAT_PNG)}, /* PNG/COMPRESSED*/
|
||||
{MP_ROM_QSTR(MP_QSTR_PALETTE_RAINBOW), MP_ROM_INT(COLOR_PALETTE_RAINBOW)},
|
||||
{MP_ROM_QSTR(MP_QSTR_PALETTE_IRONBOW), MP_ROM_INT(COLOR_PALETTE_IRONBOW)},
|
||||
{MP_ROM_QSTR(MP_QSTR_AREA), MP_ROM_INT(IMAGE_HINT_AREA)},
|
||||
{MP_ROM_QSTR(MP_QSTR_BILINEAR), MP_ROM_INT(IMAGE_HINT_BILINEAR)},
|
||||
{MP_ROM_QSTR(MP_QSTR_BICUBIC), MP_ROM_INT(IMAGE_HINT_BICUBIC)},
|
||||
|
||||
@ -1097,10 +1097,6 @@ STATIC const mp_map_elem_t globals_dict_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_WQXGA), MP_OBJ_NEW_SMALL_INT(FRAMESIZE_WQXGA)}, /* 2560x1600 */
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_WQXGA2), MP_OBJ_NEW_SMALL_INT(FRAMESIZE_WQXGA2)}, /* 2592x1944 */
|
||||
|
||||
// Color Palettes
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_PALETTE_RAINBOW), MP_OBJ_NEW_SMALL_INT(COLOR_PALETTE_RAINBOW)},
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_PALETTE_IRONBOW), MP_OBJ_NEW_SMALL_INT(COLOR_PALETTE_IRONBOW)},
|
||||
|
||||
// IOCTLs
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_IOCTL_SET_READOUT_WINDOW), MP_OBJ_NEW_SMALL_INT(IOCTL_SET_READOUT_WINDOW)},
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_IOCTL_GET_READOUT_WINDOW), MP_OBJ_NEW_SMALL_INT(IOCTL_GET_READOUT_WINDOW)},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user