k210照片采集脚本
时间: 2023-08-03 14:09:20 浏览: 103
照片采集
根据引用\[3\]中提供的信息,可以使用以下Python脚本来采集K210的照片:
```python
from PIL import Image
import os.path
import glob
def convertjpg(jpgfile, outdir, width=224, height=224):
img = Image.open(jpgfile)
try:
new_img = img.resize((width, height), Image.BILINEAR)
new_img.save(os.path.join(outdir, os.path.basename(jpgfile)))
except Exception as e:
print(e)
for jpgfile in glob.glob("video/rubber/*.JPG"):
convertjpg(jpgfile, "images")
```
请确保在运行脚本之前,你已经创建了一个名为"images"的文件夹,并将要转换的图片放在"video/rubber"文件夹中。运行脚本后,转换后的图片将保存在"images"文件夹中,你可以删除原始的"video"文件夹。
#### 引用[.reference_title]
- *1* *2* [K210物体检测(利用Maixpy、在线模型训练、串口通信)](https://blog.csdn.net/qq_46554815/article/details/122811678)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [K210借助MaixHub训练平台进行目标检测](https://blog.csdn.net/qq_45420611/article/details/114398067)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文