提交 77eddb64 编写于 作者: E Eric.Lee

add read data json

上级 1637c942
{
"maker": "Eric.Lee",
"date": "2021-02-01",
"info": [
{
"bbox": [
0.0,
0.0,
0.0,
0.0
],
"pts": {
"0": {
"x": 69,
"y": 120
},
"1": {
"x": 49,
"y": 113
},
"2": {
"x": 36,
"y": 100
},
"3": {
"x": 27,
"y": 90
},
"4": {
"x": 22,
"y": 79
},
"5": {
"x": 47,
"y": 78
},
"6": {
"x": 42,
"y": 68
},
"7": {
"x": 37,
"y": 59
},
"8": {
"x": 34,
"y": 51
},
"9": {
"x": 58,
"y": 78
},
"10": {
"x": 53,
"y": 66
},
"11": {
"x": 49,
"y": 54
},
"12": {
"x": 46,
"y": 44
},
"13": {
"x": 66,
"y": 81
},
"14": {
"x": 64,
"y": 69
},
"15": {
"x": 63,
"y": 58
},
"16": {
"x": 61,
"y": 47
},
"17": {
"x": 74,
"y": 86
},
"18": {
"x": 76,
"y": 78
},
"19": {
"x": 78,
"y": 71
},
"20": {
"x": 80,
"y": 63
}
}
}
]
}
\ No newline at end of file
{
"maker": "Eric.Lee",
"date": "2021-02-01",
"info": [
{
"bbox": [
0.0,
0.0,
0.0,
0.0
],
"pts": {
"0": {
"x": 62,
"y": 52
},
"1": {
"x": 40,
"y": 64
},
"2": {
"x": 31,
"y": 78
},
"3": {
"x": 24,
"y": 90
},
"4": {
"x": 17,
"y": 104
},
"5": {
"x": 29,
"y": 90
},
"6": {
"x": 24,
"y": 106
},
"7": {
"x": 19,
"y": 120
},
"8": {
"x": 17,
"y": 132
},
"9": {
"x": 40,
"y": 95
},
"10": {
"x": 36,
"y": 113
},
"11": {
"x": 36,
"y": 127
},
"12": {
"x": 33,
"y": 139
},
"13": {
"x": 52,
"y": 95
},
"14": {
"x": 48,
"y": 113
},
"15": {
"x": 48,
"y": 125
},
"16": {
"x": 43,
"y": 137
},
"17": {
"x": 64,
"y": 95
},
"18": {
"x": 62,
"y": 109
},
"19": {
"x": 59,
"y": 118
},
"20": {
"x": 55,
"y": 127
}
}
}
]
}
\ No newline at end of file
{
"maker": "Eric.Lee",
"date": "2021-02-01",
"info": [
{
"bbox": [
0.0,
0.0,
0.0,
0.0
],
"pts": {
"0": {
"x": 127,
"y": 69
},
"1": {
"x": 95,
"y": 141
},
"2": {
"x": 87,
"y": 189
},
"3": {
"x": 103,
"y": 252
},
"4": {
"x": 111,
"y": 284
},
"5": {
"x": 55,
"y": 229
},
"6": {
"x": 47,
"y": 316
},
"7": {
"x": 47,
"y": 364
},
"8": {
"x": 55,
"y": 396
},
"9": {
"x": 79,
"y": 236
},
"10": {
"x": 111,
"y": 324
},
"11": {
"x": 150,
"y": 364
},
"12": {
"x": 190,
"y": 380
},
"13": {
"x": 119,
"y": 229
},
"14": {
"x": 142,
"y": 308
},
"15": {
"x": 174,
"y": 340
},
"16": {
"x": 206,
"y": 364
},
"17": {
"x": 150,
"y": 221
},
"18": {
"x": 166,
"y": 276
},
"19": {
"x": 182,
"y": 300
},
"20": {
"x": 206,
"y": 332
}
}
}
]
}
\ No newline at end of file
{
"maker": "Eric.Lee",
"date": "2021-02-01",
"info": [
{
"bbox": [
0.0,
0.0,
0.0,
0.0
],
"pts": {
"0": {
"x": 32,
"y": 117
},
"1": {
"x": 46,
"y": 117
},
"2": {
"x": 61,
"y": 111
},
"3": {
"x": 79,
"y": 113
},
"4": {
"x": 96,
"y": 117
},
"5": {
"x": 57,
"y": 76
},
"6": {
"x": 67,
"y": 66
},
"7": {
"x": 77,
"y": 61
},
"8": {
"x": 90,
"y": 59
},
"9": {
"x": 46,
"y": 68
},
"10": {
"x": 53,
"y": 53
},
"11": {
"x": 63,
"y": 43
},
"12": {
"x": 71,
"y": 33
},
"13": {
"x": 32,
"y": 66
},
"14": {
"x": 32,
"y": 53
},
"15": {
"x": 36,
"y": 41
},
"16": {
"x": 42,
"y": 28
},
"17": {
"x": 24,
"y": 74
},
"18": {
"x": 18,
"y": 64
},
"19": {
"x": 15,
"y": 55
},
"20": {
"x": 20,
"y": 43
}
}
}
]
}
\ No newline at end of file
{
"maker": "Eric.Lee",
"date": "2021-02-01",
"info": [
{
"bbox": [
0.0,
0.0,
0.0,
0.0
],
"pts": {
"0": {
"x": 6,
"y": 94
},
"1": {
"x": 21,
"y": 65
},
"2": {
"x": 35,
"y": 53
},
"3": {
"x": 42,
"y": 40
},
"4": {
"x": 50,
"y": 32
},
"5": {
"x": 68,
"y": 63
},
"6": {
"x": 60,
"y": 36
},
"7": {
"x": 39,
"y": 40
},
"8": {
"x": 27,
"y": 47
},
"9": {
"x": 64,
"y": 75
},
"10": {
"x": 50,
"y": 45
},
"11": {
"x": 27,
"y": 53
},
"12": {
"x": 29,
"y": 61
},
"13": {
"x": 56,
"y": 84
},
"14": {
"x": 40,
"y": 61
},
"15": {
"x": 25,
"y": 67
},
"16": {
"x": 29,
"y": 75
},
"17": {
"x": 46,
"y": 94
},
"18": {
"x": 31,
"y": 76
},
"19": {
"x": 19,
"y": 80
},
"20": {
"x": 29,
"y": 88
}
}
}
]
}
\ No newline at end of file
#-*-coding:utf-8-*-
# date:2021-12-20
# Author: Eric.Lee
## function: read datasets example
import os
import json
import cv2
from hand_data_iter.datasets import plot_box,draw_bd_handpose
import random
if __name__ == "__main__":
path = "./handpose_datasets/"
for f_ in os.listdir(path):
if ".jpg" in f_:
img_path = path +f_
label_path = img_path.replace('.jpg','.json')
if not os.path.exists(label_path):
continue
img_ = cv2.imread(img_path)
f = open(label_path, encoding='utf-8')#读取 json文件
hand_dict_ = json.load(f)
f.close()
hand_dict_ = hand_dict_["info"]
print("len hand_dict :",len(hand_dict_))
if len(hand_dict_)>0:
for msg in hand_dict_:
bbox = msg["bbox"]
pts = msg["pts"]
print()
print(bbox)
RGB = (random.randint(50,255),random.randint(50,255),random.randint(50,255))
plot_box(bbox, img_, color=(RGB), label="hand", line_thickness=3)
draw_bd_handpose(img_,pts,bbox[0],bbox[1])
for k_ in pts.keys():
cv2.circle(img_, (int(pts[k_]['x']+bbox[0]),int(pts[k_]['y']+bbox[1])), 3, (255,50,155),-1)
cv2.namedWindow("HandPose_Json",0)
cv2.imshow("HandPose_Json",img_)
cv2.waitKey(0)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册