Skip to content

Commit 3c2bcbf

Browse files
authored
Merge pull request #3724 from catree:add_visual_servo_references
Rename getInteractionMatrix() to computeInteractionMatrix()
2 parents ac994ed + fb69ae3 commit 3c2bcbf

File tree

4 files changed

+50
-9
lines changed

4 files changed

+50
-9
lines changed

modules/tracking/doc/tracking.bib

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,43 @@ @Article{Lukezic_IJCV2018
7676
journal={International Journal of Computer Vision},
7777
year={2018},
7878
}
79+
80+
@article{chaumette:inria-00350283,
81+
title={{Visual servo control, Part I: Basic approaches}},
82+
author={Chaumette, Fran{\c c}ois and Hutchinson, S.},
83+
url={https://inria.hal.science/inria-00350283},
84+
journal={{IEEE Robotics and Automation Magazine}},
85+
publisher={{Institute of Electrical and Electronics Engineers}},
86+
volume={13},
87+
number={4},
88+
pages={82-90},
89+
year={2006},
90+
pdf={https://inria.hal.science/inria-00350283/file/2006_ieee_ram_chaumette.pdf},
91+
hal_id={inria-00350283},
92+
hal_version={v1},
93+
}
94+
95+
@article{chaumette:inria-00350638,
96+
title={{Visual servo control, Part II: Advanced approaches}},
97+
author={Chaumette, Fran{\c c}ois and Hutchinson, S.},
98+
url={https://inria.hal.science/inria-00350638},
99+
journal={{IEEE Robotics and Automation Magazine}},
100+
publisher={{Institute of Electrical and Electronics Engineers}},
101+
volume={14},
102+
number={1},
103+
pages={109-118},
104+
year={2007},
105+
pdf={https://inria.hal.science/inria-00350638/file/2007_ieee_ram_chaumette.pdf},
106+
hal_id={inria-00350638},
107+
hal_version={v1},
108+
}
109+
110+
@article{Hutchinson1996ATO,
111+
title={A tutorial on visual servo control},
112+
author={Seth A. Hutchinson and Gregory Hager and Peter Corke},
113+
journal={IEEE Trans. Robotics Autom.},
114+
year={1996},
115+
volume={12},
116+
pages={651-670},
117+
url={https://api.semanticscholar.org/CorpusID:1814423}
118+
}

modules/tracking/include/opencv2/tracking/twist.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ inline namespace tracking
1616
* @brief Compute the camera twist from a set of 2D pixel locations, their
1717
* velocities, depth values and intrinsic parameters of the camera. The pixel
1818
* velocities are usually obtained from optical flow algorithms, both dense and
19-
* sparse flow can be used to compute the flow between images and duv computed by
19+
* sparse flow can be used to compute the flow between images and \p duv computed by
2020
* dividing the flow by the time interval between the images.
2121
*
2222
* @param uv 2xN matrix of 2D pixel locations
@@ -30,9 +30,10 @@ CV_EXPORTS cv::Vec6d computeTwist(const cv::Mat& uv, const cv::Mat& duv, const c
3030
const cv::Mat& K);
3131

3232
/**
33-
* @brief Compute the interaction matrix for a set of 2D pixels. This is usually
33+
* @brief Compute the interaction matrix ( @cite Hutchinson1996ATO @cite chaumette:inria-00350283
34+
* @cite chaumette:inria-00350638 ) for a set of 2D pixels. This is usually
3435
* used in visual servoing applications to command a robot to move at desired pixel
35-
* locations/velocities. By inverting this matrix one can estimate camera spatial
36+
* locations/velocities. By inverting this matrix, one can estimate camera spatial
3637
* velocity i.e., the twist.
3738
*
3839
* @param uv 2xN matrix of 2D pixel locations
@@ -41,8 +42,8 @@ CV_EXPORTS cv::Vec6d computeTwist(const cv::Mat& uv, const cv::Mat& duv, const c
4142
* @param J 2Nx6 interaction matrix
4243
*
4344
*/
44-
CV_EXPORTS void getInteractionMatrix(const cv::Mat& uv, const cv::Mat& depths, const cv::Mat& K,
45-
cv::Mat& J);
45+
CV_EXPORTS void computeInteractionMatrix(const cv::Mat& uv, const cv::Mat& depths, const cv::Mat& K,
46+
cv::Mat& J);
4647

4748
//! @}
4849

modules/tracking/src/twist.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace detail
99
inline namespace tracking
1010
{
1111

12-
void getInteractionMatrix(const cv::Mat& uv, const cv::Mat& depths, const cv::Mat& K, cv::Mat& J)
12+
void computeInteractionMatrix(const cv::Mat& uv, const cv::Mat& depths, const cv::Mat& K, cv::Mat& J)
1313
{
1414
CV_Assert(uv.cols == depths.cols);
1515
CV_Assert(depths.type() == CV_32F);
@@ -64,7 +64,7 @@ cv::Vec6d computeTwist(const cv::Mat& uv, const cv::Mat& duv, const cv::Mat& dep
6464
CV_Assert(uv.cols * 2 == duv.rows);
6565

6666
cv::Mat J;
67-
getInteractionMatrix(uv, depths, K, J);
67+
computeInteractionMatrix(uv, depths, K, J);
6868
cv::Mat Jinv;
6969
cv::invert(J, Jinv, cv::DECOMP_SVD);
7070
cv::Mat twist = Jinv * duv;

modules/tracking/test/test_twist.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ TEST_F(TwistTest, TestInteractionMatrix)
3939
cv::Mat uv = cv::Mat(2, 1, CV_32F, {1.0f, 1.0f});
4040
cv::Mat depth = cv::Mat(1, 1, CV_32F, {2.0f});
4141

42-
getInteractionMatrix(uv, depth, K, J);
42+
computeInteractionMatrix(uv, depth, K, J);
4343
ASSERT_EQ(J.cols, 6);
4444
ASSERT_EQ(J.rows, 2);
4545
float expected[2][6] = {{-0.5f, 0.0f, 0.5f, 1.0f, -2.0f, 1.0f},
@@ -87,7 +87,7 @@ TEST_F(TwistTest, TestComputeWithNonZeroPixelVelocities)
8787
float duv_data[] = {1.0f, 2.0f, 1.0f, 3.0f, 1.0f, 4.0f};
8888
cv::Mat duv = cv::Mat(6, 1, CV_32F, duv_data);
8989

90-
getInteractionMatrix(uv, depth, K, J);
90+
computeInteractionMatrix(uv, depth, K, J);
9191
ASSERT_EQ(J.cols, 6);
9292
ASSERT_EQ(J.rows, 6);
9393
float expected_jac[6][6] = {{-1.0f, 0.0f, 1.0f, 1.0f, -2.0f, 1.0f},

0 commit comments

Comments
 (0)