Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
2019 FBSD
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Kerautret Bertrand
2019 FBSD
Commits
4c5d8a99
Commit
4c5d8a99
authored
5 years ago
by
even
Browse files
Options
Downloads
Patches
Plain Diff
Code: strokes for ASD
parent
7b938066
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
Code/FBSD/BSTools/bsdetectionwidget.cpp
+72
-0
72 additions, 0 deletions
Code/FBSD/BSTools/bsdetectionwidget.cpp
Code/FBSD/BSTools/bsdetectionwidget.h
+5
-0
5 additions, 0 deletions
Code/FBSD/BSTools/bsdetectionwidget.h
with
77 additions
and
0 deletions
Code/FBSD/BSTools/bsdetectionwidget.cpp
+
72
−
0
View file @
4c5d8a99
...
...
@@ -941,6 +941,11 @@ void BSDetectionWidget::keyPressEvent (QKeyEvent *event)
displayDetectionResult
();
break
;
case
Qt
::
Key_Semicolon
:
// Stores blurred segments features
writeBStraverse
();
break
;
case
Qt
::
Key_Plus
:
if
(
zoom
>
1
)
{
...
...
@@ -1268,6 +1273,73 @@ void BSDetectionWidget::writeDetectionResult ()
}
void
BSDetectionWidget
::
writeBStraverse
()
{
int
xlls
=
1939000
;
int
ylls
=
13548000
;
int
travel
=
24
;
vector
<
BlurredSegment
*>
bss
=
detector
.
getBlurredSegments
();
if
(
bss
.
empty
())
{
BlurredSegment
*
bs
=
detector
.
getBlurredSegment
();
if
(
bs
!=
NULL
)
{
ofstream
outf
(
"strokes.txt"
,
ios
::
out
);
DigitalStraightSegment
*
dss
=
bs
->
getSegment
();
AbsRat
x1r
,
y1r
,
x2r
,
y2r
;
dss
->
naiveLine
(
x1r
,
y1r
,
x2r
,
y2r
);
float
x1
=
x1r
.
num
()
/
(
float
)
x1r
.
den
();
float
y1
=
y1r
.
num
()
/
(
float
)
y1r
.
den
();
float
x2
=
x2r
.
num
()
/
(
float
)
x2r
.
den
();
float
y2
=
y2r
.
num
()
/
(
float
)
y2r
.
den
();
float
ln
=
(
float
)
sqrt
((
x2
-
x1
)
*
(
x2
-
x1
)
+
(
y2
-
y1
)
*
(
y2
-
y1
));
float
dx
=
(
x2
-
x1
)
/
ln
;
float
dy
=
(
y2
-
y1
)
/
ln
;
for
(
float
pos
=
0.0
f
;
pos
<=
ln
;
pos
+=
travel
)
{
outf
<<
xlls
+
(
int
)
(
x1
+
pos
*
dx
-
travel
*
dy
+
0.5
f
)
<<
" "
<<
ylls
+
(
int
)
(
y1
+
pos
*
dy
+
travel
*
dx
+
0.5
f
)
<<
" "
<<
xlls
+
(
int
)
(
x1
+
pos
*
dx
+
travel
*
dy
+
0.5
f
)
<<
" "
<<
ylls
+
(
int
)
(
y1
+
pos
*
dy
-
travel
*
dx
+
0.5
f
)
<<
endl
;
}
outf
.
close
();
}
}
else
{
DigitalStraightSegment
*
dss
=
NULL
;
AbsRat
x1r
,
y1r
,
x2r
,
y2r
;
float
x1
,
y1
,
x2
,
y2
,
ln
,
dx
,
dy
;
ofstream
outf
(
"strokes.txt"
,
ios
::
out
);
vector
<
BlurredSegment
*>::
iterator
it
=
bss
.
begin
();
while
(
it
!=
bss
.
end
())
{
if
(
*
it
!=
NULL
)
{
dss
=
(
*
it
)
->
getSegment
();
dss
->
naiveLine
(
x1r
,
y1r
,
x2r
,
y2r
);
x1
=
x1r
.
num
()
/
(
float
)
x1r
.
den
();
y1
=
y1r
.
num
()
/
(
float
)
y1r
.
den
();
x2
=
x2r
.
num
()
/
(
float
)
x2r
.
den
();
y2
=
y2r
.
num
()
/
(
float
)
y2r
.
den
();
ln
=
(
float
)
sqrt
((
x2
-
x1
)
*
(
x2
-
x1
)
+
(
y2
-
y1
)
*
(
y2
-
y1
));
dx
=
(
x2
-
x1
)
/
ln
;
dy
=
(
y2
-
y1
)
/
ln
;
for
(
float
pos
=
0.0
f
;
pos
<=
ln
;
pos
+=
travel
)
{
outf
<<
xlls
+
(
int
)
(
x1
+
pos
*
dx
-
travel
*
dy
+
0.5
f
)
<<
" "
<<
ylls
+
(
int
)
(
y1
+
pos
*
dy
+
travel
*
dx
+
0.5
f
)
<<
" "
<<
xlls
+
(
int
)
(
x1
+
pos
*
dx
+
travel
*
dy
+
0.5
f
)
<<
" "
<<
ylls
+
(
int
)
(
y1
+
pos
*
dy
-
travel
*
dx
+
0.5
f
)
<<
endl
;
}
}
it
++
;
}
outf
.
close
();
}
}
void
BSDetectionWidget
::
displayDetectionResult
()
{
if
(
background
==
BACK_BLACK
)
augmentedImage
.
fill
(
qRgb
(
0
,
0
,
0
));
...
...
This diff is collapsed.
Click to expand it.
Code/FBSD/BSTools/bsdetectionwidget.h
+
5
−
0
View file @
4c5d8a99
...
...
@@ -410,6 +410,11 @@ private:
*/
void
writeDetectionResult
();
/**
* \brief Computes seeds for ASD (strokes.txt).
*/
void
writeBStraverse
();
/**
* \brief Displays the result of the last detection.
*/
...
...
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