当前位置:网站首页>Rotating frame target detection -- about the definition and solution of rotating frame
Rotating frame target detection -- about the definition and solution of rotating frame
2022-06-22 00:53:00 【qq_ forty-one million six hundred and twenty-seven thousand six】
1、 The rotation box indicates
1、 How to represent a rotation box ?
![First , When the tag is generated , We will face a real problem ? How the rotation box should represent ? in fact , Although we said we could use 5 It's worth [ The formula ] To represent a rotating frame ( [ The formula ] ) In particular, it refers to the central position of the box , But notice that this box means that there is actually a bug: The representation of a box is not unique . So let's take this picture , When we take different sides as height and width , The calculated angle will also change ( By convention , We generally regard the angle of counterclockwise rotation as a negative value )](/img/61/630d93c376b139e338ed01ae60d7a9.png)

2、Opencv notation
About different versions opencv Of cv2.minAreaRect Function output angle range is different .
Making a rotating rectangle ⽬ Encountered during calibration test ⼀ A question , What I do ⽤ The label of the dataset is the coordinates of the four points of the irregular quadrilateral (x1,y1,x2,y2,x3,y3,x4,y4), To convert it to rotation ⽬ Label detected (x,y,longside,shortside,angle). among , need ⽤ To opencv Medium cv2.minAreaRect function .
cv2.minAreaRect The operation of the function ⽤ Is the most important way to return an irregular quadrilateral ⼩ Outside rectangle ( Can I return the most ⼩ The circumscribed rectangle is not verified )
remarks :cv2.boxPoints The function can be based on cv2.minAreaRect The return value of the function gives the most ⼩ Four point coordinates of the circumscribed rectangle
In order to be more ⽅ I will go into ⾏ Visual description , Let's define two functions first draw_rect and rotate_rect
import numpy as np
import cv2
import matplotlib.pyplot as plt
defdraw_rect(rect):
stay
Draw a rectangle on the canvas
#
im
rect
im = np.zeros([240,320], dtype = np.uint8)
cv2.polylines(im,[rect],1,255)
plt.imshow(im)
plt.show()
defrotate_rect(rect, angle):
Output
Coordinates of four points of the rotated rectangle ,
Positive and clockwise rotation , Negative and counterclockwise rotation
#
rect
angle
(x,y),(w,h),a = cv2.minAreaRect(rect)
rect_r =((x,y),(w,h), a+angle)
return cv2.boxPoints(rect_r).astype(np.int32
About cv2.minAreaRect
transport ⼊: The four points of a quadrilateral ( Order is not required )
Output : most ⼩ Middle of circumscribed rectangle ⼼ Point coordinates x,y, wide ⾼w,h,⾓ degree anlge, The output form is tuple ((x,y),(w,h),anlge), The sequence format does not change
in ⼼ Point coordinates x,y⽐ It's easier to understand
wide w In the definition of 4.2 and 4.5 There's a difference , The exact version has not been determined
1、opencv4.2 edition (Doc)
OpenCV In version 4.5.1 Before , The expression is [ The formula ] , The schematic diagram is as follows 
** among 4.2 Version is defined as ,x The axis rotates counterclockwise and the first coincident edge is w, here x The shaft rotates counterclockwise ⾓ Degree is -angle( Minus sign yes )
Specifically explained as : Rotate rectangle rect There are two sides L and S( They are the long side and the short side ),x Counterclockwise rotation of shaft , If first with L Edge coincidence ( It can also be understood as ping ⾏), that L Namely
Opencv format: x_c y_c width height Θ
Parameter Introduction :
x_c And y_c: Rotate the center coordinates of the rectangle ;
width:x The axis rotates counterclockwise and touches the first edge of the rectangle ;
height: And width The opposite side ;
Θ:x The shaft rotates counterclockwise with width The angle between , Because the origin is in the upper left corner of the image , The counterclockwise rotation angle is negative ,Θ∈[-90, 0)
2、opencv4.5 edition ((Doc’))
4.5 Version defined as ,x The axis rotates clockwise and the first coincident edge is w,angle by x The shaft rotates clockwise ⾓ degree ,angle The value is (0,90]

3、 Long side definition method 1(Dle)

4、 Long side definition method 2((Dle’))

5、 The conversion relationship between representations
Some understandings and thoughts about the definition of rotating frame
be based on MMRotate Training custom datasets Do rotating target detection 2022-3-30




边栏推荐
- RISCV 的 cache
- 汇编语言范例
- Harmonyos application development second assignment notes
- MySQL 8.0 新特性梳理汇总
- Document.readyState 如何使用和侦听
- 目前主流的海外社交媒体有哪些?麻烦简单介绍一下?
- DOM 节点
- Meetup03 review: introduction to the new version of linkis and the application practice of DSS
- Arm assembles DCB, DCW, DCD and DCQ parsing
- Thinking about a web offline interview
猜你喜欢

笔记

Meetup03期回顾:Linkis新版本介绍以及DSS的应用实践

Record a small JSP bug

如何使用物联网低代码平台进行报表管理?

Hotline salon issue 26 - cloud security session

Use of MySQL performance analysis tools

If a programmer goes to prison, will he be assigned to write code?

eslint:错误

Ns32f103vbt6 hardware and software replace stm32f103vbt6

对面积的曲面积分中dS与dxdy的转换
随机推荐
How to use through-hole conductive slip ring
Farm Game
The tangled truth about NFT and copyright
Document. How to use and listen for readyState
状态码总结
唐太宗把微服务的“心跳机制”玩到了极致!
Use of MySQL performance analysis tools
[2023 approval in advance] China Singapore SECCO
Is it safe to open an account for futures in Huishang futures?
合理选择液压滑环密封间隙的重要性
[set static route] "WiFi for private internal network and external network“
MySQL性能分析工具的使用
数据工程系列精讲(第三讲): Data-centric AI 之特征工程
位运算位与
RISCV 的 cache
跨境贸易和跨境电商的三大区别简单分析
徽商期货开户可靠吗?新手如何安全开户?
leetcode 279. Perfect squares (medium)
Tom Ellison, the new CFO of mendix, promoted the next stage of rapid growth of the company through the transformation of the leadership team
root检测实现