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
21d220d6
Commit
21d220d6
authored
Mar 22, 2020
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stereo: get rid of imageMeanKernelSize, replace with blur()
parent
7c0e6efd
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
73 deletions
+8
-73
descriptor.cpp
modules/stereo/src/descriptor.cpp
+0
-13
descriptor.hpp
modules/stereo/src/descriptor.hpp
+0
-38
stereo_binary_bm.cpp
modules/stereo/src/stereo_binary_bm.cpp
+4
-11
stereo_binary_sgbm.cpp
modules/stereo/src/stereo_binary_sgbm.cpp
+4
-11
No files found.
modules/stereo/src/descriptor.cpp
View file @
21d220d6
...
...
@@ -239,18 +239,5 @@ namespace cv
CombinedDescriptor
<
1
,
1
,
1
,
1
,
ModifiedCsCensus
<
1
>
>
(
img1
.
cols
,
img1
.
rows
,
stride
,
n2
,
date
,
ModifiedCsCensus
<
1
>
(
images
,
n2
),
1
));
}
}
//integral image computation used in the Mean Variation Census Transform
void
imageMeanKernelSize
(
const
Mat
&
image
,
int
windowSize
,
Mat
&
cost
)
{
CV_Assert
(
!
image
.
empty
());
CV_Assert
(
!
cost
.
empty
());
CV_Assert
(
windowSize
%
2
!=
0
);
int
win
=
windowSize
/
2
;
float
scalling
=
((
float
)
1
)
/
(
windowSize
*
windowSize
);
int
height
=
image
.
rows
;
cost
.
setTo
(
0
);
int
*
c
=
(
int
*
)
cost
.
data
;
parallel_for_
(
Range
(
0
,
height
),
MeanKernelIntegralImage
(
image
,
win
,
scalling
,
c
));
}
}
}
modules/stereo/src/descriptor.hpp
View file @
21d220d6
...
...
@@ -245,42 +245,6 @@ namespace cv
}
}
};
//!calculate the mean of every windowSizexWindwoSize block from the integral Image
//!this is a preprocessing for MV kernel
class
MeanKernelIntegralImage
:
public
ParallelLoopBody
{
private
:
const
Mat
&
img
;
int
windowSize
;
float
scalling
;
int
*
c
;
public
:
MeanKernelIntegralImage
(
const
cv
::
Mat
&
image
,
int
window
,
float
scale
,
int
*
cost
)
:
img
(
image
),
windowSize
(
window
),
scalling
(
scale
),
c
(
cost
)
{}
void
operator
()(
const
cv
::
Range
&
r
)
const
CV_OVERRIDE
{
const
int
width
=
img
.
cols
;
const
int
height
=
img
.
rows
;
for
(
int
i
=
r
.
start
;
i
<
r
.
end
;
i
++
)
{
int
y0
=
std
::
max
(
0
,
i
-
windowSize
+
1
);
int
y1
=
std
::
min
(
height
-
1
,
i
+
windowSize
);
int
iw
=
i
*
width
;
for
(
int
j
=
0
;
j
<
width
;
j
++
)
{
int
x0
=
std
::
max
(
0
,
j
-
windowSize
+
1
);
int
x1
=
std
::
min
(
height
-
1
,
j
+
windowSize
);
c
[
iw
+
j
]
=
(
int
)(
(
img
.
at
<
int
>
(
y0
,
x0
)
+
img
.
at
<
int
>
(
y0
,
x0
)
-
img
.
at
<
int
>
(
y1
,
x0
)
-
img
.
at
<
int
>
(
y0
,
x1
)
)
*
scalling
);
}
}
}
};
//!implementation for the star kernel descriptor
template
<
int
num_images
>
class
StarKernelCensus
:
public
ParallelLoopBody
...
...
@@ -441,8 +405,6 @@ namespace cv
}
}
};
//integral image computation used in the Mean Variation Census Transform
void
imageMeanKernelSize
(
const
cv
::
Mat
&
img
,
int
windowSize
,
cv
::
Mat
&
c
);
}
}
#endif
...
...
modules/stereo/src/stereo_binary_bm.cpp
View file @
21d220d6
...
...
@@ -384,15 +384,10 @@ namespace cv
}
else
if
(
params
.
kernelType
==
CV_MEAN_VARIATION
)
{
parSumsIntensityImage
[
0
].
create
(
left0
.
rows
,
left0
.
cols
,
CV_32SC4
);
parSumsIntensityImage
[
1
].
create
(
left0
.
rows
,
left0
.
cols
,
CV_32SC4
);
Integral
[
0
].
create
(
left0
.
rows
,
left0
.
cols
,
CV_32SC4
);
Integral
[
1
].
create
(
left0
.
rows
,
left0
.
cols
,
CV_32SC4
);
integral
(
left
,
parSumsIntensityImage
[
0
],
CV_32S
);
integral
(
right
,
parSumsIntensityImage
[
1
],
CV_32S
);
imageMeanKernelSize
(
parSumsIntensityImage
[
0
],
params
.
kernelSize
,
Integral
[
0
]);
imageMeanKernelSize
(
parSumsIntensityImage
[
1
],
params
.
kernelSize
,
Integral
[
1
]);
modifiedCensusTransform
(
left
,
right
,
params
.
kernelSize
,
censusImage
[
0
],
censusImage
[
1
],
CV_MEAN_VARIATION
,
0
,
Integral
[
0
],
Integral
[
1
]);
Mat
blurLeft
;
blur
(
left
,
blurLeft
,
Size
(
params
.
kernelSize
,
params
.
kernelSize
));
Mat
blurRight
;
blur
(
right
,
blurRight
,
Size
(
params
.
kernelSize
,
params
.
kernelSize
));
modifiedCensusTransform
(
left
,
right
,
params
.
kernelSize
,
censusImage
[
0
],
censusImage
[
1
],
CV_MEAN_VARIATION
,
0
,
blurLeft
,
blurRight
);
}
else
if
(
params
.
kernelType
==
CV_STAR_KERNEL
)
{
...
...
@@ -502,8 +497,6 @@ namespace cv
StereoBinaryBMParams
params
;
Mat
preFilteredImg0
,
preFilteredImg1
,
cost
,
dispbuf
;
Mat
slidingSumBuf
;
Mat
parSumsIntensityImage
[
2
];
Mat
Integral
[
2
];
Mat
censusImage
[
2
];
Mat
hammingDistance
;
Mat
partialSumsLR
;
...
...
modules/stereo/src/stereo_binary_sgbm.cpp
View file @
21d220d6
...
...
@@ -669,15 +669,10 @@ namespace cv
}
else
if
(
params
.
kernelType
==
CV_MEAN_VARIATION
)
{
parSumsIntensityImage
[
0
].
create
(
left
.
rows
,
left
.
cols
,
CV_32SC4
);
parSumsIntensityImage
[
1
].
create
(
left
.
rows
,
left
.
cols
,
CV_32SC4
);
Integral
[
0
].
create
(
left
.
rows
,
left
.
cols
,
CV_32SC4
);
Integral
[
1
].
create
(
left
.
rows
,
left
.
cols
,
CV_32SC4
);
integral
(
left
,
parSumsIntensityImage
[
0
],
CV_32S
);
integral
(
right
,
parSumsIntensityImage
[
1
],
CV_32S
);
imageMeanKernelSize
(
parSumsIntensityImage
[
0
],
params
.
kernelSize
,
Integral
[
0
]);
imageMeanKernelSize
(
parSumsIntensityImage
[
1
],
params
.
kernelSize
,
Integral
[
1
]);
modifiedCensusTransform
(
left
,
right
,
params
.
kernelSize
,
censusImageLeft
,
censusImageRight
,
CV_MEAN_VARIATION
,
0
,
Integral
[
0
],
Integral
[
1
]);
Mat
blurLeft
;
blur
(
left
,
blurLeft
,
Size
(
params
.
kernelSize
,
params
.
kernelSize
));
Mat
blurRight
;
blur
(
right
,
blurRight
,
Size
(
params
.
kernelSize
,
params
.
kernelSize
));
modifiedCensusTransform
(
left
,
right
,
params
.
kernelSize
,
censusImageLeft
,
censusImageRight
,
CV_MEAN_VARIATION
,
0
,
blurLeft
,
blurRight
);
}
else
if
(
params
.
kernelType
==
CV_STAR_KERNEL
)
{
...
...
@@ -800,8 +795,6 @@ namespace cv
Mat
partialSumsLR
;
Mat
agregatedHammingLRCost
;
Mat
hamDist
;
Mat
parSumsIntensityImage
[
2
];
Mat
Integral
[
2
];
};
const
char
*
StereoBinarySGBMImpl
::
name_
=
"StereoBinaryMatcher.SGBM"
;
...
...
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