plot point on pictures via json

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 28 18:52:38 2018


@author: xiaobing.wang
"""
import cv2 as cv 
from skimage import transform,data
from PIL import Image
import matplotlib.pyplot as plt
import json 
#view raw_
'''
image = '/data/xiaobing.wang/Li/Hand_v/Dataset_Hand/hand_labels/manual_train/009993691_01_r.jpg'
img = Image.open(image)
x1=[]
y1=[]
with open('/data/xiaobing.wang/Li/Hand_v/Dataset_Hand/hand_labels/manual_train/009993691_01_r.json') as f:
    pos = json.load(f)
    head_length = float(pos['head_size'])
    x = float(pos['hand_box_center'][0])
    y = float(pos['hand_box_center'][1])
    crop_x_left = x - head_length/2
    crop_y_up = y - head_length/2
    crop_x_right = x + head_length/2
    crop_y_down = y + head_length/2
    box = (crop_x_left,crop_y_up,crop_x_right,crop_y_down)
    roi = img.crop(box)


    for i,j,k in pos['hand_pts']:
        x1.append(i-crop_x_left)
        y1.append(j-crop_y_up)
  
plt.imshow(roi)


plt.plot(x1,y1,'*',color='red')
plt.show()      
'''
#view train_


test_image = '/data/xiaobing.wang/Li/Hand_v/Dataset_Hand/hand_labels/manual_train_hands/009993691_01_r.jpg'
oriImg = cv.imread(test_image)
plt.imshow(oriImg[:,:,[2,1,0]])
x1=[]
y1=[]
with open('/data/xiaobing.wang/Li/Hand_v/Dataset_Hand/hand_labels/manual_train_hands/009993691_01_r.json') as f:
    pos = json.load(f)
    for i,j,k in pos['hand_pts']:
        x1.append(i)
        y1.append(j)
plt.plot(x1,y1,'*',color='red')

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值