Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
b686f430
Commit
b686f430
authored
Nov 17, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
parents
ec4d5c85
f0ecc092
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
36 deletions
+89
-36
ovis.cpp
modules/ovis/src/ovis.cpp
+24
-2
erfilter.hpp
modules/text/include/opencv2/text/erfilter.hpp
+1
-1
erfilter.cpp
modules/text/src/erfilter.cpp
+4
-2
edge_filter.hpp
modules/ximgproc/include/opencv2/ximgproc/edge_filter.hpp
+24
-13
disparity_filtering.cpp
modules/ximgproc/samples/disparity_filtering.cpp
+5
-2
fbs_filter.cpp
modules/ximgproc/src/fbs_filter.cpp
+31
-16
No files found.
modules/ovis/src/ovis.cpp
View file @
b686f430
...
...
@@ -236,6 +236,8 @@ struct Application : public OgreBites::ApplicationContext, public OgreBites::Inp
return
ret
;
}
size_t
numWindows
()
const
{
return
mWindows
.
size
();
}
void
locateResources
()
CV_OVERRIDE
{
OgreBites
::
ApplicationContext
::
locateResources
();
...
...
@@ -277,9 +279,10 @@ class WindowSceneImpl : public WindowScene
Ptr
<
Rectangle2D
>
bgplane
;
Ogre
::
RenderTarget
*
depthRTT
;
int
flags
;
public
:
WindowSceneImpl
(
Ptr
<
Application
>
app
,
const
String
&
_title
,
const
Size
&
sz
,
int
flags
)
:
title
(
_title
),
root
(
app
->
getRoot
()),
depthRTT
(
NULL
)
WindowSceneImpl
(
Ptr
<
Application
>
app
,
const
String
&
_title
,
const
Size
&
sz
,
int
_
flags
)
:
title
(
_title
),
root
(
app
->
getRoot
()),
depthRTT
(
NULL
)
,
flags
(
_flags
)
{
if
(
!
app
->
sceneMgr
)
{
...
...
@@ -337,6 +340,25 @@ public:
rWin
->
addViewport
(
cam
);
}
~
WindowSceneImpl
()
{
if
(
flags
&
SCENE_SEPERATE
)
{
MaterialManager
::
getSingleton
().
remove
(
bgplane
->
getMaterial
());
bgplane
.
release
();
String
texName
=
sceneMgr
->
getName
()
+
"_Background"
;
TextureManager
::
getSingleton
().
remove
(
texName
,
RESOURCEGROUP_NAME
);
}
if
(
_app
->
sceneMgr
==
sceneMgr
&&
(
flags
&
SCENE_SEPERATE
))
{
// this is the root window owning the context
CV_Assert
(
_app
->
numWindows
()
==
1
&&
"the first OVIS window must be deleted last"
);
_app
->
closeApp
();
_app
.
release
();
}
}
void
setBackground
(
InputArray
image
)
CV_OVERRIDE
{
CV_Assert
(
bgplane
);
...
...
modules/text/include/opencv2/text/erfilter.hpp
View file @
b686f430
...
...
@@ -159,7 +159,7 @@ public:
virtual
void
setMinProbability
(
float
minProbability
)
=
0
;
virtual
void
setMinProbabilityDiff
(
float
minProbabilityDiff
)
=
0
;
virtual
void
setNonMaxSuppression
(
bool
nonMaxSuppression
)
=
0
;
virtual
int
getNumRejected
()
=
0
;
virtual
int
getNumRejected
()
const
=
0
;
};
...
...
modules/text/src/erfilter.cpp
View file @
b686f430
...
...
@@ -145,7 +145,7 @@ public:
void
setMinProbability
(
float
minProbability
)
CV_OVERRIDE
;
void
setMinProbabilityDiff
(
float
minProbabilityDiff
)
CV_OVERRIDE
;
void
setNonMaxSuppression
(
bool
nonMaxSuppression
)
CV_OVERRIDE
;
int
getNumRejected
()
CV_OVERRIDE
;
int
getNumRejected
()
const
CV_OVERRIDE
;
private
:
// pointer to the input/output regions vector
...
...
@@ -223,6 +223,8 @@ ERFilterNM::ERFilterNM()
// input/output for the second one.
void
ERFilterNM
::
run
(
InputArray
image
,
vector
<
ERStat
>&
_regions
)
{
num_rejected_regions
=
0
;
num_accepted_regions
=
0
;
// assert correct image type
CV_Assert
(
image
.
getMat
().
type
()
==
CV_8UC1
);
...
...
@@ -999,7 +1001,7 @@ void ERFilterNM::setNonMaxSuppression(bool _nonMaxSuppression)
return
;
}
int
ERFilterNM
::
getNumRejected
()
int
ERFilterNM
::
getNumRejected
()
const
{
return
num_rejected_regions
;
}
...
...
modules/ximgproc/include/opencv2/ximgproc/edge_filter.hpp
View file @
b686f430
...
...
@@ -375,7 +375,7 @@ void rollingGuidanceFilter(InputArray src, OutputArray dst, int d = -1, double s
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
/** @brief Interface for implementations of
The
Fast Bilateral Solver.
/** @brief Interface for implementations of Fast Bilateral Solver.
For more details about this solver see @cite BarronPoole2016 .
*/
...
...
@@ -389,6 +389,8 @@ public:
@param confidence confidence image with unsigned 8-bit or floating-point 32-bit confidence and 1 channel.
@param dst destination image.
@note Confidence images with CV_8U depth are expected to in [0, 255] and CV_32F in [0, 1] range.
*/
CV_WRAP
virtual
void
filter
(
InputArray
src
,
InputArray
confidence
,
OutputArray
dst
)
=
0
;
};
...
...
@@ -397,20 +399,23 @@ public:
@param guide image serving as guide for filtering. It should have 8-bit depth and either 1 or 3 channels.
@param sigma_spatial parameter, that is similar to spatial space sigma in bilateralFilter.
@param sigma_spatial parameter, that is similar to spatial space sigma (bandwidth) in bilateralFilter.
@param sigma_luma parameter, that is similar to luma space sigma (bandwidth) in bilateralFilter.
@param sigma_
luma parameter, that is similar to luma space sigma
in bilateralFilter.
@param sigma_
chroma parameter, that is similar to chroma space sigma (bandwidth)
in bilateralFilter.
@param
sigma_chroma parameter, that is similar to chroma space sigma in bilateralFilt
er.
@param
lambda smoothness strength parameter for solv
er.
@param num_iter number of iterations used for solv
ing
, 25 is usually enough.
@param num_iter number of iterations used for solv
er
, 25 is usually enough.
@param max_tol
solving tolerance used for solving
.
@param max_tol
convergence tolerance used for solver
.
For more details about the Fast Bilateral Solver parameters, see the original paper @cite BarronPoole2016.
*/
CV_EXPORTS_W
Ptr
<
FastBilateralSolverFilter
>
createFastBilateralSolverFilter
(
InputArray
guide
,
double
sigma_spatial
,
double
sigma_luma
,
double
sigma_chroma
,
int
num_iter
=
25
,
double
max_tol
=
1e-5
);
CV_EXPORTS_W
Ptr
<
FastBilateralSolverFilter
>
createFastBilateralSolverFilter
(
InputArray
guide
,
double
sigma_spatial
,
double
sigma_luma
,
double
sigma_chroma
,
double
lambda
=
128.0
,
int
num_iter
=
25
,
double
max_tol
=
1e-5
);
/** @brief Simple one-line Fast Bilateral Solver filter call. If you have multiple images to filter with the same
...
...
@@ -424,20 +429,26 @@ guide then use FastBilateralSolverFilter interface to avoid extra computations.
@param dst destination image.
@param sigma_spatial parameter, that is similar to spatial space sigma in bilateralFilter.
@param sigma_spatial parameter, that is similar to spatial space sigma (bandwidth) in bilateralFilter.
@param sigma_luma parameter, that is similar to luma space sigma (bandwidth) in bilateralFilter.
@param sigma_
luma parameter, that is similar to luma space sigma
in bilateralFilter.
@param sigma_
chroma parameter, that is similar to chroma space sigma (bandwidth)
in bilateralFilter.
@param
sigma_chroma parameter, that is similar to chroma space sigma in bilateralFilt
er.
@param
lambda smoothness strength parameter for solv
er.
@param num_iter number of iterations used for solv
ing
, 25 is usually enough.
@param num_iter number of iterations used for solv
er
, 25 is usually enough.
@param max_tol solving tolerance used for solving.
@param max_tol convergence tolerance used for solver.
For more details about the Fast Bilateral Solver parameters, see the original paper @cite BarronPoole2016.
@note Confidence images with CV_8U depth are expected to in [0, 255] and CV_32F in [0, 1] range.
*/
CV_EXPORTS_W
void
fastBilateralSolverFilter
(
InputArray
guide
,
InputArray
src
,
InputArray
confidence
,
OutputArray
dst
,
double
sigma_spatial
=
8
,
double
sigma_luma
=
8
,
double
sigma_chroma
=
8
,
int
num_iter
=
25
,
double
max_tol
=
1e-5
);
CV_EXPORTS_W
void
fastBilateralSolverFilter
(
InputArray
guide
,
InputArray
src
,
InputArray
confidence
,
OutputArray
dst
,
double
sigma_spatial
=
8
,
double
sigma_luma
=
8
,
double
sigma_chroma
=
8
,
double
lambda
=
128.0
,
int
num_iter
=
25
,
double
max_tol
=
1e-5
);
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
/** @brief Interface for implementations of Fast Global Smoother filter.
...
...
modules/ximgproc/samples/disparity_filtering.cpp
View file @
b686f430
...
...
@@ -33,6 +33,7 @@ const String keys =
"{fbs_spatial |16.0 | parameter of fbs post-filtering }"
"{fbs_luma |8.0 | parameter of fbs post-filtering }"
"{fbs_chroma |8.0 | parameter of fbs post-filtering }"
"{fbs_lambda |128.0 | parameter of fbs post-filtering }"
;
int
main
(
int
argc
,
char
**
argv
)
...
...
@@ -62,6 +63,7 @@ int main(int argc, char** argv)
double
fbs_spatial
=
parser
.
get
<
double
>
(
"fbs_spatial"
);
double
fbs_luma
=
parser
.
get
<
double
>
(
"fbs_luma"
);
double
fbs_chroma
=
parser
.
get
<
double
>
(
"fbs_chroma"
);
double
fbs_lambda
=
parser
.
get
<
double
>
(
"fbs_lambda"
);
double
vis_mult
=
parser
.
get
<
double
>
(
"vis_mult"
);
int
wsize
;
...
...
@@ -293,17 +295,18 @@ int main(int argc, char** argv)
#ifdef HAVE_EIGEN
//! [filtering_fbs]
solving_time
=
(
double
)
getTickCount
();
fastBilateralSolverFilter
(
left
,
left_disp_resized
,
conf_map
/
255.0
f
,
solved_disp
,
fbs_spatial
,
fbs_luma
,
fbs_chroma
);
fastBilateralSolverFilter
(
left
,
left_disp_resized
,
conf_map
/
255.0
f
,
solved_disp
,
fbs_spatial
,
fbs_luma
,
fbs_chroma
,
fbs_lambda
);
solving_time
=
((
double
)
getTickCount
()
-
solving_time
)
/
getTickFrequency
();
//! [filtering_fbs]
//! [filtering_wls2fbs]
fastBilateralSolverFilter
(
left
,
filtered_disp
,
conf_map
/
255.0
f
,
solved_filtered_disp
,
fbs_spatial
,
fbs_luma
,
fbs_chroma
);
fastBilateralSolverFilter
(
left
,
filtered_disp
,
conf_map
/
255.0
f
,
solved_filtered_disp
,
fbs_spatial
,
fbs_luma
,
fbs_chroma
,
fbs_lambda
);
//! [filtering_wls2fbs]
#else
(
void
)
fbs_spatial
;
(
void
)
fbs_luma
;
(
void
)
fbs_chroma
;
(
void
)
fbs_lambda
;
#endif
}
else
if
(
filter
==
"wls_no_conf"
)
...
...
modules/ximgproc/src/fbs_filter.cpp
View file @
b686f430
...
...
@@ -77,19 +77,19 @@ namespace ximgproc
{
public
:
static
Ptr
<
FastBilateralSolverFilterImpl
>
create
(
InputArray
guide
,
double
sigma_spatial
,
double
sigma_luma
,
double
sigma_chroma
,
int
num_iter
,
double
max_tol
)
static
Ptr
<
FastBilateralSolverFilterImpl
>
create
(
InputArray
guide
,
double
sigma_spatial
,
double
sigma_luma
,
double
sigma_chroma
,
double
lambda
,
int
num_iter
,
double
max_tol
)
{
CV_Assert
(
guide
.
type
()
==
CV_8UC1
||
guide
.
type
()
==
CV_8UC3
);
FastBilateralSolverFilterImpl
*
fbs
=
new
FastBilateralSolverFilterImpl
();
Mat
gui
=
guide
.
getMat
();
fbs
->
init
(
gui
,
sigma_spatial
,
sigma_luma
,
sigma_chroma
,
num_iter
,
max_tol
);
fbs
->
init
(
gui
,
sigma_spatial
,
sigma_luma
,
sigma_chroma
,
lambda
,
num_iter
,
max_tol
);
return
Ptr
<
FastBilateralSolverFilterImpl
>
(
fbs
);
}
void
filter
(
InputArray
src
,
InputArray
confidence
,
OutputArray
dst
)
CV_OVERRIDE
{
CV_Assert
(
!
src
.
empty
()
&&
(
src
.
depth
()
==
CV_8U
||
src
.
depth
()
==
CV_16S
||
src
.
depth
()
==
CV_32F
)
&&
src
.
channels
()
<=
4
);
CV_Assert
(
!
src
.
empty
()
&&
(
src
.
depth
()
==
CV_8U
||
src
.
depth
()
==
CV_16S
||
src
.
depth
()
==
CV_
16U
||
src
.
depth
()
==
CV_
32F
)
&&
src
.
channels
()
<=
4
);
CV_Assert
(
!
confidence
.
empty
()
&&
(
confidence
.
depth
()
==
CV_8U
||
confidence
.
depth
()
==
CV_32F
)
&&
confidence
.
channels
()
==
1
);
if
(
src
.
rows
()
!=
rows
||
src
.
cols
()
!=
cols
)
{
...
...
@@ -133,7 +133,7 @@ namespace ximgproc
// protected:
void
solve
(
cv
::
Mat
&
src
,
cv
::
Mat
&
confidence
,
cv
::
Mat
&
dst
);
void
init
(
cv
::
Mat
&
reference
,
double
sigma_spatial
,
double
sigma_luma
,
double
sigma_chroma
,
int
num_iter
,
double
max_tol
);
void
init
(
cv
::
Mat
&
reference
,
double
sigma_spatial
,
double
sigma_luma
,
double
sigma_chroma
,
double
lambda
,
int
num_iter
,
double
max_tol
);
void
Splat
(
Eigen
::
VectorXf
&
input
,
Eigen
::
VectorXf
&
dst
);
void
Blur
(
Eigen
::
VectorXf
&
input
,
Eigen
::
VectorXf
&
dst
);
...
...
@@ -174,8 +174,8 @@ namespace ximgproc
grid_params
()
{
spatialSigma
=
8.0
;
lumaSigma
=
4
.0
;
chromaSigma
=
4
.0
;
lumaSigma
=
8
.0
;
chromaSigma
=
8
.0
;
}
};
...
...
@@ -201,9 +201,10 @@ namespace ximgproc
void
FastBilateralSolverFilterImpl
::
init
(
cv
::
Mat
&
reference
,
double
sigma_spatial
,
double
sigma_luma
,
double
sigma_chroma
,
int
num_iter
,
double
max_tol
)
void
FastBilateralSolverFilterImpl
::
init
(
cv
::
Mat
&
reference
,
double
sigma_spatial
,
double
sigma_luma
,
double
sigma_chroma
,
double
lambda
,
int
num_iter
,
double
max_tol
)
{
bs_param
.
lam
=
lambda
;
bs_param
.
cg_maxiter
=
num_iter
;
bs_param
.
cg_tol
=
max_tol
;
...
...
@@ -266,7 +267,6 @@ namespace ximgproc
// construct Blur matrices
Eigen
::
VectorXf
ones_nvertices
=
Eigen
::
VectorXf
::
Ones
(
nvertices
);
Eigen
::
VectorXf
ones_npixels
=
Eigen
::
VectorXf
::
Ones
(
npixels
);
diagonal
(
ones_nvertices
,
blurs
);
blurs
*=
10
;
for
(
int
offset
=
-
1
;
offset
<=
1
;
++
offset
)
...
...
@@ -379,7 +379,6 @@ namespace ximgproc
// construct Blur matrices
Eigen
::
VectorXf
ones_nvertices
=
Eigen
::
VectorXf
::
Ones
(
nvertices
);
Eigen
::
VectorXf
ones_npixels
=
Eigen
::
VectorXf
::
Ones
(
npixels
);
diagonal
(
ones_nvertices
,
blurs
);
blurs
*=
10
;
for
(
int
offset
=
-
1
;
offset
<=
1
;
++
offset
)
...
...
@@ -486,6 +485,14 @@ namespace ximgproc
x
(
i
)
=
(
cv
::
saturate_cast
<
float
>
(
pft
[
i
])
+
32768.0
f
)
/
65535.0
f
;
}
}
else
if
(
target
.
depth
()
==
CV_16U
)
{
const
uint16_t
*
pft
=
reinterpret_cast
<
const
uint16_t
*>
(
target
.
data
);
for
(
int
i
=
0
;
i
<
npixels
;
i
++
)
{
x
(
i
)
=
cv
::
saturate_cast
<
float
>
(
pft
[
i
])
/
65535.0
f
;
}
}
else
if
(
target
.
depth
()
==
CV_8U
)
{
const
uchar
*
pft
=
reinterpret_cast
<
const
uchar
*>
(
target
.
data
);
...
...
@@ -566,7 +573,15 @@ namespace ximgproc
int16_t
*
pftar
=
(
int16_t
*
)
output
.
data
;
for
(
int
i
=
0
;
i
<
int
(
splat_idx
.
size
());
i
++
)
{
pftar
[
i
]
=
cv
::
saturate_cast
<
ushort
>
(
y
(
splat_idx
[
i
])
*
65535.0
f
-
32768.0
f
);
pftar
[
i
]
=
cv
::
saturate_cast
<
short
>
(
y
(
splat_idx
[
i
])
*
65535.0
f
-
32768.0
f
);
}
}
else
if
(
target
.
depth
()
==
CV_16U
)
{
uint16_t
*
pftar
=
(
uint16_t
*
)
output
.
data
;
for
(
int
i
=
0
;
i
<
int
(
splat_idx
.
size
());
i
++
)
{
pftar
[
i
]
=
cv
::
saturate_cast
<
ushort
>
(
y
(
splat_idx
[
i
])
*
65535.0
f
);
}
}
else
if
(
target
.
depth
()
==
CV_8U
)
...
...
@@ -592,14 +607,14 @@ namespace ximgproc
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
Ptr
<
FastBilateralSolverFilter
>
createFastBilateralSolverFilter
(
InputArray
guide
,
double
sigma_spatial
,
double
sigma_luma
,
double
sigma_chroma
,
int
num_iter
,
double
max_tol
)
Ptr
<
FastBilateralSolverFilter
>
createFastBilateralSolverFilter
(
InputArray
guide
,
double
sigma_spatial
,
double
sigma_luma
,
double
sigma_chroma
,
double
lambda
,
int
num_iter
,
double
max_tol
)
{
return
Ptr
<
FastBilateralSolverFilter
>
(
FastBilateralSolverFilterImpl
::
create
(
guide
,
sigma_spatial
,
sigma_luma
,
sigma_chroma
,
num_iter
,
max_tol
));
return
Ptr
<
FastBilateralSolverFilter
>
(
FastBilateralSolverFilterImpl
::
create
(
guide
,
sigma_spatial
,
sigma_luma
,
sigma_chroma
,
lambda
,
num_iter
,
max_tol
));
}
void
fastBilateralSolverFilter
(
InputArray
guide
,
InputArray
src
,
InputArray
confidence
,
OutputArray
dst
,
double
sigma_spatial
,
double
sigma_luma
,
double
sigma_chroma
,
int
num_iter
,
double
max_tol
)
void
fastBilateralSolverFilter
(
InputArray
guide
,
InputArray
src
,
InputArray
confidence
,
OutputArray
dst
,
double
sigma_spatial
,
double
sigma_luma
,
double
sigma_chroma
,
double
lambda
,
int
num_iter
,
double
max_tol
)
{
Ptr
<
FastBilateralSolverFilter
>
fbs
=
createFastBilateralSolverFilter
(
guide
,
sigma_spatial
,
sigma_luma
,
sigma_chroma
,
num_iter
,
max_tol
);
Ptr
<
FastBilateralSolverFilter
>
fbs
=
createFastBilateralSolverFilter
(
guide
,
sigma_spatial
,
sigma_luma
,
sigma_chroma
,
lambda
,
num_iter
,
max_tol
);
fbs
->
filter
(
src
,
confidence
,
dst
);
}
...
...
@@ -614,12 +629,12 @@ namespace cv
namespace
ximgproc
{
Ptr
<
FastBilateralSolverFilter
>
createFastBilateralSolverFilter
(
InputArray
,
double
,
double
,
double
,
int
,
double
)
Ptr
<
FastBilateralSolverFilter
>
createFastBilateralSolverFilter
(
InputArray
,
double
,
double
,
double
,
double
,
int
,
double
)
{
CV_Error
(
Error
::
StsNotImplemented
,
"createFastBilateralSolverFilter : needs to be compiled with EIGEN"
);
}
void
fastBilateralSolverFilter
(
InputArray
,
InputArray
,
InputArray
,
OutputArray
,
double
,
double
,
double
,
int
,
double
)
void
fastBilateralSolverFilter
(
InputArray
,
InputArray
,
InputArray
,
OutputArray
,
double
,
double
,
double
,
double
,
int
,
double
)
{
CV_Error
(
Error
::
StsNotImplemented
,
"fastBilateralSolverFilter : needs to be compiled with EIGEN"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment