opencv学习(一) 作者: BeefLiu 时间: 2026-04-07 分类: 编程记录,C++ 评论 图像创建 CV_8UC1 : 8位无符号单通道(灰度图) CV_8UC3 : 8位无符号三通道(彩色图,BGR顺序) CV_32FC1 : 32位浮点单通道(用于深度图、特征图等) CV_8UC4 : More...
nlohmann::json使用 作者: BeefLiu 时间: 2026-04-03 分类: 编程记录,C++ 评论 #include <nlohmann/json.hpp> #include <iostream> #include <string> struct Person { std::string name; std::string More...
遍历数组 作者: BeefLiu 时间: 2026-03-08 分类: 编程记录,C++ 评论 1、C-Style for(size_t i =0; i < players.size(); i++) { if(players[i].hp == 0.f) players[i].hp = 100.f; } 2、C++11 for(auto& playe More...
c++计算两点之间的角度 作者: BeefLiu 时间: 2026-03-04 分类: 编程记录,C++ 评论 给定两个点,计算两点相对于正北方的角度 double calAngle(const cv::Point& start, const cv::Point& end) { // 计算两点在X、Y轴上的差值 double dx = end.x - start.x; More...
c++传统指针的问题 作者: BeefLiu 时间: 2026-02-28 分类: 编程记录,C++ 评论 传统指针的问题 传统指针可能会导致内存泄漏、重复释放和一场安全问题,进而导致程序奔溃: #include <iostream> using namespace std; class Resource { private: string name; More...