Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ar_sandbox_lib
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
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AR_Sandbox
ar_sandbox_lib
Commits
bcddee2c
Commit
bcddee2c
authored
4 years ago
by
simon.fanetti
Browse files
Options
Downloads
Patches
Plain Diff
fixe BeamerLocation routine
parent
fc7d1bec
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/SandboxSetup/beamerlocationgui.cpp
+28
-16
28 additions, 16 deletions
app/SandboxSetup/beamerlocationgui.cpp
app/SandboxSetup/beamerlocationgui.h
+2
-1
2 additions, 1 deletion
app/SandboxSetup/beamerlocationgui.h
with
30 additions
and
17 deletions
app/SandboxSetup/beamerlocationgui.cpp
+
28
−
16
View file @
bcddee2c
...
...
@@ -21,6 +21,7 @@ BeamerLocationGui::BeamerLocationGui(SandboxSetup *_setup, MonitorGui *_mg, QWid
winFullScreen
=
new
QtFullScreen
(
mg
->
getResolution
(),
true
,
this
);
ui
->
setupUi
(
this
);
ui
->
txtInstructions
->
setAlignment
(
Qt
::
AlignJustify
);
mut
=
new
QMutex
();
myThread
=
new
RefreshFrame
(
this
);
timer
=
new
QTimer
(
this
);
connect
(
timer
,
&
QTimer
::
timeout
,
this
,
&
BeamerLocationGui
::
refreshRoutine
);
...
...
@@ -30,6 +31,7 @@ BeamerLocationGui::~BeamerLocationGui()
{
delete
timer
;
delete
myThread
;
delete
mut
;
delete
winFullScreen
;
delete
ui
;
}
...
...
@@ -71,7 +73,7 @@ void BeamerLocationGui::startRoutine(){
directions
=
std
::
vector
<
cv
::
Point3d
>
();
bases
=
std
::
vector
<
cv
::
Point3d
>
();
capturedPoints
=
std
::
vector
<
cv
::
Point3f
>
();
circle
=
std
::
vector
<
cv
::
Point3i
>
();
circle
s
=
std
::
vector
<
cv
::
Point3i
>
();
updateLabelSteps
();
if
(
myThread
->
isRunning
()){
...
...
@@ -95,32 +97,35 @@ void BeamerLocationGui::routineFrame(){
depth
=
camera
->
getDepthFrame
();
rgb
=
camera
->
getColorFrame
();
// Look for the circle target
// Look for the circle
s
target
double
minDist
=
rgb
.
cols
*
(
double
)
profil
->
getMinDistance
()
/
100
;
double
minRadius
=
(
profil
->
getMinRadius
()
>
0
)
?
rgb
.
cols
*
(
double
)
profil
->
getMinRadius
()
/
100
:
0
;
double
maxRadius
=
(
profil
->
getMaxRadius
()
>
0
)
?
rgb
.
cols
*
(
double
)
profil
->
getMaxRadius
()
/
100
:
0
;
circle
=
beamer
->
findCircles
(
rgb
,
profil
->
getContrast
(),
profil
->
getBrightness
(),
minDist
,
(
int
)
profil
->
getCannyEdgeThreshold
(),
(
int
)
profil
->
getHoughAccThreshold
(),
minRadius
,
maxRadius
);
std
::
vector
<
cv
::
Point3i
>
tmp_circles
=
beamer
->
findCircles
(
rgb
,
profil
->
getContrast
(),
profil
->
getBrightness
(),
minDist
,
(
int
)
profil
->
getCannyEdgeThreshold
(),
(
int
)
profil
->
getHoughAccThreshold
(),
minRadius
,
maxRadius
);
mut
->
lock
();
circles
=
tmp_circles
;
mut
->
unlock
();
// preview from the camera's POV
cv
::
Mat
gray
,
frameDisplayed
;
cv
::
cvtColor
(
rgb
,
gray
,
CV_BGR2GRAY
);
gray
=
setup
->
getBeamer
()
->
editContrast
(
gray
,
(
double
)
profil
->
getContrast
(),
(
double
)
profil
->
getBrightness
());
cv
::
cvtColor
(
gray
,
frameDisplayed
,
CV_GRAY2RGB
);
if
(
!
circle
.
empty
()){
cv
::
circle
(
frameDisplayed
,
cv
::
Point
(
circle
[
0
].
x
,
circle
[
0
].
y
),
circle
[
0
].
z
,
cv
::
Scalar
(
0
,
255
,
0
),
3
);
if
(
!
circle
s
.
empty
()){
cv
::
circle
(
frameDisplayed
,
cv
::
Point
(
circle
s
[
0
].
x
,
circle
s
[
0
].
y
),
circle
s
[
0
].
z
,
cv
::
Scalar
(
0
,
255
,
0
),
3
);
}
QImage
img
=
QImage
((
uchar
*
)
frameDisplayed
.
data
,
(
int
)
frameDisplayed
.
cols
,
(
int
)
frameDisplayed
.
rows
,
static_cast
<
int
>
(
frameDisplayed
.
step
.
buf
[
0
]),
QImage
::
Format_RGB888
);
QPixmap
px
=
QPixmap
::
fromImage
(
img
);
// Show black screen with cross
cv
::
Mat
frameImage
=
beamer
->
getCrossFrame
(
cross
,
capturedPoints
.
size
()
+
1
,
beamer
->
MAX_LINEAR_LINE_POINTS
,
!
circle
.
empty
());
cv
::
Mat
frameImage
=
beamer
->
getCrossFrame
(
cross
,
capturedPoints
.
size
()
+
1
,
beamer
->
MAX_LINEAR_LINE_POINTS
,
!
circle
s
.
empty
());
cv
::
cvtColor
(
frameImage
,
frameImage
,
CV_BGR2RGB
);
ui
->
lblFrame
->
setPixmap
(
px
);
...
...
@@ -131,9 +136,17 @@ void BeamerLocationGui::routineFrame(){
void
BeamerLocationGui
::
userValidePoint
(){
if
(
!
circle
.
empty
()){
std
::
vector
<
cv
::
Point3i
>
tmp_circles
;
mut
->
lock
();
if
(
!
circles
.
empty
()){
tmp_circles
=
circles
;
circles
.
clear
();
}
mut
->
unlock
();
capturedPoints
.
push_back
(
beamer
->
deprojectPixel
(
cv
::
Point2i
(
circle
.
at
(
0
).
x
,
circle
.
at
(
0
).
y
),
&
depth
,
camera
)
);
if
(
!
tmp_circles
.
empty
()){
cv
::
Point2i
circle_pos
=
cv
::
Point2i
(
tmp_circles
.
at
(
0
).
x
,
tmp_circles
.
at
(
0
).
y
);
capturedPoints
.
push_back
(
beamer
->
deprojectPixel
(
circle_pos
,
&
depth
,
camera
)
);
updateLabelSteps
();
// enough points to perform linear regression and move into next step
...
...
@@ -141,7 +154,6 @@ void BeamerLocationGui::userValidePoint(){
beamer
->
findLinearLineFrom
(
&
capturedPoints
,
&
bases
,
&
directions
);
capturedPoints
.
clear
();
circle
.
clear
();
stepCross
++
;
if
((
uint
)
stepCross
>=
crosses
.
size
()){
...
...
This diff is collapsed.
Click to expand it.
app/SandboxSetup/beamerlocationgui.h
+
2
−
1
View file @
bcddee2c
...
...
@@ -63,7 +63,8 @@ private:
std
::
vector
<
cv
::
Point3f
>
capturedPoints
;
cv
::
Mat
depth
;
cv
::
Mat
rgb
;
std
::
vector
<
cv
::
Point3i
>
circle
;
QMutex
*
mut
;
std
::
vector
<
cv
::
Point3i
>
circles
;
int
stepCross
=
0
;
QTimer
*
timer
;
RefreshFrame
*
myThread
;
...
...
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