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
072e9e29
Commit
072e9e29
authored
6 years ago
by
even
Browse files
Options
Downloads
Patches
Plain Diff
Background contrast control
parent
ed09c02a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Code/Seg/BSTools/bsdetectionwidget.cpp
+33
-1
33 additions, 1 deletion
Code/Seg/BSTools/bsdetectionwidget.cpp
Code/Seg/BSTools/bsdetectionwidget.h
+19
-0
19 additions, 0 deletions
Code/Seg/BSTools/bsdetectionwidget.h
Methode/ctrl.tex
+1
-1
1 addition, 1 deletion
Methode/ctrl.tex
with
53 additions
and
2 deletions
Code/Seg/BSTools/bsdetectionwidget.cpp
+
33
−
1
View file @
072e9e29
...
...
@@ -43,6 +43,7 @@ BSDetectionWidget::BSDetectionWidget (QWidget *parent)
verbose
=
false
;
background
=
BACK_IMAGE
;
bsBoundsVisible
=
false
;
blevel
=
0
;
// Sets display parameters
selectionColor
=
Qt
::
red
;
...
...
@@ -703,6 +704,13 @@ void BSDetectionWidget::keyPressEvent (QKeyEvent *event)
<<
(
bsPointsVisible
?
"visible"
:
"hidden"
)
<<
endl
;
displayDetectionResult
();
}
else
{
// Tunes the background image black level
incBlackLevel
((
event
->
modifiers
()
&
Qt
::
ShiftModifier
)
?
-
1
:
1
);
displayDetectionResult
();
cout
<<
"Background black level = "
<<
getBlackLevel
()
<<
endl
;
}
break
;
case
Qt
::
Key_Z
:
...
...
@@ -720,7 +728,7 @@ void BSDetectionWidget::keyPressEvent (QKeyEvent *event)
{
// Tunes the thickenning limit
detector
.
incThickenningLimit
(
(
event
->
modifiers
()
&
Qt
::
ShiftModifier
?
-
1
:
1
)
)
;
(
event
->
modifiers
()
&
Qt
::
ShiftModifier
)
?
-
1
:
1
);
extract
();
cout
<<
"Thickenning limit = "
<<
detector
.
getThickenningLimit
()
<<
" pixels"
<<
endl
;
...
...
@@ -858,6 +866,29 @@ void BSDetectionWidget::drawBlurredSegment (QPainter &painter,
}
void
BSDetectionWidget
::
incBlackLevel
(
int
val
)
{
blevel
+=
val
*
5
;
if
(
blevel
<
0
)
blevel
=
0
;
if
(
blevel
>
200
)
blevel
=
200
;
}
void
BSDetectionWidget
::
lighten
(
QImage
&
im
)
{
if
(
blevel
!=
0
&&
background
!=
BACK_BLACK
&&
background
!=
BACK_WHITE
)
{
for
(
int
i
=
0
;
i
<
im
.
height
();
i
++
)
for
(
int
j
=
0
;
j
<
im
.
width
();
j
++
)
{
int
col
=
blevel
+
(
QColor
(
im
.
pixel
(
j
,
i
)).
value
()
*
(
255
-
blevel
))
/
255
;
im
.
setPixel
(
j
,
i
,
col
+
col
*
256
+
col
*
256
*
256
);
}
}
}
void
BSDetectionWidget
::
displayBackground
()
{
if
(
background
==
BACK_BLACK
)
augmentedImage
.
fill
(
qRgb
(
0
,
0
,
0
));
...
...
@@ -897,6 +928,7 @@ void BSDetectionWidget::displayDetectionResult ()
else
if
(
background
==
BACK_WHITE
)
augmentedImage
.
fill
(
qRgb
(
255
,
255
,
255
));
else
if
(
background
==
BACK_IMAGE
)
augmentedImage
=
loadedImage
;
else
augmentedImage
=
gradImage
;
lighten
(
augmentedImage
);
QPainter
painter
(
&
augmentedImage
);
vector
<
BlurredSegment
*>
bss
=
detector
.
getBlurredSegments
();
if
(
!
bss
.
empty
())
...
...
This diff is collapsed.
Click to expand it.
Code/Seg/BSTools/bsdetectionwidget.h
+
19
−
0
View file @
072e9e29
...
...
@@ -230,6 +230,8 @@ private:
/** Background type.
* BACK_BLACK, BACK_WHITE, BACK_IMAGE, BACK_GRAD, BACK_GRADX, BACK_GRADY. */
int
background
;
/** Black level used to lighten background images. */
int
blevel
;
/** Flag indicating whether detection result should be output. */
bool
verbose
;
...
...
@@ -315,6 +317,23 @@ private:
void
drawBlurredSegment
(
QPainter
&
painter
,
BlurredSegment
*
bs
,
bool
high
=
true
);
/**
* \brief Returns the background black level.
*/
inline
int
getBlackLevel
()
const
{
return
(
blevel
);
}
/**
* \brief Increments the background black level.
* @param val Increment value;
*/
void
incBlackLevel
(
int
val
);
/**
* \brief Lighten the image according to the black level set.
* @param im Image to lighten.
*/
void
lighten
(
QImage
&
im
);
/**
* \brief Displays the window background (no detection).
*/
...
...
This diff is collapsed.
Click to expand it.
Methode/ctrl.tex
+
1
−
1
View file @
072e9e29
...
...
@@ -27,7 +27,6 @@ a/q/c &\spa & Enregistre / Affiche / Supprime les segments \\
b
&&
Ajuste la r
\'
esolution du gradient pour le filtrage des max locaux
\\
e
&&
Inverse la direction de r
\'
ef
\'
erence (autre bord)
\\
g
&&
Ajuste le seuil du gradient
\\
n
&&
Allume le segment suivant dans une d
\'
etection multiple
\\
j
&&
Ajuste le seuil de voisinage pour les suivis rapides
\\
k
&&
Ajuste la taille minimale des composantes connexes
\\
l
&&
Ajuste la taille minimale du segment final
\\
...
...
@@ -40,6 +39,7 @@ s && Ajuste la longueur tol\'er\'ee pour les sauts de d\'etection \\
u
&&
Relance la d
\'
etection sur la derni
\`
ere s
\'
election (update)
\\
w
&&
Ajuste la consigne d'
\'
epaisseur du segment flou pour le suivi fin
\\
x
&&
Ajuste la consigne d'
\'
epaisseur du segment flou pour le suivi rapide
\\
y
&&
Ajuste le contraste de l'image
\\
z
&&
Ajuste le seuil du contr
\^
ole de la consigne d'
\'
epaisseur
\\
Ctrl-b
&&
Commute le fond d'
\'
ecran de la fen
\^
etre principale
\\
Ctrl-d
&&
Commute le test de densit
\'
e
\\
...
...
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