利用landmark绘画出相应的图

files里面的landmark.txt内容如下:

0.jpg 512-512 262-432 147-241 167-376 175-389 186-401 198-411 212-420 227-427 244-431 146-256 145-272 145-287 146-302 148-317 151-333 155-348 160-362 370-248 348-377 341-389 331-400 320-410 308-418 295-426 280-430 371-263 370-278 369-293 367-307 364-321 361-335 358-349 354-363 205-262 205-254 185-257 194-260 217-261 205-254 228-260 206-248 194-250 219-251 171-227 188-225 205-225 238-230 222-226 187-216 206-212 240-220 225-214 222-361 262-379 243-360 233-369 245-376 283-361 292-370 279-376 263-361 304-362 264-359 254-346 237-352 229-361 244-359 274-346 290-353 298-362 283-359 264-349 263-252 263-269 263-286 245-261 238-299 232-316 242-321 253-323 264-326 281-261 289-299 294-316 285-321 274-323 264-303 316-264 312-255 294-260 305-262 327-261 312-255 336-257 316-248 303-251 327-251 286-226 303-224 319-224 334-226 350-230 286-219 302-215 319-215 336-218
import cv2
import numpy as np
import torch
from PIL import Image

files = 'E:/pycharm_workspace/workspace/datasets/landmark.txt'
class drow_land():
    def __init__(self):
        super(drow_land,self).__init__()
        pass

    def draw_l(self,files):
        file = open(files, 'r').readlines()
        lab_template = np.zeros((512,512,3))
        for i,f in enumerate(file):
            names,shape = self.get_land(f)
            shape = torch.Tensor(shape)
            lab = self.drawCircle(lab_template.copy(), shape.data, radius=1, color=(255, 255, 255), thickness=8)
            img = Image.fromarray(np.uint8(lab)).convert('RGB')
            img.save('{}.jpg'.format(i))

    def get_land(self,landmark):
        l = landmark.strip().split()
        name = l[0]
        shape = []
        for i in l[2:]:
            w,h = [ float(j) for j in i.split('-')]
            shape.extend([w,h])
        return name,shape

    def drawCircle(self, img, shape, radius=1, color=(255, 255, 255), thickness=1):
        for i in range(len(shape) // 2):
            img = cv2.circle(img, (int(shape[2 * i]), int(shape[2 * i + 1])), radius, color, thickness)
        return img





if __name__ == '__main__':
    print("--------draw landmark-------")
    d = drow_land()
    d.draw_l(files)

结果如下:

import os
import cv2
import numpy as np
import torch
from PIL import Image

files = 'E:/pycharm_workspace/workspace/datasets/landmark_headpose.txt'
path = 'E:/pycharm_workspace/workspace/datasets/'
class drow_land():
    def __init__(self):
        super(drow_land,self).__init__()
        pass

    def draw_l(self,files):
        file = open(files, 'r').readlines()
        lab_template = np.zeros((1024,1024,3))
        for i,f in enumerate(file):
            names,shape = self.get_land(f)
            shape = torch.Tensor(shape)
            lab = self.drawCircle(lab_template.copy(), shape.data, radius=1, color=(255, 255, 255), thickness=8)
            img = Image.fromarray(np.uint8(lab)).convert('RGB')
            img.save(os.path.join(path,'{}'.format(names)))

    def get_land(self,landmark):
        l = landmark.strip().split()
        name = l[0]
        shape = []
        for i in l[2:]:
            w,h = [ float(j) for j in i.split('-')]
            shape.extend([w,h])
        return name,shape

    def drawCircle(self, img, shape, radius=1, color=(255, 255, 255), thickness=1):
        for i in range(len(shape) // 2):
            img = cv2.circle(img, (int(shape[2 * i]), int(shape[2 * i + 1])), radius, color, thickness)
        return img





if __name__ == '__main__':
    print("--------draw landmark-------")
    d = drow_land()
    d.draw_l(files)
    print('OK')

 

Landmark 学习手册 一、 数据加载(GeoDataLoading)…………………………...3 1、 建立投影系统……………………………………………………………..6 2、 建立OpenWorks数据库………………………………………………….6 3、 加载钻井平面位置和地质分层(pick)……………………………………6 4、 加载钻井垂直位置、时深表、测井曲线和合成地震记录……………..9 二、 常规解释流程(SeisWorks、TDQ、ZmapPlus)…...15 1、 SeisWorks解释模块的功能………………………………..16 (1)、三维震工区中常见的文件类型……………………………………..16 (2)、用HrzUtil对层位进行管理…………………………………………17 2、 TDQ时深转换模块……………………………………………………….18 (1)、建速度模型………………………..……………………………….…18 ①、用OpenWorks的时深表做速度模型……………………………….18 ②、用速度函数做速度模型…………………………………………….19 ③、用数学方程计算ACSII速度函数文件…………………………….21 (2)、时深(深时)转换…………………………………………………..22 (3)、速度模型的输及其应用………………………………..….………28 (4)、基准面的类型……………………………………………..….…… 29 (5)、如何调整不同的基准面……………………………………..….…...30 3 、ZmapPlus地质绘模块…………………………………………….…….30 (1)、做前的准备工作 ……………..……………………………..…....32 (2)、用 ASCII磁盘文件绘制平面…… ………………………………32 (3)、用 SeisWorks解释数据绘制平面 …………………………… ...33 (4)、网格运算……………………………………………………………. 37 (5)、井点处深度校正…………………………………………………..…37 三、 合成记录制作(Syntool)………………………..………37 1 、准备工作……..…………………………………………….………….….37 2 、启动Syntool……………………………………………………….….….37 3 、基准面信息…………………………………………………………...….38 4 、子波提取……………………………………………………………...….39 5 、应用Checkshot…………………………………………………….…….41 6 、合成地震记录的存储…………………………………………………….44 7 、SeisWelll………………………………………………………………….45 四、 迭后处理/属性提取、聚类分析(PostStack/PAL、Rave …………………………………….…50 1、数据处理模块……………………………………………………………….52 2 、相似性预测…………………………..…………………………………….60 (1)、Fscan 相似性分析原理..……….…..…………………………………61 (2)、导致不相似的因素…. ……………..…………………………………62 3 、属性提取..………………………………………………………………….63 4 、储层特征可视化与油气预测技术………………………..……………….73 (1)、数据输入……………. ……………..…………………………………74 ①、ASCII文件的输入…………………..………………………………74 ②、OpenWorks井数据的输入……………………………………………74 ③、SeisWorks Horizons数据的输入………………………….………75 ④、回归模型的输入…………………….………………………………76 (2)、数据分析……………. ……………..…………………………………77 五、 分频解释(SpecDecomp)………………………………..82 1 、分频技术的原理..…………………………………………………… .….82 2 、分频技术的特点……….…………………………………………………83 3 、应用………………………………………………………………………..84 附:OpenWorks数据库的有关知识………………….………86 1 、关系数据库的概念………....………………………………………… ..86
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值