Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PeTrack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pedestrian Dynamics Empiricism
PeTrack
Commits
44f51ee6
Commit
44f51ee6
authored
2 years ago
by
d.kilic
Browse files
Options
Downloads
Plain Diff
Merge branch '380-delete-dead-code-in-coorditem' into 'master'
Resolve "Delete dead code in CoordItem" Closes
#380
See merge request
!270
parents
66fa3823
8b5fae1e
No related branches found
No related tags found
1 merge request
!270
Resolve "Delete dead code in CoordItem"
Pipeline
#95846
passed
1 year ago
Stage: build_environment
Stage: pre-build-checks
Stage: build
Stage: test
Changes
1
Pipelines
15
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/coordItem.cpp
+84
-356
84 additions, 356 deletions
src/coordItem.cpp
with
84 additions
and
356 deletions
src/coordItem.cpp
+
84
−
356
View file @
44f51ee6
...
@@ -20,9 +20,7 @@
...
@@ -20,9 +20,7 @@
#include
"control.h"
#include
"control.h"
#include
"extrCalibration.h"
#include
"extrCalibration.h"
#include
"logger.h"
#include
"petrack.h"
#include
"petrack.h"
#include
"view.h"
#include
<QtWidgets>
#include
<QtWidgets>
#include
<cmath>
#include
<cmath>
...
@@ -215,8 +213,8 @@ void CoordItem::updateData()
...
@@ -215,8 +213,8 @@ void CoordItem::updateData()
matrix
.
scale
(
1
,
1
);
matrix
.
scale
(
1
,
1
);
setTransform
(
matrix
);
setTransform
(
matrix
);
double
axeLen
=
mControlWidget
->
getCalibCoord3DAxeLen
();
const
double
axeLen
=
mControlWidget
->
getCalibCoord3DAxeLen
();
int
bS
=
mMainWindow
->
getImageBorderSize
();
const
int
bS
=
mMainWindow
->
getImageBorderSize
();
// Coordinate-system origin at (tX,tY,tZ)
// Coordinate-system origin at (tX,tY,tZ)
if
(
extCalib
->
isSetExtrCalib
())
if
(
extCalib
->
isSetExtrCalib
())
...
@@ -269,8 +267,6 @@ void CoordItem::updateData()
...
@@ -269,8 +267,6 @@ void CoordItem::updateData()
void
CoordItem
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
/*option*/
,
QWidget
*
/*widget*/
)
void
CoordItem
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
/*option*/
,
QWidget
*
/*widget*/
)
{
{
bool
debug
=
false
;
////////////////////////////////
////////////////////////////////
// Drawing Calibration Points //
// Drawing Calibration Points //
////////////////////////////////
////////////////////////////////
...
@@ -318,39 +314,10 @@ void CoordItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*opti
...
@@ -318,39 +314,10 @@ void CoordItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*opti
painter
->
setBrush
(
Qt
::
black
);
painter
->
setBrush
(
Qt
::
black
);
painter
->
drawText
(
QPointF
(
p2
.
x
+
10
,
p2
.
y
+
font
.
pixelSize
()),
QObject
::
tr
(
"%1"
).
arg
((
i
+
1
)));
painter
->
drawText
(
QPointF
(
p2
.
x
+
10
,
p2
.
y
+
font
.
pixelSize
()),
QObject
::
tr
(
"%1"
).
arg
((
i
+
1
)));
if
(
p2
.
x
<
calibPointsMin
.
x
)
calibPointsMin
.
x
=
std
::
min
({
calibPointsMin
.
x
,
p2
.
x
,
p3
.
x
});
{
calibPointsMin
.
y
=
std
::
min
({
calibPointsMin
.
y
,
p2
.
y
,
p3
.
y
});
calibPointsMin
.
x
=
p2
.
x
;
calibPointsMax
.
x
=
std
::
max
({
calibPointsMax
.
x
,
p2
.
x
,
p3
.
x
});
}
calibPointsMax
.
y
=
std
::
max
({
calibPointsMax
.
y
,
p2
.
y
,
p3
.
y
});
if
(
p2
.
x
>
calibPointsMax
.
x
)
{
calibPointsMax
.
x
=
p2
.
x
;
}
if
(
p3
.
x
<
calibPointsMin
.
x
)
{
calibPointsMin
.
x
=
p3
.
x
;
}
if
(
p3
.
x
>
calibPointsMax
.
x
)
{
calibPointsMax
.
x
=
p3
.
x
;
}
if
(
p2
.
y
<
calibPointsMin
.
y
)
{
calibPointsMin
.
y
=
p2
.
y
;
}
if
(
p2
.
y
>
calibPointsMax
.
y
)
{
calibPointsMax
.
y
=
p2
.
y
;
}
if
(
p3
.
y
<
calibPointsMin
.
y
)
{
calibPointsMin
.
y
=
p3
.
y
;
}
if
(
p3
.
y
>
calibPointsMax
.
y
)
{
calibPointsMax
.
y
=
p3
.
y
;
}
}
}
}
}
}
}
...
@@ -369,63 +336,32 @@ void CoordItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*opti
...
@@ -369,63 +336,32 @@ void CoordItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*opti
painter
->
setPen
(
QPen
(
QBrush
(
Qt
::
blue
),
0
));
painter
->
setPen
(
QPen
(
QBrush
(
Qt
::
blue
),
0
));
static
QPointF
points
[
3
];
// Koordinatenachsen
// Koordinatenachsen
points
[
0
].
setX
(
-
10.
);
painter
->
drawLine
(
QPoint
{
-
10
,
0
},
QPoint
{
100
,
0
});
points
[
0
].
setY
(
0.
);
painter
->
drawLine
(
QPoint
{
0
,
10
},
QPoint
{
0
,
-
100
});
points
[
1
].
setX
(
100.
);
points
[
1
].
setY
(
0.
);
painter
->
drawLine
(
points
[
0
],
points
[
1
]);
points
[
0
].
setX
(
0.
);
points
[
0
].
setY
(
10.
);
points
[
1
].
setX
(
0.
);
points
[
1
].
setY
(
-
100.
);
painter
->
drawLine
(
points
[
0
],
points
[
1
]);
// Ticks
// Ticks
for
(
int
i
=
1
;
i
<
11
;
i
++
)
// i=10 zeichnen sieht ungewoehnlich aus, laeest sich aber besser mit messen
for
(
int
i
=
1
;
i
<
11
;
i
++
)
// i=10 zeichnen sieht ungewoehnlich aus, laeest sich aber besser mit messen
{
{
points
[
0
].
setX
(
2.
);
painter
->
drawLine
(
QPoint
{
2
,
-
i
*
10
},
QPoint
{
-
2
,
-
i
*
10
});
points
[
0
].
setY
(
-
i
*
10.
);
painter
->
drawLine
(
QPoint
{
i
*
10
,
2
},
QPoint
{
i
*
10
,
-
2
});
points
[
1
].
setX
(
-
2.
);
points
[
1
].
setY
(
-
i
*
10.
);
painter
->
drawLine
(
points
[
0
],
points
[
1
]);
points
[
0
].
setX
(
i
*
10.
);
points
[
0
].
setY
(
2.
);
points
[
1
].
setX
(
i
*
10.
);
points
[
1
].
setY
(
-
2.
);
painter
->
drawLine
(
points
[
0
],
points
[
1
]);
}
}
// Beschriftung
// Beschriftung
points
[
0
].
setX
(
97.
);
painter
->
drawText
(
QPoint
{
97
,
12
},
QObject
::
tr
(
"1"
));
points
[
0
].
setY
(
12.
);
painter
->
drawText
(
QPoint
{
-
8
,
-
97
},
QObject
::
tr
(
"1"
));
painter
->
drawText
(
points
[
0
],
QObject
::
tr
(
"1"
));
points
[
0
].
setX
(
-
8.
);
points
[
0
].
setY
(
-
97.
);
painter
->
drawText
(
points
[
0
],
QObject
::
tr
(
"1"
));
// Pfeilspitzen
// Pfeilspitzen
painter
->
setPen
(
Qt
::
NoPen
);
painter
->
setPen
(
Qt
::
NoPen
);
painter
->
setBrush
(
Qt
::
blue
);
painter
->
setBrush
(
Qt
::
blue
);
points
[
0
].
setX
(
100.
);
QPolygon
arrowTipX
;
points
[
0
].
setY
(
0.
);
arrowTipX
<<
QPoint
(
100
,
0
)
<<
QPoint
(
95
,
2
)
<<
QPoint
(
95
,
-
2
);
points
[
1
].
setX
(
95.
);
painter
->
drawPolygon
(
arrowTipX
);
points
[
1
].
setY
(
2.
);
points
[
2
].
setX
(
95.
);
QPolygon
arrowTipY
;
points
[
2
].
setY
(
-
2.
);
arrowTipY
<<
QPoint
(
0
,
-
100
)
<<
QPoint
(
2
,
-
95
)
<<
QPoint
(
-
2
,
-
95
);
painter
->
drawPolygon
(
points
,
3
);
painter
->
drawPolygon
(
arrowTipY
);
points
[
0
].
setX
(
0.
);
points
[
0
].
setY
(
-
100.
);
points
[
1
].
setX
(
2.
);
points
[
1
].
setY
(
-
95.
);
points
[
2
].
setX
(
-
2.
);
points
[
2
].
setY
(
-
95.
);
painter
->
drawPolygon
(
points
,
3
);
}
}
else
else
{
{
...
@@ -435,111 +371,11 @@ void CoordItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*opti
...
@@ -435,111 +371,11 @@ void CoordItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*opti
if
(
extCalib
->
isSetExtrCalib
())
if
(
extCalib
->
isSetExtrCalib
())
{
{
QPointF
points
[
4
];
auto
getImgPoint
=
[
this
](
const
cv
::
Point3f
&
realPoint
)
cv
::
Point2f
p
[
4
];
QString
coordinaten
;
/////////////////////////////////////////////////////
// Draw a cube (Quader) near coord system //
/////////////////////////////////////////////////////
bool
drawCube
=
false
;
if
(
drawCube
)
{
{
painter
->
setPen
(
Qt
::
green
);
const
auto
imgPoint
=
extCalib
->
getImagePoint
(
realPoint
);
// Boden
return
QPointF
(
imgPoint
.
x
,
imgPoint
.
y
);
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
100
,
100
,
0
));
};
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
200
,
100
,
0
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
200
,
100
,
0
));
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
200
,
200
,
0
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
200
,
200
,
0
));
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
100
,
200
,
0
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
100
,
200
,
0
));
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
100
,
100
,
0
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
// Seiten
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
100
,
100
,
0
));
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
100
,
100
,
100
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
200
,
100
,
0
));
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
200
,
100
,
100
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
100
,
200
,
0
));
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
100
,
200
,
100
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
200
,
200
,
0
));
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
200
,
200
,
100
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
// Oben
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
100
,
100
,
100
));
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
200
,
100
,
100
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
200
,
100
,
100
));
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
200
,
200
,
100
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
200
,
200
,
100
));
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
100
,
200
,
100
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
100
,
200
,
100
));
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
100
,
100
,
100
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
}
/////////////////////////////////////////////////////
// Draw the bounding rect //
/////////////////////////////////////////////////////
bool
drawBoundingRect
=
false
;
if
(
drawBoundingRect
)
{
QRectF
boundingBox
=
boundingRect
();
double
min_x
=
boundingBox
.
x
(),
max_x
=
min_x
+
boundingBox
.
width
();
double
min_y
=
boundingBox
.
y
(),
max_y
=
min_y
+
boundingBox
.
height
();
painter
->
setPen
(
Qt
::
cyan
);
painter
->
drawLine
(
QPointF
(
min_x
,
min_y
),
QPointF
(
min_x
,
max_y
));
painter
->
drawLine
(
QPointF
(
min_x
,
max_y
),
QPointF
(
max_x
,
max_y
));
painter
->
drawLine
(
QPointF
(
max_x
,
max_y
),
QPointF
(
max_x
,
min_y
));
painter
->
drawLine
(
QPointF
(
max_x
,
min_y
),
QPointF
(
min_x
,
min_y
));
}
/////////////////////////////////////////////////////
// Draw a rect around the whole coordinate system //
/////////////////////////////////////////////////////
bool
paintRectCoordArea
=
false
;
if
(
paintRectCoordArea
)
{
int
min_x
=
std
::
min
(
std
::
min
(
x
.
x
,
y
.
x
),
std
::
min
(
z
.
x
,
ursprung
.
x
));
int
max_x
=
std
::
max
(
std
::
max
(
x
.
x
,
y
.
x
),
std
::
max
(
z
.
x
,
ursprung
.
x
));
int
min_y
=
std
::
min
(
std
::
min
(
x
.
y
,
y
.
y
),
std
::
min
(
z
.
y
,
ursprung
.
y
));
int
max_y
=
std
::
max
(
std
::
max
(
x
.
y
,
y
.
y
),
std
::
max
(
z
.
y
,
ursprung
.
y
));
painter
->
setFont
(
QFont
(
"Arial"
,
20
));
painter
->
setPen
(
Qt
::
green
);
painter
->
drawLine
(
QPointF
(
min_x
,
min_y
),
QPointF
(
min_x
,
max_y
));
painter
->
drawLine
(
QPointF
(
min_x
,
max_y
),
QPointF
(
max_x
,
max_y
));
painter
->
drawLine
(
QPointF
(
max_x
,
max_y
),
QPointF
(
max_x
,
min_y
));
painter
->
drawLine
(
QPointF
(
max_x
,
min_y
),
QPointF
(
min_x
,
min_y
));
coordinaten
=
QString
::
asprintf
(
"(%d, %d)"
,
min_x
,
min_y
);
painter
->
drawText
(
QPoint
(
min_x
-
45
,
min_y
-
10
),
coordinaten
);
coordinaten
=
QString
::
asprintf
(
"%d"
,
max_y
-
min_y
);
painter
->
drawText
(
QPoint
(
min_x
+
10
,
min_y
+
(
max_y
-
min_y
)
/
2.0
),
coordinaten
);
coordinaten
=
QString
::
asprintf
(
"%d"
,
max_x
-
min_x
);
painter
->
drawText
(
QPoint
(
min_x
+
(
max_x
-
min_x
)
/
2.0
,
min_y
+
30
),
coordinaten
);
}
//////////////////////////////
//////////////////////////////
...
@@ -547,13 +383,9 @@ void CoordItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*opti
...
@@ -547,13 +383,9 @@ void CoordItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*opti
//////////////////////////////
//////////////////////////////
painter
->
setPen
(
QPen
(
QBrush
(
Qt
::
blue
),
coordLineWidth
));
painter
->
setPen
(
QPen
(
QBrush
(
Qt
::
blue
),
coordLineWidth
));
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
0
,
0
,
0
));
painter
->
drawLine
(
getImgPoint
({
0
,
0
,
0
}),
getImgPoint
(
x3D
));
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
x3D
.
x
,
x3D
.
y
,
x3D
.
z
));
painter
->
drawLine
(
getImgPoint
({
0
,
0
,
0
}),
getImgPoint
(
y3D
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
painter
->
drawLine
(
getImgPoint
({
0
,
0
,
0
}),
getImgPoint
(
z3D
));
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
y3D
.
x
,
y3D
.
y
,
y3D
.
z
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
z3D
.
x
,
z3D
.
y
,
z3D
.
z
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
/////////////////////////////////
/////////////////////////////////
// Drawing the X,Y,Z - Symbols //
// Drawing the X,Y,Z - Symbols //
...
@@ -562,12 +394,13 @@ void CoordItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*opti
...
@@ -562,12 +394,13 @@ void CoordItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*opti
painter
->
setPen
(
QPen
(
QBrush
(
Qt
::
black
),
coordLineWidth
));
painter
->
setPen
(
QPen
(
QBrush
(
Qt
::
black
),
coordLineWidth
));
painter
->
setFont
(
QFont
(
"Arial"
,
15
));
painter
->
setFont
(
QFont
(
"Arial"
,
15
));
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
x3D
.
x
+
10
,
x3D
.
y
,
x3D
.
z
));
const
QPointF
labelOffset
{
-
5
,
5
};
painter
->
drawText
(
QPointF
(
p
[
0
].
x
-
5
,
p
[
0
].
y
+
5
),
QString
(
"X"
));
const
QPointF
xLabelPos
=
getImgPoint
(
x3D
+
cv
::
Point3f
(
10
,
0
,
0
))
+
labelOffset
;
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
y3D
.
x
,
y3D
.
y
+
10
,
y3D
.
z
));
const
QPointF
yLabelPos
=
getImgPoint
(
y3D
+
cv
::
Point3f
(
0
,
10
,
0
))
+
labelOffset
;
painter
->
drawText
(
QPointF
(
p
[
0
].
x
-
5
,
p
[
0
].
y
+
5
),
QString
(
"Y"
));
const
QPointF
zLabelPos
=
getImgPoint
(
z3D
+
cv
::
Point3f
(
0
,
0
,
10
))
+
labelOffset
;
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
z3D
.
x
,
z3D
.
y
,
z3D
.
z
+
10
));
painter
->
drawText
(
xLabelPos
,
QString
(
"X"
));
painter
->
drawText
(
QPointF
(
p
[
0
].
x
-
5
,
p
[
0
].
y
+
5
),
QString
(
"Z"
));
painter
->
drawText
(
yLabelPos
,
QString
(
"Y"
));
painter
->
drawText
(
zLabelPos
,
QString
(
"Z"
));
//////////////////////////////
//////////////////////////////
// Drawing the tick-markers //
// Drawing the tick-markers //
...
@@ -582,193 +415,88 @@ void CoordItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*opti
...
@@ -582,193 +415,88 @@ void CoordItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*opti
// Solange Achsen-Ende noch nicht erreicht: Markierung zeichnen
// Solange Achsen-Ende noch nicht erreicht: Markierung zeichnen
if
(
i
+
tickLength
<
x3D
.
x
)
if
(
i
+
tickLength
<
x3D
.
x
)
{
{
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
i
,
-
tickLength
,
0
));
painter
->
drawLine
(
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
i
,
tickLength
,
0
));
getImgPoint
(
cv
::
Point3f
(
i
,
-
tickLength
,
0
)),
getImgPoint
(
cv
::
Point3f
(
i
,
tickLength
,
0
)));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
painter
->
drawLine
(
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
i
,
0
,
-
tickLength
));
getImgPoint
(
cv
::
Point3f
(
i
,
0
,
-
tickLength
)),
getImgPoint
(
cv
::
Point3f
(
i
,
0
,
tickLength
)));
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
i
,
0
,
tickLength
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
i
,
0
,
0
));
}
}
if
(
i
+
tickLength
<
y3D
.
y
)
if
(
i
+
tickLength
<
y3D
.
y
)
{
{
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
-
tickLength
,
i
,
0
));
painter
->
drawLine
(
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
tickLength
,
i
,
0
));
getImgPoint
(
cv
::
Point3f
(
-
tickLength
,
i
,
0
)),
getImgPoint
(
cv
::
Point3f
(
tickLength
,
i
,
0
)));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
painter
->
drawLine
(
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
0
,
i
,
-
tickLength
));
getImgPoint
(
cv
::
Point3f
(
0
,
i
,
-
tickLength
)),
getImgPoint
(
cv
::
Point3f
(
0
,
i
,
tickLength
)));
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
0
,
i
,
tickLength
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
}
}
if
(
i
+
tickLength
<
z3D
.
z
)
if
(
i
+
tickLength
<
z3D
.
z
)
{
{
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
-
tickLength
,
0
,
i
));
painter
->
drawLine
(
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
tickLength
,
0
,
i
));
getImgPoint
(
cv
::
Point3f
(
-
tickLength
,
0
,
i
)),
getImgPoint
(
cv
::
Point3f
(
tickLength
,
0
,
i
)));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
painter
->
drawLine
(
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
0
,
-
tickLength
,
i
));
getImgPoint
(
cv
::
Point3f
(
0
,
-
tickLength
,
i
)),
getImgPoint
(
cv
::
Point3f
(
0
,
tickLength
,
i
)));
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
0
,
tickLength
,
i
));
painter
->
drawLine
(
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
),
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
));
}
}
}
}
QFont
font
(
"Arial"
,
tickLength
*
0.5
);
QFont
font
(
"Arial"
,
tickLength
*
0.5
);
painter
->
setFont
(
font
);
painter
->
setFont
(
font
);
painter
->
setPen
(
Qt
::
green
);
painter
->
setBrush
(
Qt
::
green
);
painter
->
setFont
(
QFont
(
"Arial"
,
20
));
if
(
debug
)
{
coordinaten
=
QString
::
asprintf
(
"(%.2f, %.2f)"
,
ursprung
.
x
,
ursprung
.
y
);
}
if
(
debug
)
{
painter
->
drawText
(
QPoint
(
ursprung
.
x
-
100
,
ursprung
.
y
),
coordinaten
);
}
//////////////////////////////////////////////
//////////////////////////////////////////////
// Drawing the peaks at the end of the axis //
// Drawing the peaks at the end of the axis //
//////////////////////////////////////////////
//////////////////////////////////////////////
int
peakSize
=
AXIS_MARKERS_LENGTH
;
constexpr
int
peakSize
=
AXIS_MARKERS_LENGTH
;
painter
->
setPen
(
QPen
(
QBrush
(
Qt
::
blue
),
coordLineWidth
));
painter
->
setBrush
(
Qt
::
NoBrush
);
// don't fill polygons
///////
///////
// X //
// X //
///////
///////
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
x3D
.
x
,
0
,
0
));
/* clang-format off */
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
x3D
.
x
-
peakSize
,
-
peakSize
,
0
));
QPolygonF
arrowTipX1
;
p
[
2
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
x3D
.
x
-
peakSize
,
peakSize
,
0
));
arrowTipX1
<<
getImgPoint
({
x3D
.
x
,
0
,
0
})
points
[
0
]
=
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
);
<<
getImgPoint
({
x3D
.
x
-
peakSize
,
-
peakSize
,
0
})
points
[
1
]
=
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
);
<<
getImgPoint
({
x3D
.
x
-
peakSize
,
peakSize
,
0
});
points
[
2
]
=
QPointF
(
p
[
2
].
x
,
p
[
2
].
y
);
QPolygonF
arrowTipX2
;
painter
->
setPen
(
Qt
::
green
);
arrowTipX2
<<
getImgPoint
({
x3D
.
x
,
0
,
0
})
painter
->
setPen
(
QPen
(
QBrush
(
Qt
::
blue
),
coordLineWidth
));
<<
getImgPoint
({
x3D
.
x
-
peakSize
,
0
,
-
peakSize
})
painter
->
drawLine
(
points
[
0
],
points
[
1
]);
<<
getImgPoint
({
x3D
.
x
-
peakSize
,
0
,
peakSize
});
painter
->
drawLine
(
points
[
0
],
points
[
2
]);
/* clang-format on */
painter
->
drawLine
(
points
[
2
],
points
[
1
]);
painter
->
drawPolygon
(
arrowTipX1
);
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
x3D
.
x
,
0
,
0
));
painter
->
drawPolygon
(
arrowTipX2
);
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
x3D
.
x
-
peakSize
,
0
,
-
peakSize
));
p
[
2
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
x3D
.
x
-
peakSize
,
0
,
peakSize
));
p
[
3
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
x3D
.
x
+
peakSize
,
0
,
0
));
points
[
0
]
=
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
);
points
[
1
]
=
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
);
points
[
2
]
=
QPointF
(
p
[
2
].
x
,
p
[
2
].
y
);
painter
->
setPen
(
Qt
::
green
);
painter
->
setPen
(
QPen
(
QBrush
(
Qt
::
blue
),
coordLineWidth
));
painter
->
drawLine
(
points
[
0
],
points
[
1
]);
painter
->
drawLine
(
points
[
0
],
points
[
2
]);
painter
->
drawLine
(
points
[
2
],
points
[
1
]);
if
(
debug
)
{
coordinaten
=
QString
::
asprintf
(
"(% .2f, % .2f)"
,
p
[
1
].
x
,
p
[
1
].
y
);
}
if
(
debug
)
{
painter
->
drawText
(
QPoint
(
p
[
3
].
x
,
p
[
3
].
y
),
coordinaten
);
}
if
(
debug
)
{
coordinaten
=
QString
::
fromLatin1
(
"X"
);
}
if
(
debug
)
{
painter
->
drawText
(
QPoint
(
p
[
1
].
x
,
p
[
1
].
y
),
coordinaten
);
}
///////
///////
// Y //
// Y //
///////
///////
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
0
,
y3D
.
y
,
0
));
/* clang-format off */
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
-
peakSize
,
y3D
.
y
-
peakSize
,
0
));
QPolygonF
arrowTipY1
;
p
[
2
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
peakSize
,
y3D
.
y
-
peakSize
,
0
));
arrowTipY1
<<
getImgPoint
({
0
,
y3D
.
y
,
0
})
points
[
0
]
=
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
);
<<
getImgPoint
({
-
peakSize
,
y3D
.
y
-
peakSize
,
0
})
points
[
1
]
=
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
);
<<
getImgPoint
({
peakSize
,
y3D
.
y
-
peakSize
,
0
});
points
[
2
]
=
QPointF
(
p
[
2
].
x
,
p
[
2
].
y
);
QPolygonF
arrowTipY2
;
painter
->
setPen
(
Qt
::
green
);
arrowTipY2
<<
getImgPoint
({
0
,
y3D
.
y
,
0
})
painter
->
setPen
(
QPen
(
QBrush
(
Qt
::
blue
),
coordLineWidth
));
<<
getImgPoint
({
0
,
y3D
.
y
-
peakSize
,
-
peakSize
})
painter
->
drawLine
(
points
[
0
],
points
[
1
]);
<<
getImgPoint
({
0
,
y3D
.
y
-
peakSize
,
peakSize
});
painter
->
drawLine
(
points
[
0
],
points
[
2
]);
/* clang-format on */
painter
->
drawLine
(
points
[
2
],
points
[
1
]);
painter
->
drawPolygon
(
arrowTipY1
);
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
0
,
y3D
.
y
,
0
));
painter
->
drawPolygon
(
arrowTipY2
);
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
0
,
y3D
.
y
-
peakSize
,
-
peakSize
));
p
[
2
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
0
,
y3D
.
y
-
peakSize
,
peakSize
));
p
[
3
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
0
,
y3D
.
y
+
peakSize
,
0
));
points
[
0
]
=
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
);
points
[
1
]
=
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
);
points
[
2
]
=
QPointF
(
p
[
2
].
x
,
p
[
2
].
y
);
painter
->
setPen
(
Qt
::
green
);
painter
->
setPen
(
QPen
(
QBrush
(
Qt
::
blue
),
coordLineWidth
));
painter
->
drawLine
(
points
[
0
],
points
[
1
]);
painter
->
drawLine
(
points
[
0
],
points
[
2
]);
painter
->
drawLine
(
points
[
2
],
points
[
1
]);
if
(
debug
)
{
coordinaten
=
QString
::
asprintf
(
"(%.2f, %.2f)"
,
p
[
1
].
x
,
p
[
1
].
y
);
}
if
(
debug
)
{
painter
->
drawText
(
QPoint
(
p
[
3
].
x
,
p
[
3
].
y
),
coordinaten
);
}
if
(
debug
)
{
coordinaten
=
QString
::
fromLatin1
(
"Y"
);
}
if
(
debug
)
{
painter
->
drawText
(
QPoint
(
p
[
1
].
x
,
p
[
1
].
y
),
coordinaten
);
}
///////
///////
// Z //
// Z //
///////
///////
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
0
,
0
,
z3D
.
z
));
/* clang-format off */
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
0
,
-
peakSize
,
z3D
.
z
-
peakSize
));
QPolygonF
arrowTipZ1
;
p
[
2
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
0
,
peakSize
,
z3D
.
z
-
peakSize
));
arrowTipZ1
<<
getImgPoint
({
0
,
0
,
z3D
.
z
})
points
[
0
]
=
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
);
<<
getImgPoint
({
0
,
-
peakSize
,
z3D
.
z
-
peakSize
})
points
[
1
]
=
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
);
<<
getImgPoint
({
0
,
peakSize
,
z3D
.
z
-
peakSize
});
points
[
2
]
=
QPointF
(
p
[
2
].
x
,
p
[
2
].
y
);
QPolygonF
arrowTipZ2
;
painter
->
setPen
(
Qt
::
green
);
arrowTipZ2
<<
getImgPoint
({
0
,
0
,
z3D
.
z
})
painter
->
setPen
(
QPen
(
QBrush
(
Qt
::
blue
),
coordLineWidth
));
<<
getImgPoint
({
-
peakSize
,
0
,
z3D
.
z
-
peakSize
})
painter
->
drawLine
(
points
[
0
],
points
[
1
]);
<<
getImgPoint
({
peakSize
,
0
,
z3D
.
z
-
peakSize
});
painter
->
drawLine
(
points
[
0
],
points
[
2
]);
/* clang-format on */
painter
->
drawLine
(
points
[
2
],
points
[
1
]);
painter
->
drawPolygon
(
arrowTipZ1
);
p
[
0
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
0
,
0
,
z3D
.
z
));
painter
->
drawPolygon
(
arrowTipZ2
);
p
[
1
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
-
peakSize
,
0
,
z3D
.
z
-
peakSize
));
p
[
2
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
peakSize
,
0
,
z3D
.
z
-
peakSize
));
p
[
3
]
=
extCalib
->
getImagePoint
(
cv
::
Point3f
(
0
,
0
,
z3D
.
z
+
peakSize
));
points
[
0
]
=
QPointF
(
p
[
0
].
x
,
p
[
0
].
y
);
points
[
1
]
=
QPointF
(
p
[
1
].
x
,
p
[
1
].
y
);
points
[
2
]
=
QPointF
(
p
[
2
].
x
,
p
[
2
].
y
);
painter
->
setPen
(
Qt
::
green
);
painter
->
setPen
(
QPen
(
QBrush
(
Qt
::
blue
),
coordLineWidth
));
painter
->
drawLine
(
points
[
0
],
points
[
1
]);
painter
->
drawLine
(
points
[
0
],
points
[
2
]);
painter
->
drawLine
(
points
[
2
],
points
[
1
]);
if
(
debug
)
{
coordinaten
=
QString
::
asprintf
(
"(%.2f, %.2f)"
,
p
[
1
].
x
,
p
[
1
].
y
);
}
if
(
debug
)
{
painter
->
drawText
(
QPoint
(
p
[
3
].
x
,
p
[
3
].
y
),
coordinaten
);
}
if
(
debug
)
{
coordinaten
=
QString
::
fromLatin1
(
"Z"
);
}
if
(
debug
)
{
painter
->
drawText
(
QPoint
(
p
[
1
].
x
,
p
[
1
].
y
),
coordinaten
);
}
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment