随笔分类 - C++
摘要:class MyClass { public: void func1() { // 实现 } void func2() { // 实现 } // 成员函数指针类型 typedef void (MyClass::*MemberFuncPtr)(); // 一个成员函数指针成员变量 MemberFunc
阅读全文
摘要:Livox mid70雷达 c++ SDK 官方demo能正常调用,但封装后回调函数错误 ###########################
阅读全文
摘要:test c++ #include <iostream> using namespace std; int main() { char myChar[6] = { 'H', 'e', 'l', 'l', 'o', '\0' }; //char* pointer = myChar; //WORKS!!
阅读全文
摘要:QTcpSocket socket; // 连接到远程主机 socket.connectToHost("remoteHost", 1234); // 获取连接状态 QAbstractSocket::SocketState socketState = socket.state(); // 根据连接状态
阅读全文
摘要:osg qt场景中节点的透明属性消除 { osg::ref_ptr<osg::StateSet> stateState = north_wall_geode->getOrCreateStateSet(); stateState->setMode(GL_BLEND, osg::StateAttribu
阅读全文
摘要:#include <opencv2/opencv.hpp> int main() { // 读取图像 cv::Mat image = cv::imread("image.jpg"); // 获取图像的行数和列数 int rows = image.rows; int cols = image.cols
阅读全文
摘要:QVBoxLayout添加图片 #include <QApplication> #include <QWidget> #include <QVBoxLayout> #include <QLabel> #include <QImage> #include <QPixmap> int main(int
阅读全文
摘要:#include <QApplication> #include <QLineEdit> #include <QDoubleValidator> int main(int argc, char *argv[]) { QApplication app(argc, argv); QLineEdit li
阅读全文
摘要:#include <QApplication> #include <QLineEdit> #include <QIntValidator> int main(int argc, char *argv[]) { QApplication app(argc, argv); QLineEdit lineE
阅读全文
摘要:#include <opencv2/opencv.hpp> int main() { // 创建一个空的图片,宽度为500像素,高度为500像素,通道数为3(RGB),数据类型为8位无符号整数 cv::Mat image = cv::Mat::zeros(500, 500, CV_8UC3); //
阅读全文
摘要:osg给节点添加材质 #include <osg/Material> #include <osg/Geode> #include <osgDB/ReadFile> #include <osgViewer/Viewer> int main(){ // 创建一个场景节点 osg::ref_ptr<osg
阅读全文
摘要:osg绘制粗线条 #include <osg/Geometry> #include <osg/Geode> #include <osgViewer/Viewer> #include <osg/LineWidth> int main() { // 创建几何体对象 osg::ref_ptr<osg::G
阅读全文
摘要:C++ opencv计算两个cv::Rect的重复面积 #include <opencv2/opencv.hpp> #include <iostream> int main() { // 创建两个矩形 cv::Rect rect1(10, 10, 50, 50); // (x, y, width,
阅读全文
摘要:#include <osg/Material> #include <osg/Geode> #include <osgDB/ReadFile> #include <osgViewer/Viewer> int main() { // 创建一个场景节点 osg::ref_ptr<osg::Node> ro
阅读全文
摘要:opencv转qimage #include <opencv2/opencv.hpp> #include <QImage> #include <QColor> QImage MatToQImage(const cv::Mat &mat) { // 获取图像尺寸和通道数 int width = mat
阅读全文
摘要:osg::ref_ptr<osg::Node> root = ...; // 获取场景根节点 // 遍历场景图并删除所有节点 osg::Node::Children::iterator it; for (it = root->getChildren().begin(); it != root->ge
阅读全文
摘要:#include <QTcpSocket> #include <QDataStream> #include <QByteArray> void sendObjectList(QTcpSocket *socket, const QList<QObject *> &objectList) { QByte
阅读全文
摘要:#include <opencv2/opencv.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> using namespace cv; int main(int argc, cha
阅读全文
摘要:QMap深度拷贝 #include <QMap> #include <QPair> #include <QDebug> QMap<int, QString> deepCopyQMap(const QMap<int, QString>& source) { QMap<int, QString> tar
阅读全文
摘要:osg设置节点材质 #include <osg/Geode> #include <osg/Material> #include <osgDB/ReadFile> int main() { // 创建一个 Geode 对象 osg::ref_ptr<osg::Geode> geode = new os
阅读全文