如何从列表列表中制作农作物
我有一个像这样的 n 个列表的列表
pixels = [[400, 220, 515, 293], [433, 373, 482, 452], [401, 370, 477, 475]]
每个子列表对应于每种作物的左上点和右下点
我编写了这段代码来从整个列表中提取单个作物
x1 = min(map(lambda x: x[0], pixels))
y1 = min(map(lambda x: x[1], pixels))
x2 = max(map(lambda x: x[2], pixels))
y2 = max(map(lambda x: x[3], pixels))
crop = img[y1:y2, x1:x2]
cv2_imshow(crop)
如何从 n 个子列表中制作 n 种作物?
I have a list of n lists like this
pixels = [[400, 220, 515, 293], [433, 373, 482, 452], [401, 370, 477, 475]]
Each sublist correspond to the Top Left and Bottom Right Points for each crop
I made this code to extract a single crop from the whole list
x1 = min(map(lambda x: x[0], pixels))
y1 = min(map(lambda x: x[1], pixels))
x2 = max(map(lambda x: x[2], pixels))
y2 = max(map(lambda x: x[3], pixels))
crop = img[y1:y2, x1:x2]
cv2_imshow(crop)
How can I make n crops from n sublists?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
希望它会起作用
Hope It will work