Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
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
Commits
9405c6d2
Commit
9405c6d2
authored
Apr 27, 2017
by
Michele Cancilla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvement of array of equivalences’ upper bound + fix some wrong comments
parent
0d7666a0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
15 deletions
+19
-15
connectedcomponents.cpp
modules/imgproc/src/connectedcomponents.cpp
+13
-9
background_segm.hpp
modules/video/include/opencv2/video/background_segm.hpp
+2
-2
bgfg_KNN.cpp
modules/video/src/bgfg_KNN.cpp
+1
-1
bgfg_gaussmix2.cpp
modules/video/src/bgfg_gaussmix2.cpp
+3
-3
No files found.
modules/imgproc/src/connectedcomponents.cpp
View file @
9405c6d2
...
@@ -288,7 +288,7 @@ namespace cv{
...
@@ -288,7 +288,7 @@ namespace cv{
int
r
=
range
.
start
;
int
r
=
range
.
start
;
chunksSizeAndLabels_
[
r
]
=
range
.
end
;
chunksSizeAndLabels_
[
r
]
=
range
.
end
;
LabelT
label
=
LabelT
((
r
*
imgLabels_
.
cols
+
1
)
/
2
+
1
)
;
LabelT
label
=
LabelT
((
r
+
1
)
/
2
)
*
LabelT
((
imgLabels_
.
cols
+
1
)
/
2
)
+
1
;
const
LabelT
firstLabel
=
label
;
const
LabelT
firstLabel
=
label
;
const
int
w
=
img_
.
cols
;
const
int
w
=
img_
.
cols
;
...
@@ -615,6 +615,10 @@ namespace cv{
...
@@ -615,6 +615,10 @@ namespace cv{
//merge labels of different chunks
//merge labels of different chunks
mergeLabels8Connectivity
(
imgLabels
,
P
,
chunksSizeAndLabels
);
mergeLabels8Connectivity
(
imgLabels
,
P
,
chunksSizeAndLabels
);
for
(
int
i
=
0
;
i
<
h
;
i
=
chunksSizeAndLabels
[
i
]){
flattenL
(
P
,
int
((
i
+
1
)
/
2
)
*
int
((
w
+
1
)
/
2
)
+
1
,
chunksSizeAndLabels
[
i
+
1
],
nLabels
);
}
}
}
else
{
else
{
//First scan, each thread works with chunk of img.rows/nThreads rows
//First scan, each thread works with chunk of img.rows/nThreads rows
...
@@ -623,10 +627,10 @@ namespace cv{
...
@@ -623,10 +627,10 @@ namespace cv{
//merge labels of different chunks
//merge labels of different chunks
mergeLabels4Connectivity
(
imgLabels
,
P
,
chunksSizeAndLabels
);
mergeLabels4Connectivity
(
imgLabels
,
P
,
chunksSizeAndLabels
);
}
for
(
int
i
=
0
;
i
<
h
;
i
=
chunksSizeAndLabels
[
i
]){
for
(
int
i
=
0
;
i
<
h
;
i
=
chunksSizeAndLabels
[
i
]){
flattenL
(
P
,
int
(
i
*
w
+
1
)
/
2
+
1
,
chunksSizeAndLabels
[
i
+
1
],
nLabels
);
flattenL
(
P
,
(
i
*
w
+
1
)
/
2
+
1
,
chunksSizeAndLabels
[
i
+
1
],
nLabels
);
}
}
}
//Array for statistics dataof threads
//Array for statistics dataof threads
...
@@ -842,7 +846,7 @@ namespace cv{
...
@@ -842,7 +846,7 @@ namespace cv{
chunksSizeAndLabels_
[
r
]
=
range
.
end
+
(
range
.
end
%
2
);
chunksSizeAndLabels_
[
r
]
=
range
.
end
+
(
range
.
end
%
2
);
LabelT
label
=
LabelT
((
r
+
1
)
*
(
imgLabels_
.
cols
+
1
)
/
4
)
;
LabelT
label
=
LabelT
((
r
+
1
)
/
2
)
*
LabelT
((
imgLabels_
.
cols
+
1
)
/
2
)
+
1
;
const
LabelT
firstLabel
=
label
;
const
LabelT
firstLabel
=
label
;
const
int
h
=
img_
.
rows
,
w
=
img_
.
cols
;
const
int
h
=
img_
.
rows
,
w
=
img_
.
cols
;
...
@@ -2540,7 +2544,7 @@ namespace cv{
...
@@ -2540,7 +2544,7 @@ namespace cv{
//0 0 0 0 0...
//0 0 0 0 0...
//1 0 1 0 1...
//1 0 1 0 1...
//............
//............
const
size_t
Plength
=
((
size_t
(
h
)
+
1
)
*
(
size_t
(
w
)
+
1
))
/
4
+
1
;
const
size_t
Plength
=
size_t
(((
h
+
1
)
/
2
)
*
size_t
((
w
+
1
)
/
2
))
+
1
;
//Array used to store info and labeled pixel by each thread.
//Array used to store info and labeled pixel by each thread.
//Different threads affect different memory location of chunksSizeAndLabels
//Different threads affect different memory location of chunksSizeAndLabels
...
@@ -2562,7 +2566,7 @@ namespace cv{
...
@@ -2562,7 +2566,7 @@ namespace cv{
LabelT
nLabels
=
1
;
LabelT
nLabels
=
1
;
for
(
int
i
=
0
;
i
<
h
;
i
=
chunksSizeAndLabels
[
i
]){
for
(
int
i
=
0
;
i
<
h
;
i
=
chunksSizeAndLabels
[
i
]){
flattenL
(
P
,
(
i
+
1
)
*
(
w
+
1
)
/
4
,
chunksSizeAndLabels
[
i
+
1
],
nLabels
);
flattenL
(
P
,
LabelT
((
i
+
1
)
/
2
)
*
LabelT
((
w
+
1
)
/
2
)
+
1
,
chunksSizeAndLabels
[
i
+
1
],
nLabels
);
}
}
//Array for statistics data
//Array for statistics data
...
@@ -2602,7 +2606,7 @@ namespace cv{
...
@@ -2602,7 +2606,7 @@ namespace cv{
//0 0 0 0 0...
//0 0 0 0 0...
//1 0 1 0 1...
//1 0 1 0 1...
//............
//............
const
size_t
Plength
=
((
size_t
(
h
)
+
1
)
*
(
size_t
(
w
)
+
1
))
/
4
+
1
;
const
size_t
Plength
=
size_t
(((
h
+
1
)
/
2
)
*
size_t
((
w
+
1
)
/
2
))
+
1
;
LabelT
*
P
=
(
LabelT
*
)
fastMalloc
(
sizeof
(
LabelT
)
*
Plength
);
LabelT
*
P
=
(
LabelT
*
)
fastMalloc
(
sizeof
(
LabelT
)
*
Plength
);
P
[
0
]
=
0
;
P
[
0
]
=
0
;
...
...
modules/video/include/opencv2/video/background_segm.hpp
View file @
9405c6d2
...
@@ -188,7 +188,7 @@ public:
...
@@ -188,7 +188,7 @@ public:
A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in
A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in
the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel
the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel
is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiar
r
a,
is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiara,
*Detecting Moving Shadows...*, IEEE PAMI,2003.
*Detecting Moving Shadows...*, IEEE PAMI,2003.
*/
*/
CV_WRAP
virtual
double
getShadowThreshold
()
const
=
0
;
CV_WRAP
virtual
double
getShadowThreshold
()
const
=
0
;
...
@@ -289,7 +289,7 @@ public:
...
@@ -289,7 +289,7 @@ public:
A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in
A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in
the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel
the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel
is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiar
r
a,
is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiara,
*Detecting Moving Shadows...*, IEEE PAMI,2003.
*Detecting Moving Shadows...*, IEEE PAMI,2003.
*/
*/
CV_WRAP
virtual
double
getShadowThreshold
()
const
=
0
;
CV_WRAP
virtual
double
getShadowThreshold
()
const
=
0
;
...
...
modules/video/src/bgfg_KNN.cpp
View file @
9405c6d2
...
@@ -235,7 +235,7 @@ protected:
...
@@ -235,7 +235,7 @@ protected:
// Tau - shadow threshold. The shadow is detected if the pixel is darker
// Tau - shadow threshold. The shadow is detected if the pixel is darker
//version of the background. Tau is a threshold on how much darker the shadow can be.
//version of the background. Tau is a threshold on how much darker the shadow can be.
//Tau= 0.5 means that if pixel is more than 2 times darker then it is not shadow
//Tau= 0.5 means that if pixel is more than 2 times darker then it is not shadow
//See: Prati,Mikic,Trivedi,Cucchiar
r
a,"Detecting Moving Shadows...",IEEE PAMI,2003.
//See: Prati,Mikic,Trivedi,Cucchiara,"Detecting Moving Shadows...",IEEE PAMI,2003.
//model data
//model data
int
nLongCounter
;
//circular counter
int
nLongCounter
;
//circular counter
...
...
modules/video/src/bgfg_gaussmix2.cpp
View file @
9405c6d2
...
@@ -386,7 +386,7 @@ protected:
...
@@ -386,7 +386,7 @@ protected:
// Tau - shadow threshold. The shadow is detected if the pixel is darker
// Tau - shadow threshold. The shadow is detected if the pixel is darker
//version of the background. Tau is a threshold on how much darker the shadow can be.
//version of the background. Tau is a threshold on how much darker the shadow can be.
//Tau= 0.5 means that if pixel is more than 2 times darker then it is not shadow
//Tau= 0.5 means that if pixel is more than 2 times darker then it is not shadow
//See: Prati,Mikic,Trivedi,Cucchiar
r
a,"Detecting Moving Shadows...",IEEE PAMI,2003.
//See: Prati,Mikic,Trivedi,Cucchiara,"Detecting Moving Shadows...",IEEE PAMI,2003.
String
name_
;
String
name_
;
...
@@ -461,7 +461,7 @@ struct GaussBGStatModel2Params
...
@@ -461,7 +461,7 @@ struct GaussBGStatModel2Params
// Tau - shadow threshold. The shadow is detected if the pixel is darker
// Tau - shadow threshold. The shadow is detected if the pixel is darker
//version of the background. Tau is a threshold on how much darker the shadow can be.
//version of the background. Tau is a threshold on how much darker the shadow can be.
//Tau= 0.5 means that if pixel is more than 2 times darker then it is not shadow
//Tau= 0.5 means that if pixel is more than 2 times darker then it is not shadow
//See: Prati,Mikic,Trivedi,Cucchiar
r
a,"Detecting Moving Shadows...",IEEE PAMI,2003.
//See: Prati,Mikic,Trivedi,Cucchiara,"Detecting Moving Shadows...",IEEE PAMI,2003.
};
};
struct
GMM
struct
GMM
...
@@ -472,7 +472,7 @@ struct GMM
...
@@ -472,7 +472,7 @@ struct GMM
// shadow detection performed per pixel
// shadow detection performed per pixel
// should work for rgb data, could be usefull for gray scale and depth data as well
// should work for rgb data, could be usefull for gray scale and depth data as well
// See: Prati,Mikic,Trivedi,Cucchiar
r
a,"Detecting Moving Shadows...",IEEE PAMI,2003.
// See: Prati,Mikic,Trivedi,Cucchiara,"Detecting Moving Shadows...",IEEE PAMI,2003.
CV_INLINE
bool
CV_INLINE
bool
detectShadowGMM
(
const
float
*
data
,
int
nchannels
,
int
nmodes
,
detectShadowGMM
(
const
float
*
data
,
int
nchannels
,
int
nmodes
,
const
GMM
*
gmm
,
const
float
*
mean
,
const
GMM
*
gmm
,
const
float
*
mean
,
...
...
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