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
06f1e4d7
Commit
06f1e4d7
authored
5 years ago
by
simon.fanetti
Browse files
Options
Downloads
Patches
Plain Diff
add contrasts display in GUI camera settings
parent
e371e2ea
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/SandboxSetup/camerafocus.cpp
+41
-0
41 additions, 0 deletions
app/SandboxSetup/camerafocus.cpp
app/SandboxSetup/camerafocus.h
+4
-0
4 additions, 0 deletions
app/SandboxSetup/camerafocus.h
app/SandboxSetup/camerafocus.ui
+13
-0
13 additions, 0 deletions
app/SandboxSetup/camerafocus.ui
with
58 additions
and
0 deletions
app/SandboxSetup/camerafocus.cpp
+
41
−
0
View file @
06f1e4d7
...
@@ -58,6 +58,11 @@ void CameraFocus::refreshFrame(){
...
@@ -58,6 +58,11 @@ void CameraFocus::refreshFrame(){
// Preview image for the user
// Preview image for the user
cv
::
cvtColor
(
rgb
,
gray
,
CV_BGR2GRAY
);
cv
::
cvtColor
(
rgb
,
gray
,
CV_BGR2GRAY
);
gray
=
setup
->
beamer
.
editContrast
(
gray
,
(
double
)
p
.
getContrast
(),
(
double
)
p
.
getBrightness
());
gray
=
setup
->
beamer
.
editContrast
(
gray
,
(
double
)
p
.
getContrast
(),
(
double
)
p
.
getBrightness
());
if
(
displayConstrasts
){
cvSobel
(
&
gray
);
}
cv
::
cvtColor
(
gray
,
rgbFromGray
,
CV_GRAY2BGR
);
cv
::
cvtColor
(
gray
,
rgbFromGray
,
CV_GRAY2BGR
);
if
(
!
crc
.
empty
()){
if
(
!
crc
.
empty
()){
...
@@ -129,3 +134,39 @@ void CameraFocus::on_btnReset_clicked()
...
@@ -129,3 +134,39 @@ void CameraFocus::on_btnReset_clicked()
{
{
loadProfil
(
&
defaultProfil
,
setup
->
beamer
.
getProfil
());
loadProfil
(
&
defaultProfil
,
setup
->
beamer
.
getProfil
());
}
}
void
CameraFocus
::
on_chbxDisplayContrast_clicked
()
{
displayConstrasts
=
ui
->
chbxDisplayContrast
->
isChecked
();
}
cv
::
Mat
*
CameraFocus
::
cvSobel
(
cv
::
Mat
*
gray
){
// From : https://docs.opencv.org/2.4/doc/tutorials/imgproc/imgtrans/sobel_derivatives/sobel_derivatives.html
int
scale
=
1
;
int
delta
=
0
;
int
ddepth
=
CV_16S
;
cv
::
Mat
grad
,
src_gray
=
*
gray
;
/// Generate grad_x and grad_y
cv
::
Mat
grad_x
,
grad_y
;
cv
::
Mat
abs_grad_x
,
abs_grad_y
;
/// Gradient X
//Scharr( src_gray, grad_x, ddepth, 1, 0, scale, delta, BORDER_DEFAULT );
cv
::
Sobel
(
src_gray
,
grad_x
,
ddepth
,
1
,
0
,
3
,
scale
,
delta
,
cv
::
BORDER_DEFAULT
);
cv
::
convertScaleAbs
(
grad_x
,
abs_grad_x
);
/// Gradient Y
//Scharr( src_gray, grad_y, ddepth, 0, 1, scale, delta, BORDER_DEFAULT );
cv
::
Sobel
(
src_gray
,
grad_y
,
ddepth
,
0
,
1
,
3
,
scale
,
delta
,
cv
::
BORDER_DEFAULT
);
cv
::
convertScaleAbs
(
grad_y
,
abs_grad_y
);
/// Total Gradient (approximate)
cv
::
addWeighted
(
abs_grad_x
,
0.5
,
abs_grad_y
,
0.5
,
0
,
grad
);
grad
.
copyTo
(
*
gray
);
return
gray
;
}
This diff is collapsed.
Click to expand it.
app/SandboxSetup/camerafocus.h
+
4
−
0
View file @
06f1e4d7
...
@@ -36,16 +36,20 @@ private slots:
...
@@ -36,16 +36,20 @@ private slots:
void
on_btnReset_clicked
();
void
on_btnReset_clicked
();
void
on_chbxDisplayContrast_clicked
();
private
:
private
:
Ui
::
CameraFocus
*
ui
;
Ui
::
CameraFocus
*
ui
;
SandboxSetup
*
setup
;
SandboxSetup
*
setup
;
bool
state
=
false
;
bool
state
=
false
;
QTimer
*
frameTimer
;
QTimer
*
frameTimer
;
FrameProcessProfil
defaultProfil
;
FrameProcessProfil
defaultProfil
;
bool
displayConstrasts
=
false
;
void
refreshFrame
();
void
refreshFrame
();
void
loadProfil
(
FrameProcessProfil
*
profilLoaded
,
FrameProcessProfil
*
profilSaved
);
void
loadProfil
(
FrameProcessProfil
*
profilLoaded
,
FrameProcessProfil
*
profilSaved
);
void
initCameraParams
();
void
initCameraParams
();
cv
::
Mat
*
cvSobel
(
cv
::
Mat
*
gray
);
};
};
#endif // CAMERAFOCUS_H
#endif // CAMERAFOCUS_H
This diff is collapsed.
Click to expand it.
app/SandboxSetup/camerafocus.ui
+
13
−
0
View file @
06f1e4d7
...
@@ -160,6 +160,19 @@
...
@@ -160,6 +160,19 @@
<string>
Reset
</string>
<string>
Reset
</string>
</property>
</property>
</widget>
</widget>
<widget
class=
"QCheckBox"
name=
"chbxDisplayContrast"
>
<property
name=
"geometry"
>
<rect>
<x>
80
</x>
<y>
30
</y>
<width>
131
</width>
<height>
23
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
Show Contrasts
</string>
</property>
</widget>
</widget>
</widget>
<resources/>
<resources/>
<connections>
<connections>
...
...
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