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
fbfc0cc9
Commit
fbfc0cc9
authored
Mar 12, 2012
by
Maria Dimashova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added special cases to RGBDOdometry (translation only, rotation only)
parent
f4e5209d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
8 deletions
+41
-8
contrib.hpp
modules/contrib/include/opencv2/contrib/contrib.hpp
+8
-2
rgbdodometry.cpp
modules/contrib/src/rgbdodometry.cpp
+0
-0
rgbdodometry.cpp
samples/cpp/rgbdodometry.cpp
+33
-6
No files found.
modules/contrib/include/opencv2/contrib/contrib.hpp
View file @
fbfc0cc9
...
...
@@ -629,13 +629,19 @@ namespace cv
* Estimate the rigid body motion from frame0 to frame1. The method is based on the paper
* "Real-Time Visual Odometry from Dense RGB-D Images", F. Steinbucker, J. Strum, D. Cremers, ICCV, 2011.
*/
CV_EXPORTS
struct
TransformationType
{
enum
{
ROTATION
=
1
,
TRANSLATION
=
2
,
RIGID_BODY_MOTION
=
4
};
};
CV_EXPORTS
bool
RGBDOdometry
(
cv
::
Mat
&
Rt
,
const
cv
::
Mat
&
image0
,
const
cv
::
Mat
&
depth0
,
const
cv
::
Mat
&
mask0
,
const
cv
::
Mat
&
image1
,
const
cv
::
Mat
&
depth1
,
const
cv
::
Mat
&
mask1
,
const
cv
::
Mat
&
cameraMatrix
,
const
std
::
vector
<
int
>&
iterCounts
,
const
std
::
vector
<
float
>&
minGradientMagnitudes
,
float
minDepth
,
float
maxDepth
,
float
maxDepthDiff
);
float
minDepth
,
float
maxDepth
,
float
maxDepthDiff
,
int
transformType
=
TransformationType
::
RIGID_BODY_MOTION
);
}
#include "opencv2/contrib/retina.hpp"
...
...
modules/contrib/src/rgbdodometry.cpp
View file @
fbfc0cc9
This diff is collapsed.
Click to expand it.
samples/cpp/rgbdodometry.cpp
View file @
fbfc0cc9
...
...
@@ -78,10 +78,14 @@ int main(int argc, char** argv)
const
Mat
cameraMatrix
=
Mat
(
3
,
3
,
CV_32FC1
,
vals
);
const
Mat
distCoeff
(
1
,
5
,
CV_32FC1
,
Scalar
(
0
));
if
(
argc
!=
5
)
if
(
argc
!=
5
&&
argc
!=
6
)
{
cout
<<
"Format: image0 depth0 image1 depth1"
<<
endl
;
cout
<<
"Format: image0 depth0 image1 depth1
[transformationType]
"
<<
endl
;
cout
<<
"Depth file must be 16U image stored depth in mm."
<<
endl
;
cout
<<
"Transformation types:"
<<
endl
;
cout
<<
" -rbm - rigid body motion (default)"
<<
endl
;
cout
<<
" -r - rotation rotation only"
<<
endl
;
cout
<<
" -t - translation only"
<<
endl
;
return
-
1
;
}
...
...
@@ -97,6 +101,29 @@ int main(int argc, char** argv)
return
-
1
;
}
int
transformationType
=
TransformationType
::
RIGID_BODY_MOTION
;
if
(
argc
==
6
)
{
string
ttype
=
argv
[
5
];
if
(
ttype
==
"-rbm"
)
{
transformationType
=
TransformationType
::
RIGID_BODY_MOTION
;
}
else
if
(
ttype
==
"-r"
)
{
transformationType
=
TransformationType
::
ROTATION
;
}
else
if
(
ttype
==
"-t"
)
{
transformationType
=
TransformationType
::
TRANSLATION
;
}
else
{
cout
<<
"Unsupported transformation type."
<<
endl
;
return
-
1
;
}
}
Mat
grayImage0
,
grayImage1
,
depthFlt0
,
depthFlt1
/*in meters*/
;
cvtColor
(
colorImage0
,
grayImage0
,
CV_BGR2GRAY
);
cvtColor
(
colorImage1
,
grayImage1
,
CV_BGR2GRAY
);
...
...
@@ -126,7 +153,7 @@ int main(int argc, char** argv)
bool
isFound
=
cv
::
RGBDOdometry
(
Rt
,
grayImage0
,
depthFlt0
,
Mat
(),
grayImage1
,
depthFlt1
,
Mat
(),
cameraMatrix
,
iterCounts
,
minGradMagnitudes
,
minDepth
,
maxDepth
,
maxDepthDiff
);
minDepth
,
maxDepth
,
maxDepthDiff
,
transformationType
);
tm
.
stop
();
cout
<<
"Rt = "
<<
Rt
<<
endl
;
...
...
@@ -141,9 +168,9 @@ int main(int argc, char** argv)
Mat
warpedImage0
;
warpImage
<
Point3_
<
uchar
>
>
(
colorImage0
,
depthFlt0
,
Rt
,
cameraMatrix
,
distCoeff
,
warpedImage0
);
imshow
(
"im0"
,
colorImage0
);
imshow
(
"warped_im0"
,
warpedImage0
);
imshow
(
"im1"
,
colorImage1
);
imshow
(
"im
age
0"
,
colorImage0
);
imshow
(
"warped_im
age
0"
,
warpedImage0
);
imshow
(
"im
age
1"
,
colorImage1
);
waitKey
();
return
0
;
...
...
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