CrowdHuman 测试

举报
风吹稻花香 发表于 2021/06/05 01:28:50 2021/06/05
【摘要】   CrowdHuman测试 hbox:head box vbox:可见身体box fbox:联想扩展身体box 坐标: x y w h cv2.rectangle:x1 y1 x2 y2 如果 x1 y1 x2 y2超出边界,不报错,但是画不出来  height,width=img.shape[:2] import cv2import ...

 

CrowdHuman测试

hbox:head box

vbox:可见身体box

fbox:联想扩展身体box

坐标: x y w h

cv2.rectangle:x1 y1 x2 y2

如果 x1 y1 x2 y2超出边界,不报错,但是画不出来

 height,width=img.shape[:2]


  
  1. import cv2
  2. import json
  3. obj_str='{"ID": "284193,faa9000f2678b5e", "gtboxes": [{"tag": "person", "hbox": [123, 129, 63, 64], "head_attr": {"ignore": 0, "occ": 1, "unsure": 0}, "fbox": [61, 123, 191, 453], "vbox": [62, 126, 154, 446], "extra": {"box_id": 0, "occ": 1}}, {"tag": "person", "hbox": [214, 97, 58, 74], "head_attr": {"ignore": 0, "occ": 1, "unsure": 0}, "fbox": [165, 95, 187, 494], "vbox": [175, 95, 140, 487], "extra": {"box_id": 1, "occ": 1}}, {"tag": "person", "hbox": [318, 109, 58, 68], "head_attr": {"ignore": 0, "occ": 1, "unsure": 0}, "fbox": [236, 104, 195, 493], "vbox": [260, 106, 170, 487], "extra": {"box_id": 2, "occ": 1}}, {"tag": "person", "hbox": [486, 119, 61, 74], "head_attr": {"ignore": 0, "occ": 0, "unsure": 0}, "fbox": [452, 110, 169, 508], "vbox": [455, 113, 141, 501], "extra": {"box_id": 3, "occ": 1}}, {"tag": "person", "hbox": [559, 105, 53, 57], "head_attr": {"ignore": 0, "occ": 0, "unsure": 0}, "fbox": [520, 95, 163, 381], "vbox": [553, 98, 70, 118], "extra": {"box_id": 4, "occ": 1}}, {"tag": "person", "hbox": [596, 40, 72, 83], "head_attr": {"ignore": 0, "occ": 0, "unsure": 0}, "fbox": [546, 39, 202, 594], "vbox": [556, 39, 171, 588], "extra": {"box_id": 5, "occ": 1}}, {"tag": "person", "hbox": [731, 139, 69, 83], "head_attr": {"ignore": 0, "occ": 0, "unsure": 0}, "fbox": [661, 132, 183, 510], "vbox": [661, 132, 183, 510], "extra": {"box_id": 6, "occ": 0}}]}'
  4. data = json.loads(obj_str)
  5. img=cv2.imread("284193,faa9000f2678b5e.jpg")
  6. print(data["ID"])
  7. for obj in data["gtboxes"]:
  8. # print('tag',obj['tag'])
  9. print('hbox',obj['hbox'])
  10. # draw_0 = cv2.rectangle(img, (obj['hbox'][0], obj['hbox'][1]), (obj['hbox'][0]+obj['hbox'][2], obj['hbox'][1]+obj['hbox'][3]), (255, 0, 0), 1)
  11. # print('head_attr',obj['head_attr'])
  12. print('fbox',obj['fbox'])
  13. # draw_0 = cv2.rectangle(img, (obj['fbox'][0], obj['fbox'][1]),(obj['fbox'][0] + obj['fbox'][2], obj['fbox'][1] + obj['fbox'][3]), (0, 255, 0), 1)
  14. print('vbox',obj['vbox'])
  15. draw_0 = cv2.rectangle(img, (obj['vbox'][0], obj['vbox'][1]),(obj['vbox'][0] + obj['vbox'][2], obj['vbox'][1] + obj['vbox'][3]), (0, 0,255), 1)
  16. # print('extra',obj['extra'])
  17. cv2.imshow("'sdf",img)
  18. cv2.waitKey()

 

文章来源: blog.csdn.net,作者:网奇,版权归原作者所有,如需转载,请联系作者。

原文链接:blog.csdn.net/jacke121/article/details/88583798

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。