mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-21 06:11:09 +08:00
Merge pull request #2882 from LaurentBerger:python_viz
* python binding for viz tutorial widget pose reset test_tutorial 2 & 3 sample py 9 test sur 22 test PyWCloudNormal 16 sur 22 end? python test * oops * bug * comment but( this is not solved https://github.com/opencv/opencv_contrib/pull/2882#discussion_r591659839 * review 2 * oversight * oversight oops * viz: move out Py* classes from public C++ headers * viz: recover PyColor Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
This commit is contained in:
@@ -52,6 +52,26 @@ int main()
|
||||
/// Rodrigues vector
|
||||
Mat rot_vec = Mat::zeros(1,3,CV_32F);
|
||||
float translation_phase = 0.0, translation = 0.0;
|
||||
|
||||
rot_vec.at<float>(0, 0) += (float)CV_PI * 0.01f;
|
||||
rot_vec.at<float>(0, 1) += (float)CV_PI * 0.01f;
|
||||
rot_vec.at<float>(0, 2) += (float)CV_PI * 0.01f;
|
||||
|
||||
/// Shift on (1,1,1)
|
||||
translation_phase += (float)CV_PI * 0.01f;
|
||||
translation = sin(translation_phase);
|
||||
|
||||
Mat rot_mat;
|
||||
Rodrigues(rot_vec, rot_mat);
|
||||
cout << "rot_mat = " << rot_mat << endl;
|
||||
/// Construct pose
|
||||
Affine3f pose(rot_mat, Vec3f(translation, translation, translation));
|
||||
Affine3f pose2(pose.matrix);
|
||||
cout << "pose = " << pose.matrix << endl;
|
||||
cout << "pose = " << pose2.matrix << endl;
|
||||
|
||||
|
||||
|
||||
while(!myWindow.wasStopped())
|
||||
{
|
||||
/* Rotation using rodrigues */
|
||||
@@ -64,13 +84,13 @@ int main()
|
||||
translation_phase += (float)CV_PI * 0.01f;
|
||||
translation = sin(translation_phase);
|
||||
|
||||
Mat rot_mat;
|
||||
Rodrigues(rot_vec, rot_mat);
|
||||
Mat rot_mat1;
|
||||
Rodrigues(rot_vec, rot_mat1);
|
||||
|
||||
/// Construct pose
|
||||
Affine3f pose(rot_mat, Vec3f(translation, translation, translation));
|
||||
Affine3f pose1(rot_mat1, Vec3f(translation, translation, translation));
|
||||
|
||||
myWindow.setWidgetPose("Cube Widget", pose);
|
||||
myWindow.setWidgetPose("Cube Widget", pose1);
|
||||
|
||||
myWindow.spinOnce(1, true);
|
||||
}
|
||||
|
Reference in New Issue
Block a user