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
2ed38386
Commit
2ed38386
authored
6 years ago
by
even
Browse files
Options
Downloads
Patches
Plain Diff
Large images processed
parent
a45c9be0
No related branches found
Branches containing commit
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
+78
-5
78 additions, 5 deletions
Code/FBSD/BSTools/bsdetectionwidget.cpp
Code/FBSD/BSTools/bsdetectionwidget.h
+15
-0
15 additions, 0 deletions
Code/FBSD/BSTools/bsdetectionwidget.h
with
93 additions
and
5 deletions
Code/FBSD/BSTools/bsdetectionwidget.cpp
+
78
−
5
View file @
2ed38386
...
...
@@ -52,6 +52,14 @@ BSDetectionWidget::BSDetectionWidget (QWidget *parent)
bsPointsVisible
=
true
;
boundColor
=
Qt
::
green
;
boundHighColor
=
Qt
::
magenta
;
maxWidth
=
768
;
maxHeight
=
512
;
xMaxShift
=
0
;
yMaxShift
=
0
;
xShift
=
0
;
yShift
=
0
;
zoom
=
1
;
}
...
...
@@ -83,7 +91,13 @@ QSize BSDetectionWidget::openImage (const QString &fileName, int type)
if
(
profileview
!=
NULL
)
profileview
->
setImage
(
&
loadedImage
,
gMap
);
if
(
strucview
!=
NULL
)
strucview
->
setGradientImage
(
&
gradImage
);
return
newSize
.
boundedTo
(
QSize
(
768
,
512
));
xMaxShift
=
(
width
>
maxWidth
?
maxWidth
-
width
:
0
);
yMaxShift
=
(
height
>
maxHeight
?
maxHeight
-
height
:
0
);
xShift
=
xMaxShift
/
2
;
if
(
xShift
>
0
)
xShift
=
0
;
yShift
=
yMaxShift
/
2
;
if
(
yShift
>
0
)
yShift
=
0
;
return
newSize
.
boundedTo
(
QSize
(
maxWidth
,
maxHeight
));
}
...
...
@@ -178,7 +192,8 @@ void BSDetectionWidget::buildGradientImage (int dir)
void
BSDetectionWidget
::
paintEvent
(
QPaintEvent
*
)
{
QPainter
painter
(
this
);
painter
.
drawImage
(
QPoint
(
0
,
0
),
augmentedImage
);
QImage
zoomImage
=
augmentedImage
.
scaled
(
width
/
zoom
,
height
/
zoom
);
painter
.
drawImage
(
QPoint
(
xShift
,
yShift
),
zoomImage
);
}
...
...
@@ -326,7 +341,9 @@ void BSDetectionWidget::mousePressEvent (QMouseEvent *event)
oldp1
.
set
(
p1
);
oldp2
.
set
(
p2
);
oldudef
=
udef
;
p1
=
Pt2i
(
event
->
pos
().
x
(),
height
-
1
-
event
->
pos
().
y
());
int
ex
=
zoom
*
(
event
->
pos
().
x
()
-
xShift
);
int
ey
=
zoom
*
(
event
->
pos
().
y
()
-
yShift
);
p1
=
Pt2i
(
ex
,
height
-
1
-
ey
);
if
(
p1
.
manhattan
(
p2
)
<
10
)
p1
.
set
(
oldp1
);
else
if
(
p1
.
manhattan
(
oldp1
)
<
10
)
p1
.
set
(
p2
);
udef
=
true
;
...
...
@@ -335,7 +352,9 @@ void BSDetectionWidget::mousePressEvent (QMouseEvent *event)
void
BSDetectionWidget
::
mouseReleaseEvent
(
QMouseEvent
*
event
)
{
p2
=
Pt2i
(
event
->
pos
().
x
(),
height
-
1
-
event
->
pos
().
y
());
int
ex
=
zoom
*
(
event
->
pos
().
x
()
-
xShift
);
int
ey
=
zoom
*
(
event
->
pos
().
y
()
-
yShift
);
p2
=
Pt2i
(
ex
,
height
-
1
-
ey
);
if
(
p1
.
equals
(
p2
))
{
p1
.
set
(
oldp1
);
...
...
@@ -354,7 +373,9 @@ void BSDetectionWidget::mouseReleaseEvent (QMouseEvent *event)
void
BSDetectionWidget
::
mouseMoveEvent
(
QMouseEvent
*
event
)
{
p2
=
Pt2i
(
event
->
pos
().
x
(),
height
-
1
-
event
->
pos
().
y
());
int
ex
=
zoom
*
(
event
->
pos
().
x
()
-
xShift
);
int
ey
=
zoom
*
(
event
->
pos
().
y
()
-
yShift
);
p2
=
Pt2i
(
ex
,
height
-
1
-
ey
);
if
(
verbose
)
cerr
<<
"("
<<
p1
.
x
()
<<
", "
<<
p1
.
y
()
<<
") ("
<<
p2
.
x
()
<<
", "
<<
p2
.
y
()
<<
")"
<<
endl
;
if
(
p1
.
manhattan
(
p2
)
>
5
...
...
@@ -808,6 +829,58 @@ void BSDetectionWidget::keyPressEvent (QKeyEvent *event)
writeTest
();
break
;
case
Qt
::
Key_Plus
:
if
(
zoom
>
1
)
{
zoom
/=
2
;
xShift
=
xShift
*
2
-
maxWidth
/
2
;
yShift
=
yShift
*
2
-
maxHeight
/
2
;
displayDetectionResult
();
}
break
;
case
Qt
::
Key_Minus
:
if
(
width
/
zoom
>
maxWidth
||
height
/
zoom
>
maxHeight
)
{
zoom
*=
2
;
xShift
=
xShift
/
2
+
maxWidth
/
4
;
if
(
xShift
>
0
)
xShift
=
0
;
if
((
maxWidth
-
xShift
)
*
zoom
>
width
)
xShift
=
maxWidth
-
width
/
zoom
;
yShift
=
yShift
/
2
+
maxHeight
/
4
;
if
(
yShift
>
0
)
yShift
=
0
;
if
((
maxHeight
-
yShift
)
*
zoom
>
height
)
yShift
=
maxHeight
-
height
/
zoom
;
displayDetectionResult
();
}
break
;
case
Qt
::
Key_Left
:
xShift
+=
50
;
if
(
xShift
>
0
)
xShift
=
0
;
displayDetectionResult
();
break
;
case
Qt
::
Key_Right
:
xShift
-=
50
;
if
((
maxWidth
-
xShift
)
*
zoom
>
width
)
xShift
=
maxWidth
-
width
/
zoom
;
displayDetectionResult
();
break
;
case
Qt
::
Key_Up
:
yShift
+=
50
;
if
(
yShift
>
0
)
yShift
=
0
;
displayDetectionResult
();
break
;
case
Qt
::
Key_Down
:
yShift
-=
50
;
if
((
maxHeight
-
yShift
)
*
zoom
>
height
)
yShift
=
maxHeight
-
height
/
zoom
;
displayDetectionResult
();
break
;
case
Qt
::
Key_1
:
switchPixelAnalyzer
();
break
;
...
...
This diff is collapsed.
Click to expand it.
Code/FBSD/BSTools/bsdetectionwidget.h
+
15
−
0
View file @
2ed38386
...
...
@@ -263,6 +263,21 @@ private:
/** Height of the present image. */
int
height
;
/** Maximal window width. */
int
maxWidth
;
/** Maximal window height. */
int
maxHeight
;
/** Maximal value of x-scroll shift. */
int
xMaxShift
;
/** Maximal value of y-scroll shift. */
int
yMaxShift
;
/** X-scroll shift. */
int
xShift
;
/** Y-scroll shift. */
int
yShift
;
/** Window zoom. */
int
zoom
;
/** Blurred segment detector. */
BSDetector
detector
;
/** Initial detection graphics view. */
...
...
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