roLabelImg is a graphical image annotation tool can label ROTATED rectangle regions, which is rewrite from ‘labelImg’.
1、下载地址
labelImg工具地址:labelImg。
roLabelImg工具地址:roLabelImg
2、环境配置
使用roLabelImg必须要先安装labelImg(作者配置为Win10+Python3.8.10)
(1) PyQt5安装
直接在CMD中输入pip install pyqt5 (或者下载whl文件进行离线安装pyqt5)。
(2)安装lxml:pip install lxml
(3) 使用labelImg
进入下载好的labelImg-master文件夹内(resources.py所在目录),CMD中输入pyrcc5 -o resources.py resources.qrc
然后继续输入命令python labelImg.py
,即打开了labelImg运行页面可开始标注了。
3、使用roLabelImg
进入下载好的roLabelImg-master文件夹内(resources.py所在目录),CMD中输入pyrcc5 -o resources.py resources.qrc
然后继续输入命令python roLabelImg.py,此处报错了name ‘codecs’ is not
defined,只需将roLabelImg.py文件中的# – coding: utf8 --改成# – coding: utf-8–。
运行python roLabelImg.py,即打开了roLabelImg运行页面可开始标注了。Open Dir为打开要标注的图像文件夹,Files->change default saved Annotation dir 更改保存的标注xml文件路径,Create RotatedRBox开始绘制旋转矩形。
以下是一些标注快捷键,主要通过使用ZXCV
实现标注框的旋转。
标注完之后,的xml示例如下,cx,cy代表标注框中心点的坐标,w,h代表宽和高,angle代表标注矩形框的角度。
注意:angle是旋转角度的弧度值,水平方向angle=0,顺时针方向旋转,得到的角度值是正值,旋转一周为pi,没有负值。
<annotation verified="no">
<folder>Edge</folder>
<filename>传送带</filename>
<path>D:/software/Edge/传送带.svg</path>
<source>
<database>Unknown</database>
</source>
<size>
<width>98</width>
<height>64</height>
<depth>3</depth>
</size>
<segmented>0</segmented>
<object>
<type>robndbox</type>
<name>tv</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<robndbox>
<cx>43.955</cx>
<cy>31.0144</cy>
<w>48.2204</w>
<h>40.0082</h>
<angle>2.841593</angle>
</robndbox>
</object>
</annotation>