#!/usr/bin/env python
#version    :       2023.12.31
#language   :       en
from maix import display
from maix import image
from maix import camera
camera.camera.config(size=(320,240))
image.load_freetype("/root/preset/fonts/CascadiaCodePL-Italic.ttf")

while True:
    canvas = camera.capture()
    RGB = canvas.get_blob_color((154, 114, 10, 10), 0, 0)
    canvas.draw_rectangle(154,114, 164,124, color=(255,0,0), thickness=1)
    canvas.draw_rectangle(0,0, 319,20, color=((int(RGB[0])),(int(RGB[1])),(int(RGB[2]))), thickness=-1)
    canvas.draw_string(120,0, (''.join([str(x) for x in ["(", int(RGB[0]), ",", int(RGB[1]), ",", int(RGB[2]), ")"]])), scale = 1, color = ((255 - int(RGB[0])),(255 - int(RGB[1])),(255 - int(RGB[2]))), thickness = 1)
    display.show(canvas)
