mirror of
https://github.com/openmv/openmv.git
synced 2025-09-26 23:09:13 +08:00
Fixed not checking that image is grayscale image for custom palette. Made demo simpler.
This commit is contained in:
parent
91efa307e0
commit
30383d32b6
@ -21,13 +21,10 @@ while(True):
|
||||
clock.tick()
|
||||
|
||||
img = sensor.snapshot()
|
||||
small_img = img.mean_pooled(4, 4) # Makes a copy.
|
||||
|
||||
img_copy = img.copy()
|
||||
|
||||
img.to_rgb565()
|
||||
|
||||
x = (img.width()//2)-(small_img.width()//2)
|
||||
y = (img.height()//2)-(small_img.height()//2)
|
||||
|
||||
img.draw_image(small_img, x, y, x_scale=2, y_scale=2, color_palette=palette)
|
||||
img.draw_image(img_copy, 0, 0, color_palette=palette)
|
||||
|
||||
print(clock.fps())
|
||||
|
@ -1954,6 +1954,10 @@ STATIC mp_obj_t py_image_draw_image(uint n_args, const mp_obj_t *args, mp_map_t
|
||||
}
|
||||
}
|
||||
|
||||
if (color_palette) {
|
||||
if (arg_other->bpp != IMAGE_BPP_GRAYSCALE) nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "Can only specify color palette when passing a grayscale image!"));
|
||||
}
|
||||
|
||||
imlib_draw_image(arg_img, arg_other, arg_cx, arg_cy, arg_x_scale, arg_y_scale, arg_alpha, arg_msk, color_palette);
|
||||
return args[0];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user