Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Qt+OSG 3D Point Cloud engine

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Qt+OSG 3D point cloud engine example analysis, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

OSG and OsgEarth 3D Development column

Demand

   develops 3D point cloud engine module based on osg. 1. Based on the x ~ (th) ~ (th) y ~ (th) z axis two。 The origin can be set and the scale can be set. 3. Y-axis and z-axis units can be set. 4. Among the three axes, the XY is the horizontal and vertical direction of the 2D map, and the Z axis corresponds to the height of the double shape in the height map. 5. The engine center can be set. 6. The center point of the engine can be set and the model can be rotated by dragging and dragging around the center point. 7. You can rotate the engine center point around the XMagi Y Z axis alone, and rotate when dragging. 8. You can combine XY,XZ,YZ axis rotation and rotate when dragging. 9. The point cloud is rendered according to the input bmp picture and the modeling txt height file. 10. Can reset the coordinate system, can clearly import the point cloud.

Complimentary function:

11. Support the import of pictures, random height for point cloud simulation. twelve。 Support for importing cvs point cloud files (currently only points are parsed).

Experience the download address

   CSDN points-free download address: https://download.csdn.net/download/qq21497936/16388051    QQ group download address: 1047134658 (click "File" to search for "osg3D", update synchronously with blog posts in the group)

Demo

     

Demo partial source code # ifndef OSGWIDGET_H#define OSGWIDGET_H/***\ * control name: osg3D point cloud customization * control description: * 1. Basic 3D frame * 2. The center point can be set * 3. Press the middle mouse button to move the center point * 4. Support to import bmp,bmp+z files, cvs point cloud files * 5. Support for emptying data Reset perspective and other operations * author: red Imitation contact: QQ21497936 * blog address: https://blog.csdn.net/qq21497936 * copyright Information * author: red Fatty (AAA Red Imitation) * Company: Changsha Red Fatty Network Technology Co., Ltd. * blog expert address: blog.csdn.net/qq21497936/article/details/102478062 * contact information : QQ (21497936) Wechat (yangsir198808) * version information * date version description *... * April 02, 2021 v2.0.0 3D point cloud import XYZ fixed rotation, reset, emptying import file format supports importing bmp, customized bmp+z,cvs file\ * * / # include # include "OsgViewerWidget.h" # include "MyManipulator.h" class AnimationPathCameraMainpulator Namespace Ui {class OsgWidget;} class OsgWidget: public QWidget {Q_OBJECTpublic: explicit OsgWidget (QWidget * parent = 0); ~ OsgWidget (); public: bool getFixXAxis () const; void setFixXAxis (bool fixXAxis); bool getFixYAxis () const; void setFixYAxis (bool fixYAxis); bool getFixZAxis () const; void setFixZAxis (bool fixZAxis); public: bool loadFile (QString imageFile, int minZ, int maxZ); bool loadFile (QString imageFile, float z); bool loadFile (QString imageFile, QString cloudZFile) Bool loadFile (QString cvsFile, QColor color); void clear (); void resetCoordinate (); protected: void initOsg (); / / osg initializes void loadNode (osg::ref_ptr pNode); / / loads the scene root node protected: osg::ref_ptr create3DPointCloud (); / / creates a total scene osg::ref_ptr createAxisAndGrid () / / create axis and grid osg::ref_ptr createTickLabel (); / create axis tickLabel and unit osg::ref_ptr createCloud (std::vector & vectorVec3Vectex, std::vector & vectorVec4VectexColor); / / create point cloud protected: void resizeEvent (QResizeEvent * event) Void keyPressEvent (QKeyEvent* event); void keyReleaseEvent (QKeyEvent* event); void mousePressEvent (QMouseEvent* event); void mouseReleaseEvent (QMouseEvent* event); void mouseDoubleClickEvent (QMouseEvent* event); void mouseMoveEvent (QMouseEvent* event); void wheelEvent (QWheelEvent* event); private: Ui::OsgWidget * ui;private: OsgViewerWidget * _ pViewer; / / osg scene embedded Qt core class osg::ref_ptr _ pRoot / / osg scene root node private: float _ xDistance; / / x-axis single tick spacing int _ xTickNumber; / / x-axis tick number (for example: 6 when 5, 0mm 5) float _ yDistance; / / y-axis single tick spacing int _ yTickNumber / / number of tick on y axis (for example, 6 at 5) float _ zDistance; / / z axis single tick spacing int _ zTickNumber; / / number of tick on z axis (for example: 6 at 5, 0 at 5) QString _ zUnit / / z axis unit float _ zTickLabelOffset; / / z axis coordinate offset QString _ yUnit; / / y axis unit float _ zTickUnitLabelOffset; / / z axis coordinate offset QColor _ gridColor; / / axis color QColor _ labelColor / / Color osg::ref_ptr _ pNode; / / Model osg::ref_ptr _ pManipulator; / / Custom rover osg::Vec3d _ eyeVect3D; / / original coordinates of the axis tickLabel, used to reset the original viewing angle osg::Vec3d _ centerVect3D / / original coordinates, used to reset the original viewing angle osg::Vec3d _ upVect3D; / / original coordinates, used to reset the original viewing angle}; # endif / / OSGWIDGET_H

After reading the above, have you mastered the method of example analysis of Qt+OSG 3D point cloud engine? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report