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
a8446fa1
Commit
a8446fa1
authored
6 years ago
by
even
Browse files
Options
Downloads
Patches
Plain Diff
Demo: input points
parent
da5057c5
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/Seg/IPOLdemo/Input/points.txt
+3
-0
3 additions, 0 deletions
Code/Seg/IPOLdemo/Input/points.txt
Code/Seg/IPOLdemo/mainIPOL.cpp
+67
-8
67 additions, 8 deletions
Code/Seg/IPOLdemo/mainIPOL.cpp
with
70 additions
and
8 deletions
Code/Seg/IPOLdemo/Input/points.txt
0 → 100644
+
3
−
0
View file @
a8446fa1
121 149 140 114
335 107 307 83
-1
This diff is collapsed.
Click to expand it.
Code/Seg/IPOLdemo/mainIPOL.cpp
+
67
−
8
View file @
a8446fa1
...
...
@@ -27,15 +27,25 @@ int main (int argc, char *argv[])
// getting parameters:
// - input file
// - input
image
file
string
input_filename
=
argv
[
1
];
// - input points file
string
inpoints_filename
=
""
;
ifstream
fin
;
bool
with_points
=
false
;
if
(
argc
==
4
)
{
inpoints_filename
=
argv
[
3
];
fin
.
open
(
inpoints_filename
.
c_str
(),
std
::
fstream
::
in
);
with_points
=
true
;
}
// - output file
string
output_filename
=
argv
[
2
];
ofstream
fout
;
fout
.
open
(
output_filename
.
c_str
(),
std
::
fstream
::
out
);
fout
.
open
(
output_filename
.
c_str
(),
std
::
fstream
::
out
);
//
Calcul de la carte de gradient (utili
se qt)
//
Gradient map extraction (u
se
s
qt)
QImage
image
;
image
.
load
(
QString
(
input_filename
.
c_str
()));
...
...
@@ -53,16 +63,65 @@ int main (int argc, char *argv[])
}
VMap
*
gMap
=
new
VMap
(
width
,
height
,
tabImage
,
VMap
::
TYPE_SOBEL_5X5
);
// Detection
// Input points reading (uses qt)
vector
<
Pt2i
>
pts
;
if
(
with_points
)
{
int
val
[
4
],
i
=
0
;
bool
reading
=
true
;
if
(
fin
)
{
while
(
reading
)
{
fin
>>
val
[
i
++
];
if
(
val
[
i
-
1
]
==
-
1
)
reading
=
false
;
// if (fin.eof ()) reading = false;
if
(
reading
&&
i
==
4
)
{
pts
.
push_back
(
Pt2i
(
val
[
0
],
val
[
1
]));
pts
.
push_back
(
Pt2i
(
val
[
2
],
val
[
3
]));
i
=
0
;
}
}
}
fin
.
close
();
}
// Blurred segment detection
vector
<
BlurredSegment
*>
bss
;
BSDetector
detector
;
detector
.
setGradientMap
(
gMap
);
detector
.
setMaxTrials
(
-
1
);
detector
.
detectAll
();
if
(
with_points
)
{
vector
<
Pt2i
>::
iterator
pit
=
pts
.
begin
();
int
nbseg
=
0
;
while
(
pit
!=
pts
.
end
())
{
Pt2i
pt1
=
*
pit
++
;
Pt2i
pt2
=
*
pit
++
;
std
::
cout
<<
nbseg
<<
" detect ("
<<
pt1
.
x
()
<<
", "
<<
pt1
.
y
()
<<
") ("
<<
pt2
.
x
()
<<
", "
<<
pt2
.
y
()
<<
")"
<<
std
::
endl
;
detector
.
detect
(
pt1
,
pt2
);
BlurredSegment
*
mybs
=
detector
.
getBlurredSegment
();
if
(
mybs
!=
NULL
)
{
detector
.
preserveFormerBlurredSegment
();
bss
.
push_back
(
mybs
);
nbseg
++
;
}
}
std
::
cout
<<
nbseg
<<
" detections"
<<
std
::
endl
;
}
else
{
detector
.
setMaxTrials
(
-
1
);
detector
.
detectAll
();
bss
=
detector
.
getBlurredSegments
();
}
fout
<<
"# Line detection generated from "
<<
argv
[
0
]
<<
"with format : X1 Y1 X2 Y2 on each line"
<<
std
::
endl
;
// Affichage
vector
<
BlurredSegment
*>
bss
=
detector
.
getBlurredSegments
();
// Display
if
(
!
bss
.
empty
())
{
vector
<
BlurredSegment
*>::
const_iterator
it
=
bss
.
begin
();
...
...
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