决定认真学习一下<JAVA 2D Graphics>

        前些日子为了写个东西接触了一些JAVA 2D方面的知识,并且从网上下了本O'REILLY的<java graphics=""></java>.貌似这也是目前能找到唯一一本专门介绍JAVA 2D的书籍了,而且蔡学镛对这本书的评价也不错.本来下这本书的似乎就想好好把它钻研一番,但草草浏览了一些,对JAVA 2D Graphics有个大概的了解后懒惰的毛病又发作了,所以直到现在对JAVA 2D的了解还是停留在很浅的层次上.

        貌似我对编程技术学习的兴趣总是这样一个开口向下的二次曲线:刚开始对一个新东西什么也不懂,通过某种途径接触到后觉得非常有意思,于是乎表现出巨大的兴趣,并花大量的精力去学习了解这个事物;然后在很短的时间内对这个东西有了个大概的了解,但之后兴趣就急剧下降,因为感觉剩下的东西要么太难了要么是些花时间的东西...于是水平也就停留在这个层次:对付菜鸟的提问绰绰有余,离高手还有十万八千里.

        当然,我似乎可以找到一个借口:因为我不是学计算机的,以后大概也不会从事程序员的行业.不过这并不能作为理由,因为我学习其它东西的表现也好不了多少,看来性格懒散才是跟本原因.这样偶尔也会让我很不安:花了这么多时间花在学编程上,别人看到我还说我用电脑都在学习.其实我和别人玩电脑游戏一样也是在玩,只是玩的方式不一样而已.

       呵呵,不过想必和我一样懒散的大有人在,才会造成高手总是少数把(^_^)

       不过我决定好好研究下JAVA 2D Graphics,因为这个和我学的多多少少还有些联系,说不定以后用得上.另一方面希望能改变一下自己懒散的毛病,提高一下JAVA编程的能力,从中获得更多的成就感:)

        目前的读书计划:每天花一至两个小时来读这本书,并写下读书心得.不求速度,但求质量.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
用python帮我把下面标签中的有效数据提取出来<annotation> <folder>converted/CMS/2D目标检测/filter</folder> <filename>converted/CMS/2D目标检测/filter_empty_target_img_after_hash2/0/20230401180910649_61.jpg</filename> <source> <database>Unknown</database> <annotation>Unknown</annotation> <image>Unknown</image> </source> <size> <width>1920</width> <height>1536</height> <depth></depth> </size> <segmented>0</segmented> <object> <name>二轮车</name> <truncated>0</truncated> <occluded>0</occluded> <difficult>0</difficult> <bndbox> <xmin>626.38</xmin> <ymin>808.12</ymin> <xmax>650.03</xmax> <ymax>852.04</ymax> </bndbox> <attributes> <attribute> <name>rotation</name> <value>0.0</value> </attribute> <attribute> <name>track_id</name> <value>6</value> </attribute> <attribute> <name>keyframe</name> <value>True</value> </attribute> </attributes> </object> <object> <name>行人</name> <truncated>0</truncated> <occluded>0</occluded> <difficult>0</difficult> <bndbox> <xmin>1612.74</xmin> <ymin>831.51</ymin> <xmax>1627.34</xmax> <ymax>873.8</ymax> </bndbox> <attributes> <attribute> <name>rotation</name> <value>0.0</value> </attribute> <attribute> <name>track_id</name> <value>8</value> </attribute> <attribute> <name>keyframe</name> <value>True</value> </attribute> </attributes> </object> <object> <name>行人</name> <truncated>0</truncated> <occluded>0</occluded> <difficult>0</difficult> <bndbox> <xmin>1469.0</xmin> <ymin>832.96</ymin> <xmax>1489.43</xmax> <ymax>865.8</ymax> </bndbox> <attributes> <attribute> <name>rotation</name> <value>0.0</value> </attribute> <attribute> <name>track_id</name> <value>9</value> </attribute> <attribute> <name>keyframe</name> <value>True</value> </attribute> </attributes> </object> </annotation>
07-20
你可以使用Python中的xml.etree.ElementTree库来解析XML数据并提取标签中的有效数据。以下是一个示例代码,演示如何提取出有效数据: ```python import xml.etree.ElementTree as ET # 定义XML字符串 xml_string = ''' <annotation> <folder>converted/CMS/2D目标检测/filter</folder> <filename>converted/CMS/2D目标检测/filter_empty_target_img_after_hash2/0/20230401180910649_61.jpg</filename> <source> <database>Unknown</database> <annotation>Unknown</annotation> <image>Unknown</image> </source> <size> <width>1920</width> <height>1536</height> <depth></depth> </size> <segmented>0</segmented> <object> <name>二轮车</name> <truncated>0</truncated> <occluded>0</occluded> <difficult>0</difficult> <bndbox> <xmin>626.38</xmin> <ymin>808.12</ymin> <xmax>650.03</xmax> <ymax>852.04</ymax> </bndbox> <attributes> <attribute> <name>rotation</name> <value>0.0</value> </attribute> <attribute> <name>track_id</name> <value>6</value> </attribute> <attribute> <name>keyframe</name> <value>True</value> </attribute> </attributes> </object> <object> <name>行人</name> <truncated>0</truncated> <occluded>0</occluded> <difficult>0</difficult> <bndbox> <xmin>1612.74</xmin> <ymin>831.51</ymin> <xmax>1627.34</xmax> <ymax>873.8</ymax> </bndbox> <attributes> <attribute> <name>rotation</name> <value>0.0</value> </attribute> <attribute> <name>track_id</name> <value>8</value> </attribute> <attribute> <name>keyframe</name> <value>True</value> </attribute> </attributes> </object> <object> <name>行人</name> <truncated>0</truncated> <occluded>0</occluded> <difficult>0</difficult> <bndbox> <xmin>1469.0</xmin> <ymin>832.96</ymin> <xmax>1489.43</xmax> <ymax>865.8</ymax> </bndbox> <attributes> <attribute> <name>rotation</name> <value>0.0</value> </attribute> <attribute> <name>track_id</name> <value>9</value> </attribute> <attribute> <name>keyframe</name> <value>True</value> </attribute> </attributes> </object> </annotation> ''' # 解析XML数据 root = ET.fromstring(xml_string) # 提取有效数据 folder = root.find('folder').text filename = root.find('filename').text width = int(root.find('size/width').text) height = int(root.find('size/height').text) objects = [] for obj in root.findall('object'): name = obj.find('name').text xmin = float(obj.find('bndbox/xmin').text) ymin = float(obj.find('bndbox/ymin').text) xmax = float(obj.find('bndbox/xmax').text) ymax = float(obj.find('bndbox/ymax').text) objects.append({ 'name': name, 'xmin': xmin, 'ymin': ymin, 'xmax': xmax, 'ymax': ymax }) # 打印提取的有效数据 print("Folder:", folder) print("Filename:", filename) print("Width:", width) print("Height:", height) print("Objects:") for obj in objects: print(obj) ``` 运行这段代码,它将解析XML字符串并提取出标签中的有效数据。你可以根据需要对提取出的数据进行进一步处理或存储。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值