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
565bcab2
Commit
565bcab2
authored
Aug 28, 2015
by
berak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove viz/vk dependancy
parent
4f860dcf
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
30 deletions
+32
-30
CMakeLists.txt
modules/structured_light/CMakeLists.txt
+1
-2
pointcloud.cpp
modules/structured_light/samples/pointcloud.cpp
+15
-8
graycodepattern.cpp
modules/structured_light/src/graycodepattern.cpp
+10
-11
test_getProjPixel.cpp
modules/structured_light/test/test_getProjPixel.cpp
+5
-6
test_plane.cpp
modules/structured_light/test/test_plane.cpp
+1
-3
No files found.
modules/structured_light/CMakeLists.txt
View file @
565bcab2
set
(
the_description
"Structured Light API"
)
ocv_define_module
(
structured_light opencv_core opencv_calib3d opencv_imgproc opencv_highgui opencv_features2d opencv_viz opencv_rgbd
)
\ No newline at end of file
ocv_define_module
(
structured_light opencv_core opencv_calib3d opencv_imgproc opencv_highgui opencv_features2d opencv_rgbd OPTIONAL opencv_viz
)
modules/structured_light/samples/pointcloud.cpp
View file @
565bcab2
...
...
@@ -45,7 +45,12 @@
#include <opencv2/calib3d.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/structured_light.hpp>
#include <opencv2/opencv_modules.hpp>
// (if you did not build the opencv_viz module, you will only see the disparity images)
#ifdef HAVE_OPENCV_VIZ
#include <opencv2/viz.hpp>
#endif
using
namespace
std
;
using
namespace
cv
;
...
...
@@ -73,13 +78,13 @@ static bool readStringList( const string& filename, vector<string>& l )
if
(
!
fs
.
isOpened
()
)
{
cerr
<<
"failed to open "
<<
filename
<<
endl
;
return
-
1
;
return
false
;
}
FileNode
n
=
fs
.
getFirstTopLevelNode
();
if
(
n
.
type
()
!=
FileNode
::
SEQ
)
{
cerr
<<
"cam 1 images are not a sequence! FAIL"
<<
endl
;
return
-
1
;
return
false
;
}
FileNodeIterator
it
=
n
.
begin
(),
it_end
=
n
.
end
();
...
...
@@ -92,7 +97,7 @@ static bool readStringList( const string& filename, vector<string>& l )
if
(
n
.
type
()
!=
FileNode
::
SEQ
)
{
cerr
<<
"cam 2 images are not a sequence! FAIL"
<<
endl
;
return
-
1
;
return
false
;
}
it
=
n
.
begin
(),
it_end
=
n
.
end
();
...
...
@@ -104,7 +109,7 @@ static bool readStringList( const string& filename, vector<string>& l )
if
(
l
.
size
()
%
2
!=
0
)
{
cout
<<
"Error: the image list contains odd (non-even) number of elements
\n
"
;
return
-
1
;
return
false
;
}
return
true
;
}
...
...
@@ -133,8 +138,8 @@ int main( int argc, char** argv )
if
(
argc
==
7
)
{
// If passed, setting the white and black threshold, otherwise using default values
white_thresh
=
parser
.
get
<
size_t
>
(
4
);
black_thresh
=
parser
.
get
<
size_t
>
(
5
);
white_thresh
=
parser
.
get
<
unsigned
>
(
4
);
black_thresh
=
parser
.
get
<
unsigned
>
(
5
);
graycode
->
setWhiteThreshold
(
white_thresh
);
graycode
->
setBlackThreshold
(
black_thresh
);
...
...
@@ -271,6 +276,7 @@ int main( int argc, char** argv )
resize
(
thresholded_disp
,
dst
,
Size
(
640
,
480
)
);
imshow
(
"threshold disp otsu"
,
dst
);
#ifdef HAVE_OPENCV_VIZ
// Apply the mask to the point cloud
Mat
pointcloud_tresh
,
color_tresh
;
pointcloud
.
copyTo
(
pointcloud_tresh
,
thresholded_disp
);
...
...
@@ -283,8 +289,10 @@ int main( int argc, char** argv )
myWindow
.
showWidget
(
"pointcloud"
,
viz
::
WCloud
(
pointcloud_tresh
,
color_tresh
)
);
myWindow
.
showWidget
(
"text2d"
,
viz
::
WText
(
"Point cloud"
,
Point
(
20
,
20
),
20
,
viz
::
Color
::
green
()
)
);
myWindow
.
spin
();
#endif // HAVE_OPENCV_VIZ
}
waitKey
();
return
0
;
}
\ No newline at end of file
}
modules/structured_light/src/graycodepattern.cpp
View file @
565bcab2
...
...
@@ -89,11 +89,11 @@ class CV_EXPORTS_W GrayCodePattern_Impl : public GrayCodePattern
// Number between 0-255 that represents the minimum brightness difference
// between the fully illuminated (white) and the non - illuminated images (black)
in
t
blackThreshold
;
size_
t
blackThreshold
;
// Number between 0-255 that represents the minimum brightness difference
// between the gray-code pattern and its inverse images
in
t
whiteThreshold
;
size_
t
whiteThreshold
;
// Computes the required number of pattern images, allocating the pattern vector
void
computeNumberOfPatternImages
();
...
...
@@ -220,8 +220,8 @@ bool GrayCodePattern_Impl::decode( InputArrayOfArrays patternImages, OutputArray
std
::
vector
<
Mat
>
shadowMasks
;
computeShadowMasks
(
blackImages
,
whitheImages
,
shadowMasks
);
size_
t
cam_width
=
acquired_pattern
[
0
][
0
].
cols
;
size_
t
cam_height
=
acquired_pattern
[
0
][
0
].
rows
;
in
t
cam_width
=
acquired_pattern
[
0
][
0
].
cols
;
in
t
cam_height
=
acquired_pattern
[
0
][
0
].
rows
;
Point
projPixel
;
...
...
@@ -233,9 +233,9 @@ bool GrayCodePattern_Impl::decode( InputArrayOfArrays patternImages, OutputArray
for
(
size_t
k
=
0
;
k
<
acquired_pattern
.
size
();
k
++
)
{
camsPixels
[
k
].
resize
(
params
.
height
*
params
.
width
);
for
(
size_
t
i
=
0
;
i
<
cam_width
;
i
++
)
for
(
in
t
i
=
0
;
i
<
cam_width
;
i
++
)
{
for
(
size_
t
j
=
0
;
j
<
cam_height
;
j
++
)
for
(
in
t
j
=
0
;
j
<
cam_height
;
j
++
)
{
//if the pixel is not shadowed, reconstruct
if
(
shadowMasks
[
k
].
at
<
uchar
>
(
j
,
i
)
)
...
...
@@ -345,10 +345,10 @@ void GrayCodePattern_Impl::computeShadowMasks( InputArrayOfArrays blackImages, I
{
for
(
int
j
=
0
;
j
<
cam_height
;
j
++
)
{
uchar
white
=
whiteImages_
[
k
].
at
<
uchar
>
(
Point
(
i
,
j
)
);
uchar
black
=
blackImages_
[
k
].
at
<
uchar
>
(
Point
(
i
,
j
)
);
double
white
=
whiteImages_
[
k
].
at
<
uchar
>
(
Point
(
i
,
j
)
);
double
black
=
blackImages_
[
k
].
at
<
uchar
>
(
Point
(
i
,
j
)
);
if
(
white
-
black
>
blackThreshold
)
if
(
abs
(
white
-
black
)
>
blackThreshold
)
{
shadowMasks_
[
k
].
at
<
uchar
>
(
Point
(
i
,
j
)
)
=
(
uchar
)
1
;
}
...
...
@@ -472,4 +472,4 @@ Ptr<GrayCodePattern> GrayCodePattern::create( const GrayCodePattern::Params& par
}
}
}
\ No newline at end of file
}
modules/structured_light/test/test_getProjPixel.cpp
View file @
565bcab2
...
...
@@ -73,12 +73,12 @@ void CV_GetProjPixelTest::run( int )
Point
projPixel
;
size_
t
image_width
=
pattern
[
0
].
cols
;
size_
t
image_height
=
pattern
[
0
].
rows
;
in
t
image_width
=
pattern
[
0
].
cols
;
in
t
image_height
=
pattern
[
0
].
rows
;
for
(
size_
t
i
=
0
;
i
<
image_width
;
i
++
)
for
(
in
t
i
=
0
;
i
<
image_width
;
i
++
)
{
for
(
size_
t
j
=
0
;
j
<
image_height
;
j
++
)
for
(
in
t
j
=
0
;
j
<
image_height
;
j
++
)
{
//for a (x,y) pixel of the camera returns the corresponding projector pixel
bool
error
=
graycode
->
getProjPixel
(
pattern
,
i
,
j
,
projPixel
);
...
...
@@ -97,4 +97,4 @@ TEST( GrayCodePattern, getProjPixel )
{
CV_GetProjPixelTest
test
;
test
.
safe_run
();
}
\ No newline at end of file
}
modules/structured_light/test/test_plane.cpp
View file @
565bcab2
...
...
@@ -45,7 +45,6 @@
#include <opencv2/highgui.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/viz.hpp>
using
namespace
std
;
using
namespace
cv
;
...
...
@@ -360,4 +359,4 @@ TEST( GrayCodePattern, plane_reconstruction )
{
CV_PlaneTest
test
;
test
.
safe_run
();
}
\ No newline at end of file
}
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