如何更改rgb565图片尺寸的大小?

Viewed 358

shape=img.shape
img_tmp = img.reshape((shape[0], shape[1]*shape[2]))
img_trans = img_tmp.transpose()
img_hwc = img_trans.copy().reshape((shape[1],shape[2],shape[0]))
img_new = image.Image(shape[2], shape[1], image.RGB888, alloc=image.ALLOC_REF,data =img_hwc)
for det in dets:
x1, y1, x2, y2 = map(lambda x: int(round(x, 0)), det[:4])
x = x1
y = y1
w = (x2 - x1)
h = (y2 - y1)
img_new.draw_rectangle(x,y, w, h, color=ob_det.get_color(int(det[5])),thickness=4)
img_new.draw_string_advanced( x , y-50,32," " + ob_det.labels[int(det[5])] + " " + str(round(det[4],2)) , color=ob_det.get_color(int(det[5])))
if "disease" in ob_det.labels[int(det[5])]:
img_565 = img_new.to_rgb565()
img_565.save(img_path)
time.sleep_ms(5)
return True

1 Answers