diff --git a/modules/viz/include/opencv2/viz/viz3d.hpp b/modules/viz/include/opencv2/viz/viz3d.hpp index 3a861eeff..046b9dc4d 100644 --- a/modules/viz/include/opencv2/viz/viz3d.hpp +++ b/modules/viz/include/opencv2/viz/viz3d.hpp @@ -26,8 +26,8 @@ namespace temp_viz void setBackgroundColor(const Color& color = Color::black()); void addCoordinateSystem(double scale, const Affine3f& t, const String &id = "coordinate"); - - void showPointCloud(const String& id, InputArray cloud, InputArray colors, const Affine3f& pose = Affine3f::Identity()); + + void showPointCloud(const String& id, InputArray cloud, InputArray colors, const Affine3f& pose = Affine3f::Identity()); bool addPointCloudNormals (const Mat &cloud, const Mat& normals, int level = 100, float scale = 0.02f, const String &id = "cloud"); @@ -51,10 +51,11 @@ namespace temp_viz void spin (); void spinOnce (int time = 1, bool force_redraw = false); - - void registerKeyboardCallback(void (*callback)(const cv::KeyboardEvent&, void*), void* cookie = 0); - void registerMouseCallback(void (*callback)(const cv::MouseEvent&, void*), void* cookie = 0); + void registerKeyboardCallback(void (*callback)(const cv::KeyboardEvent&, void*), void* cookie = 0); + void registerMouseCallback(void (*callback)(const cv::MouseEvent&, void*), void* cookie = 0); + + bool wasStopped() const; private: Viz3d(const Viz3d&); Viz3d& operator=(const Viz3d&); diff --git a/modules/viz/src/viz3d.cpp b/modules/viz/src/viz3d.cpp index e06c85ca0..68fcf4870 100644 --- a/modules/viz/src/viz3d.cpp +++ b/modules/viz/src/viz3d.cpp @@ -96,4 +96,6 @@ void temp_viz::Viz3d::registerKeyboardCallback(void (*callback)(const cv::Keyboa void temp_viz::Viz3d::registerMouseCallback(void (*callback)(const cv::MouseEvent&, void*), void* cookie) { impl_->registerMouseCallback(callback, cookie); -} \ No newline at end of file +} + +bool temp_viz::Viz3d::wasStopped() const { return impl_->wasStopped(); } diff --git a/modules/viz/test/test_viz3d.cpp b/modules/viz/test/test_viz3d.cpp index e72ef7598..3214a8179 100644 --- a/modules/viz/test/test_viz3d.cpp +++ b/modules/viz/test/test_viz3d.cpp @@ -90,7 +90,7 @@ TEST(Viz_viz3d, accuracy) v.addPolygonMesh(*mesh, "pq"); - while(1) //TODO implement and replace with !viz.wasStopped() + while(!v.wasStopped()) { // Creating new point cloud with id cloud1 cv::Affine3f cloudPosition(angle_x, angle_y, angle_z, cv::Vec3f(pos_x, pos_y, pos_z)); @@ -103,7 +103,7 @@ TEST(Viz_viz3d, accuracy) pos_y = std::sin(angle_x); pos_z = std::sin(angle_x); - v.spinOnce(10); + v.spinOnce(1, true); } // cv::Mat normals(cloud.size(), CV_32FC3, cv::Scalar(0, 10, 0));