Commit 3e41f064 authored by Anatoly Baksheev's avatar Anatoly Baksheev

removed q subfolder

parent f480eca6
#pragma once
#include <opencv2/core.hpp>
#include <opencv2/viz/types.hpp>
#include <vector>
namespace temp_viz
{
CV_EXPORTS Mesh3d::Ptr mesh_load(const String& file);
}
...@@ -67,10 +67,13 @@ namespace temp_viz ...@@ -67,10 +67,13 @@ namespace temp_viz
class CV_EXPORTS Mesh3d class CV_EXPORTS Mesh3d
{ {
public: public:
typedef cv::Ptr<Mesh3d> Ptr; typedef Ptr<Mesh3d> Ptr;
Mat cloud, colors; Mat cloud, colors;
std::vector<Vertices> polygons; std::vector<Vertices> polygons;
static Mesh3d::Ptr mesh_load(const String& file);
}; };
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
......
#include <q/common.h> #include <common.h>
#include <cstdlib> #include <cstdlib>
#include <opencv2/viz/types.hpp> #include <opencv2/viz/types.hpp>
......
#include "precomp.hpp" #include "precomp.hpp"
#include <q/interactor_style.h> #include "interactor_style.h"
//#include <q/visualization/vtk/vtkVertexBufferObjectMapper.h> //#include <q/visualization/vtk/vtkVertexBufferObjectMapper.h>
......
#pragma once #pragma once
#include <q/viz_types.h> #include "viz_types.h"
#include <opencv2/viz/events.hpp> #include <opencv2/viz/events.hpp>
namespace temp_viz namespace temp_viz
......
#include <opencv2/viz/mesh_load.hpp>
#include "precomp.hpp" #include "precomp.hpp"
#include <vtkPLYReader.h> #include <vtkPLYReader.h>
...@@ -8,7 +6,7 @@ ...@@ -8,7 +6,7 @@
#include <vtkPointData.h> #include <vtkPointData.h>
#include <vtkCellArray.h> #include <vtkCellArray.h>
temp_viz::Mesh3d::Ptr temp_viz::mesh_load(const String& file) temp_viz::Mesh3d::Ptr temp_viz::Mesh3d::mesh_load(const String& file)
{ {
Mesh3d::Ptr mesh = new Mesh3d(); Mesh3d::Ptr mesh = new Mesh3d();
......
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
#endif #endif
#include <q/viz3d_impl.hpp> #include "viz3d_impl.hpp"
#include <opencv2/core.hpp> #include <opencv2/core.hpp>
#include <opencv2/viz.hpp> #include <opencv2/viz.hpp>
#include "opencv2/viz/widget_accessor.hpp" #include "opencv2/viz/widget_accessor.hpp"
......
#include <opencv2/viz/viz3d.hpp> #include <opencv2/viz/viz3d.hpp>
#include <q/viz3d_impl.hpp> #include "viz3d_impl.hpp"
temp_viz::Viz3d::Viz3d(const String& window_name) : impl_(new VizImpl(window_name)) temp_viz::Viz3d::Viz3d(const String& window_name) : impl_(new VizImpl(window_name))
......
This diff is collapsed.
...@@ -2,17 +2,15 @@ ...@@ -2,17 +2,15 @@
#include <opencv2/core.hpp> #include <opencv2/core.hpp>
#include <opencv2/viz/events.hpp> #include <opencv2/viz/events.hpp>
#include <q/interactor_style.h> #include "interactor_style.h"
#include <q/viz_types.h> #include "viz_types.h"
#include <q/common.h> #include "common.h"
#include <opencv2/viz/types.hpp> #include <opencv2/viz/types.hpp>
#include <opencv2/core/affine.hpp> #include <opencv2/core/affine.hpp>
#include <opencv2/viz/viz3d.hpp> #include <opencv2/viz/viz3d.hpp>
namespace temp_viz
{
struct Viz3d::VizImpl struct temp_viz::Viz3d::VizImpl
{ {
public: public:
typedef cv::Ptr<VizImpl> Ptr; typedef cv::Ptr<VizImpl> Ptr;
...@@ -23,16 +21,7 @@ public: ...@@ -23,16 +21,7 @@ public:
void setFullScreen (bool mode); void setFullScreen (bool mode);
void setWindowName (const String &name); void setWindowName (const String &name);
/** \brief Register a callback function for keyboard input
* \param[in] callback function that will be registered as a callback for a keyboard event
* \param[in] cookie for passing user data to callback
*/
void registerKeyboardCallback(void (*callback)(const KeyboardEvent&, void*), void* cookie = 0); void registerKeyboardCallback(void (*callback)(const KeyboardEvent&, void*), void* cookie = 0);
/** \brief Register a callback function for mouse events
* \param[in] ccallback function that will be registered as a callback for a mouse event
* \param[in] cookie for passing user data to callback
*/
void registerMouseCallback(void (*callback)(const MouseEvent&, void*), void* cookie = 0); void registerMouseCallback(void (*callback)(const MouseEvent&, void*), void* cookie = 0);
void spin (); void spin ();
...@@ -289,6 +278,11 @@ private: ...@@ -289,6 +278,11 @@ private:
void allocVtkUnstructuredGrid (vtkSmartPointer<vtkUnstructuredGrid> &polydata); void allocVtkUnstructuredGrid (vtkSmartPointer<vtkUnstructuredGrid> &polydata);
}; };
namespace temp_viz
{
//void getTransformationMatrix (const Eigen::Vector4f &origin, const Eigen::Quaternionf& orientation, Eigen::Matrix4f &transformation); //void getTransformationMatrix (const Eigen::Vector4f &origin, const Eigen::Quaternionf& orientation, Eigen::Matrix4f &transformation);
//void convertToVtkMatrix (const Eigen::Matrix4f &m, vtkSmartPointer<vtkMatrix4x4> &vtk_matrix); //void convertToVtkMatrix (const Eigen::Matrix4f &m, vtkSmartPointer<vtkMatrix4x4> &vtk_matrix);
......
This diff is collapsed.
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
#include <string> #include <string>
#include <opencv2/viz.hpp> #include <opencv2/viz.hpp>
#include <opencv2/viz/mesh_load.hpp>
cv::Mat cvcloud_load() cv::Mat cvcloud_load()
{ {
...@@ -83,45 +82,50 @@ TEST(Viz_viz3d, accuracy) ...@@ -83,45 +82,50 @@ TEST(Viz_viz3d, accuracy)
float pos_x = 0.0f; float pos_x = 0.0f;
float pos_y = 0.0f; float pos_y = 0.0f;
float pos_z = 0.0f; float pos_z = 0.0f;
// temp_viz::Mesh3d::Ptr mesh = temp_viz::mesh_load("d:/horse.ply"); temp_viz::Mesh3d::Ptr mesh = temp_viz::Mesh3d::mesh_load("d:/horse.ply");
// v.addPolygonMesh(*mesh, "pq"); v.addPolygonMesh(*mesh, "pq");
int col_blue = 0; int col_blue = 0;
int col_green = 0; int col_green = 0;
int col_red = 0; int col_red = 0;
temp_viz::LineWidget lw(cv::Point3f(0.0,0.0,0.0), cv::Point3f(4.0,4.0,4.0), temp_viz::Color(0,255,0)); temp_viz::LineWidget lw(cv::Point3f(0.0,0.0,0.0), cv::Point3f(4.0,4.0,4.0), temp_viz::Color(0,255,0));
temp_viz::PlaneWidget pw(cv::Vec4f(0.0,1.0,2.0,3.0), 5.0); temp_viz::PlaneWidget pw(cv::Vec4f(0.0,1.0,2.0,3.0), 50.0);
temp_viz::SphereWidget sw(cv::Point3f(0,0,0), 0.5); temp_viz::SphereWidget sw(cv::Point3f(0,0,0), 0.5);
temp_viz::ArrowWidget aw(cv::Point3f(0,0,0), cv::Point3f(1,1,1), temp_viz::Color(255,0,0)); temp_viz::ArrowWidget aw(cv::Point3f(0,0,0), cv::Point3f(1,1,1), temp_viz::Color(255,0,0));
temp_viz::CircleWidget cw(cv::Point3f(0,0,0), 0.5, 0.01, temp_viz::Color(0,255,0)); temp_viz::CircleWidget cw(cv::Point3f(0,0,0), 0.5, 0.01, temp_viz::Color(0,255,0));
temp_viz::CylinderWidget cyw(cv::Point3f(0,0,0), cv::Point3f(-1,-1,-1), 0.5, 30, temp_viz::Color(0,255,0)); temp_viz::CylinderWidget cyw(cv::Point3f(0,0,0), cv::Point3f(-1,-1,-1), 0.5, 30, temp_viz::Color(0,255,0));
temp_viz::CubeWidget cuw(cv::Point3f(-2,-2,-2), cv::Point3f(-1,-1,-1)); temp_viz::CubeWidget cuw(cv::Point3f(-2,-2,-2), cv::Point3f(-1,-1,-1));
temp_viz::CoordinateSystemWidget csw(1.0f, cv::Affine3f::Identity()); temp_viz::CoordinateSystemWidget csw;
temp_viz::TextWidget tw("TEST", cv::Point2i(100,100), 20); temp_viz::TextWidget tw("TEST", cv::Point2i(100,100), 20);
temp_viz::CloudWidget pcw(cloud, colors); temp_viz::CloudWidget pcw(cloud, colors);
temp_viz::CloudWidget pcw2(cloud, temp_viz::Color(0,255,255)); temp_viz::CloudWidget pcw2(cloud, temp_viz::Color(0,255,255));
// v.showWidget("line", lw); // v.showWidget("line", lw);
// v.showWidget("plane", pw); // v.showWidget("plane", pw);
// v.showWidget("sphere", sw); v.showWidget("sphere", sw);
// v.showWidget("arrow", aw); v.spin();
// v.showWidget("circle", cw); //v.showWidget("arrow", aw);
// v.showWidget("cylinder", cyw); //v.showWidget("circle", cw);
// v.showWidget("cube", cuw); //v.showWidget("cylinder", cyw);
v.showWidget("coordinateSystem", csw); //v.showWidget("cube", cuw);
// v.showWidget("text",tw); //v.showWidget("coordinateSystem", csw);
// v.showWidget("pcw",pcw); //v.showWidget("coordinateSystem2", temp_viz::CoordinateSystemWidget(2.0), cv::Affine3f(0, 0, 0, cv::Vec3f(2, 0, 0)));
// v.showWidget("pcw2",pcw2); //v.showWidget("text",tw);
//v.showWidget("pcw",pcw);
//v.showWidget("pcw2",pcw2);
// temp_viz::LineWidget lw2 = lw; // temp_viz::LineWidget lw2 = lw;
// v.showPointCloud("cld",cloud, colors); // v.showPointCloud("cld",cloud, colors);
cv::Mat normals(cloud.size(), cloud.type(), cv::Scalar(0, 10, 0)); cv::Mat normals(cloud.size(), cloud.type(), cv::Scalar(0, 10, 0));
// v.addPointCloudNormals(cloud, normals, 100, 0.02, "n"); // v.addPointCloudNormals(cloud, normals, 100, 0.02, "n");
temp_viz::CloudNormalsWidget cnw(cloud, normals); //temp_viz::CloudNormalsWidget cnw(cloud, normals);
// v.showWidget("n", cnw); //v.showWidget("n", cnw);
// lw = v.getWidget("n").cast<temp_viz::LineWidget>(); // lw = v.getWidget("n").cast<temp_viz::LineWidget>();
// pw = v.getWidget("n").cast<temp_viz::PlaneWidget>(); // pw = v.getWidget("n").cast<temp_viz::PlaneWidget>();
...@@ -135,16 +139,18 @@ TEST(Viz_viz3d, accuracy) ...@@ -135,16 +139,18 @@ TEST(Viz_viz3d, accuracy)
data[3] = cv::Vec4d(3.0,4.0,1.0,1.0); data[3] = cv::Vec4d(3.0,4.0,1.0,1.0);
points = points.reshape(0, 2); points = points.reshape(0, 2);
temp_viz::PolyLineWidget plw(points); temp_viz::PolyLineWidget plw(points, temp_viz::Color::green());
// v.showWidget("polyline",plw); v.showWidget("polyline",plw);
// lw = v.getWidget("polyline").cast<temp_viz::LineWidget>(); // lw = v.getWidget("polyline").cast<temp_viz::LineWidget>();
temp_viz::GridWidget gw(temp_viz::Vec2i(10,10), temp_viz::Vec2d(0.1,0.1)); v.spin();
v.showWidget("grid", gw);
//temp_viz::GridWidget gw(temp_viz::Vec2i(100,100), temp_viz::Vec2d(1,1));
//v.showWidget("grid", gw);
lw = v.getWidget("grid").cast<temp_viz::LineWidget>(); lw = v.getWidget("grid").cast<temp_viz::LineWidget>();
temp_viz::Text3DWidget t3w("OpenCV", cv::Point3f(0.0, 2.0, 0.0), 1.0, temp_viz::Color(255,255,0)); //temp_viz::Text3DWidget t3w("OpenCV", cv::Point3f(0.0, 2.0, 0.0), 1.0, temp_viz::Color(255,255,0));
v.showWidget("txt3d", t3w); //v.showWidget("txt3d", t3w);
// float grid_x_angle = 0.0; // float grid_x_angle = 0.0;
while(!v.wasStopped()) while(!v.wasStopped())
...@@ -156,7 +162,7 @@ TEST(Viz_viz3d, accuracy) ...@@ -156,7 +162,7 @@ TEST(Viz_viz3d, accuracy)
lw.setColor(temp_viz::Color(col_blue, col_green, col_red)); lw.setColor(temp_viz::Color(col_blue, col_green, col_red));
// lw.setLineWidth(pos_x * 10); // lw.setLineWidth(pos_x * 10);
plw.setColor(temp_viz::Color(col_blue, col_green, col_red)); //plw.setColor(temp_viz::Color(col_blue, col_green, col_red));
sw.setPose(cloudPosition); sw.setPose(cloudPosition);
// pw.setPose(cloudPosition); // pw.setPose(cloudPosition);
...@@ -172,10 +178,10 @@ TEST(Viz_viz3d, accuracy) ...@@ -172,10 +178,10 @@ TEST(Viz_viz3d, accuracy)
// v.setWidgetPose("n",cloudPosition); // v.setWidgetPose("n",cloudPosition);
// v.setWidgetPose("pcw2", cloudPosition); // v.setWidgetPose("pcw2", cloudPosition);
cnw.setColor(temp_viz::Color(col_blue, col_green, col_red)); //cnw.setColor(temp_viz::Color(col_blue, col_green, col_red));
pcw2.setColor(temp_viz::Color(col_blue, col_green, col_red)); //pcw2.setColor(temp_viz::Color(col_blue, col_green, col_red));
gw.updatePose(temp_viz::Affine3f(0.0, 0.1, 0.0, cv::Vec3f(0.0,0.0,0.0))); //gw.updatePose(temp_viz::Affine3f(0.0, 0.1, 0.0, cv::Vec3f(0.0,0.0,0.0)));
angle_x += 0.1f; angle_x += 0.1f;
angle_y -= 0.1f; angle_y -= 0.1f;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment