K230图像保存

Viewed 116

重现步骤

pipeline通道获取一帧图像后,保存帧图像失败
期待结果和实际结果

在指定路径下保存一张图像

软硬件版本信息

cc700b1048fe12a868a4068e158b4d06.png
K230

错误日志

图像尺寸 (3, 1080, 1920)
图像类型 <class 'ndarray'>
图像尺寸 (3, 1080, 1920)
图像类型 <class 'ndarray'>
图像尺寸 (3, 1080, 1920)
图像类型 <class 'ndarray'>
图像尺寸 (3, 1080, 1920)
图像类型 <class 'ndarray'>
图像尺寸 (3, 1080, 1920)
['unknown']

Traceback (most recent call last):
File "", line 386, in
AttributeError: 'ndarray' object has no attribute 'save'
MPY: soft reboot
CanMV v1.2.2(based on Micropython e00a144) on 2024-12-18; k230_canmv_01studio with K230

尝试解决过程

未解决,猜测数据类型不一致,需要进行一个np数组转图像才能保存

补充材料

ba57564590bf704f730519ea2c573880.png

1 Answers

您好,img返回的是ulab.numpy.ndarray类型的CHW数据,需要转换成HWC数据,然后创建Image实例,然后才能保存。