pcl--第十二节 2D和3D融合和手眼标定

2D&3D融合

概述

截止目前为止,我们学习了机器人学,学习了2D和3D视觉算法。我们也学习了2D相机(图像数据的来源)和3D相机(点云数据的来源)工作原理。

实际上,我们最终要做的,是一个手眼机器人系统。在这个系统里,相机与机器人构成了两个非常关键的部分,它们之间需要密切配合,因此,它们之间的关系,也就非常重要。确定相机与机器人之间的关系,这是手眼标定要解决的问题。

另一方面,在很多场合,为了增强算法的鲁棒性,我们通常同时使用图像数据与点云数据,这又涉及到2D与3D配准的问题。

相机配准

  • 方式一:

通过双重循环遍历

/*** 将彩色图和深度图合并成点云* @param matrix 相机内参矩阵3x3* @param rgb    彩色图* @param depth  深度图* @param cloud  输出点云*/
static void convert(Mat &matrix, Mat &rgb, Mat &depth, PointCloud::Ptr &cloud) {double camera_fx = matrix.at<double>(0, 0);double camera_fy = matrix.at<double>(1, 1);double camera_cx = matrix.at<double>(0, 2);double camera_cy = matrix.at<double>(1, 2);cout << "fx: " << camera_fx << endl;cout << "fy: " << camera_fy << endl;cout << "cx: " << camera_cx << endl;cout << "cy: " << camera_cy << endl;// 遍历深度图for (int v = 0; v < depth.rows; v++)for (int u = 0; u < depth.cols; u++) {// 获取深度图中(m,n)处的值ushort d = depth.ptr<ushort>(v)[u];// d 可能没有值,若如此,跳过此点if (isnan(d) && abs(d) < 0.0001)continue;// d 存在值,则向点云增加一个点PointT p;// 计算这个点的空间坐标p.z = double(d) / 1000; //单位是米p.x = (u - camera_cx) * p.z / camera_fx;p.y = (v - camera_cy) * p.z / camera_fy;// 从rgb图像中获取它的颜色// rgb是三通道的BGR格式图,所以按下面的顺序获取颜色Vec3b bgr = rgb.at<Vec3b>(v, u);p.b = bgr[0];p.g = bgr[1];p.r = bgr[2];// 把p加入到点云中cloud->points.push_back(p);//cout << cloud->points.size() << endl;}// 设置并保存点云cloud->height = 1;cloud->width = cloud->points.size();cout << "point cloud size = " << cloud->points.size() << endl;cloud->is_dense = false;
}
int main(){cv::Mat cameraMatrix; // 从文件加载相机内参cv::Mat rgb;         // 从相机得到RGB彩色图cv::Mat depth;       // 从相机得到depth深度图PointCloud::Ptr pCloud = PointCloud::Ptr(new PointCloud);convert(cameraMatrix, rgb, depth, pCloud);
}
  • 方式二:

通过指针遍历,并提前准备好计算矩阵

#include <iostream>
#include <opencv2/opencv.hpp>
#include <sstream>
#include <cstdlib>
#include <pcl/io/io.h>using namespace std;
using namespace cv;float qnan_ = std::numeric_limits<float>::quiet_NaN();
const char *cameraInCailFile = "./assets/3DCameraInCailResult.xml";Eigen::Matrix<float, 1920, 1> colmap;
Eigen::Matrix<float, 1080, 1> rowmap;
//const short w = 512, h = 424;
const short w = 1920, h = 1080;void prepareMake3D(const double cx, const double cy,const double fx, const double fy) {float *pm1 = colmap.data();float *pm2 = rowmap.data();for (int i = 0; i < w; i++) {*pm1++ = (i - cx + 0.5) / fx;}for (int i = 0; i < h; i++) {*pm2++ = (i - cy + 0.5) / fy;}
}
/*** 根据内参,合并RGB彩色图和深度图到点云* @param cloud* @param depthMat* @param rgbMat*/
void getCloud(pcl::PointCloud<pcl::PointXYZRGB>::Ptr &cloud, Mat &depthMat, Mat &rgbMat) {const float *itD0 = (float *) depthMat.ptr();const char *itRGB0 = (char *) rgbMat.ptr();if (cloud->size() != w * h)cloud->resize(w * h);pcl::PointXYZRGB *itP = &cloud->points[0];bool is_dense = true;for (size_t y = 0; y < h; ++y) {const unsigned int offset = y * w;const float *itD = itD0 + offset;const char *itRGB = itRGB0 + offset * 4;const float dy = rowmap(y);for (size_t x = 0; x < w; ++x, ++itP, ++itD, itRGB += 4) {const float depth_value = *itD / 1000.0f;if (!isnan(depth_value) && abs(depth_value) >= 0.0001) {const float rx = colmap(x) * depth_value;const float ry = dy * depth_value;itP->z = depth_value;itP->x = rx;itP->y = ry;itP->b = itRGB[0];itP->g = itRGB[1];itP->r = itRGB[2];} else {itP->z = qnan_;itP->x = qnan_;itP->y = qnan_;itP->b = qnan_;itP->g = qnan_;itP->r = qnan_;is_dense = false;}}}cloud->is_dense = is_dense;
}int main(){Mat cameraMatrix = cv::Mat_<double>(3, 3);FileStorage paramFs(cameraInCailFile, FileStorage::READ);paramFs["cameraMatrix"] >> cameraMatrix;// 内参数据double fx = cameraMatrix.at<double>(0, 0);double fy = cameraMatrix.at<double>(1, 1);double cx = cameraMatrix.at<double>(0, 2);double cy = cameraMatrix.at<double>(1, 2);// 提前准备计算所需参数prepareMake3D(cx, cy, fx, fy);cv::Mat rgbMat;      // 从相机得到RGB彩色图cv::Mat depthMat;        // 从相机得到depth深度图pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGB>());getCloud(cloud, depthMat, rgbMat)
}

手眼标定(外参标定) 

一、手眼标定的原理

图例说明:

  • {b}:base基座标系
  • {g}:gripper抓手坐标系
  • {t}:target标定板坐标系
  • {c}:camera相机坐标系

 

 

二、手眼标定的操作¶

  1. 将标定板固定在机械臂末端
  2. 开启机械臂,开启摄像头
  3. 在距离摄像头40、60、80cm的距离上,在摄像头可见范围内,使用各种角度各拍照15-20张照片,一共45-60张。
  4. 同时保存照片以及对应拍照时机械臂位姿
  5. 准备好之前标定的相机内参
  6. 执行手眼标定API,得到相机在基坐标系的表达(旋转矩阵R+平移向量t)

三、自己动手实现手眼标定及验证¶

  • 从文件及图片读取照片
// Created by poplar on 19-7-25.
#include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/calib3d.hpp>#include "boost/filesystem.hpp"   // includes all needed Boost.Filesystem declarations
#include <boost/algorithm/string/predicate.hpp>
#include <opencv2/imgcodecs.hpp>#include "tinyxml/tinyxml2.h"
#include <map>// Eigen 部分
#include <Eigen/Core>
// 稠密矩阵的代数运算(逆,特征值等)
#include <Eigen/Dense>
// Eigen 几何模块
#include <Eigen/Geometry>#include <rw/math/Rotation3D.hpp>
#include <rw/math/Vector3D.hpp>
#include <rw/math/RPY.hpp>#include <opencv/cxeigen.hpp>
#include <opencv/cv.hpp>
#include "utils/Rotation3DUtils.h"using namespace boost::filesystem;          // for ease of tutorial presentation;
//  a namespace alias is preferred practice in real codeusing namespace tinyxml2;
using namespace Eigen;
using namespace cv;
using namespace std;using namespace rw::math;// Eigen
// OpenCV
// RobWorkconst string prefix_path = "/home/ty/Workspace/Robot/calibration-single";
const string intrinsicsPath = prefix_path + "/CaliResult/3DCameraInCailResult.xml";const string pic_dir_path = prefix_path + "/ImageFromCamera";
const string exten = "bmp";
const string extrinsic_params = prefix_path + "/extrinsic_input_param.xml";
// const string extrinsic_params = "/home/poplar/Lesson/Cobot/Aubo/calibration-single/extrinsic_input_param_t.xml";const string exCailFilePath = prefix_path + "/CaliResult/3DCameraExCailResult.xml";enum Pattern {CHESSBOARD, CIRCLES_GRID, ASYMMETRIC_CIRCLES_GRID
};void printPose(const vector<double> &pose);void calcChessboardCorners(const Size &boardSize, float squareSize, vector<Point3f> &corners,Pattern patternType = CHESSBOARD) {corners.resize(0);switch (patternType) {case CHESSBOARD:case CIRCLES_GRID:for (int i = 0; i < boardSize.height; i++)      // 9for (int j = 0; j < boardSize.width; j++)   // 6corners.emplace_back(float(j * squareSize),float(i * squareSize), 0);break;case ASYMMETRIC_CIRCLES_GRID:for (int i = 0; i < boardSize.height; i++)for (int j = 0; j < boardSize.width; j++)corners.emplace_back(float((2 * j + i % 2) * squareSize),float(i * squareSize), 0);break;default:CV_Error(Error::StsBadArg, "Unknown pattern type\n");}
}/*** 通过图片集合 填充 旋转矩阵&平移矩阵* @param R_target2cam* @param t_target2cam* @param imgPaths*/
bool fillFromImages(vector<Mat> &R_target2cam, std::vector<Mat> &t_target2cam, std::vector<path> &imgPaths) {const Size patternSize(6, 9);const float squareSize = 20;//! [compute-poses]std::vector<Point3f> objectPoints;
//  [
//       [0, 0 , 0]
//       [0, 20, 0]
//       [0, 40, 0]
//       ...
//       [20, 0, 0]
//       ...
//  ]calcChessboardCorners(patternSize, squareSize, objectPoints);// 通过内参进行矫正// 检测角点// 计算变换矩阵(旋转矩阵+平移矩阵)cv::FileStorage fs(intrinsicsPath, FileStorage::READ);Mat cameraMatrix, distCoeffs;fs["cameraMatrix"] >> cameraMatrix;fs["distCoeffs"] >> distCoeffs;// 遍历图片for (const auto &path: imgPaths) {const string &s_path = path.string();
//        std::cout << s_path << std::endl;const Mat &img_mat = imread(s_path, IMREAD_UNCHANGED);// 查找图片所有角点std::vector<Point2f> corners;bool isFound = cv::findChessboardCorners(img_mat, patternSize, corners);if (!isFound) {std::cerr << "Image not found corners: " << s_path << std::endl;return false;}
//        std::cout << corners.size() << std::endl;cv::Mat rvec = cv::Mat::zeros(3, 1, CV_64FC1);cv::Mat tvec = cv::Mat::zeros(3, 1, CV_64FC1);// solveP3P// 根据://      objectPoints(角点行列信息&大小信息)//      corners所有角点信息//      内参// 得到://      旋转向量,平移向量solvePnP(objectPoints, corners, cameraMatrix, distCoeffs, rvec, tvec);//        raux.convertTo(Rvec, CV_32F);    //旋转向量
//        taux.convertTo(Tvec, CV_32F);   //平移向量Mat R; // 旋转矩阵 <-> 旋转向量// Transforms Rotation Vector to MatrixRodrigues(rvec, R); //  solvePnP返回的是旋转向量,故用罗德里格斯变换变成旋转矩阵cout << "rotation vector rvec =\n" << rvec << endl;cout << "rotation R =\n" << R << endl;cout << "translation vector tvec =\n" << tvec << std::endl;const Vec3f &oulerAngles = rotationMatrixToEulerAngles(R);std::cout << "oulerAngles = \n" << oulerAngles * RA2DE << std::endl; // zyx (RPY)
//        Rotation3D<double> rot(R);std::cout << "Image path: " << s_path << std::endl;R_target2cam.push_back(R);
//        t_target2cam.push_back(tvec);t_target2cam.push_back(tvec / 1000);//        const Mat &img_mat = imread(s_path, IMREAD_UNCHANGED);
//        Mat smallImg;
//        resize( img_mat, smallImg, Size(), 0.5, 0.5, INTER_LINEAR_EXACT);
//        cv::imshow("img_chess", smallImg);
//        std::cout << s_path << std::endl;
//        waitKey(0);}return true;}/*** 求齐次矩阵的逆矩阵* @param T* @return*/
static Mat homogeneousInverse(const Mat &T) {CV_Assert(T.rows == 4 && T.cols == 4);Mat R = T(Rect(0, 0, 3, 3));Mat t = T(Rect(3, 0, 1, 3));Mat Rt = R.t();Mat tinv = -Rt * t;Mat Tinv = Mat::eye(4, 4, T.type());Rt.copyTo(Tinv(Rect(0, 0, 3, 3)));tinv.copyTo(Tinv(Rect(3, 0, 1, 3)));return Tinv;
}/*** 外参标定** 输入:*      60组:t2c*          标定板在相机坐标系的表达(标定板到相机的转换矩阵->旋转矩阵R+平移向量t)*          内参(用于求相机在标定板坐标系的表达)**      60组:b2g  (g2b求逆)*          末端gripper的x,y,z,r,p,y-> 旋转矩阵R+平移向量t, 笛卡尔(RPY转旋转矩阵)*          求逆(转置),正交矩阵两个计算结果一致** 输出:*      外参 :*          相机在Base坐标系的表达 (轴角对+平移向量t) (旋转矩阵R+平移向量t)** 验证:*      通过现有图片及标定结果进行验证* @return*/
int main() {// 相机坐标系下标定板(目标)的表达 (通过 彩图&深度图&内参 获得) ---------------1std::vector<Mat> R_target2cam, t_target2cam;// 读取照片&深度图if (!exists(pic_dir_path)) {std::cout << pic_dir_path << " not exist" << std::endl;return 0;}int counter{0};// 将所有外参标定的照片路径存到imgPathsvector<path> imgPaths;directory_iterator end_itr;for (directory_iterator itr(pic_dir_path); itr != end_itr; ++itr) {if (!is_directory(itr->status())) {path file_path = itr->path();const path &filename = file_path.filename();if (boost::starts_with(filename.string(), "raw_color_extrinsic_pose")) {
//                std::cout << filename.string() << std::endl;imgPaths.push_back(file_path);//                counter++;
//                if (counter >= 5){
//                    break;
//                }}}}// 通过识别图像及角点,得到相机到标定板的变换矩阵 (内参)bool rst = fillFromImages(R_target2cam, t_target2cam, imgPaths);if (!rst) {return -1;}std::cout << "R_target2cam: " << R_target2cam.size() << std::endl;std::cout << "t_target2cam: " << t_target2cam.size() << std::endl;std::cout << " --------------------------------------------- 相机坐标系下标定板(目标)的表达 OK -------------------------------------------- ↑" << std::endl;// 基坐标Base下末端TCP(gripper)的表达 (通过设备获得) ---------------2std::vector<Mat> R_gripper2base, t_gripper2base;// 轴角对&平移 -> 旋转矩阵&平移矩阵XMLDocument doc;doc.LoadFile(extrinsic_params.c_str());XMLElement *root = doc.RootElement();XMLElement *extrinsics = root->FirstChildElement("extrinsic");map<std::string, vector<double>> map;while (extrinsics) {const char *image_path = extrinsics->FirstChildElement("Limage_color_path")->GetText();string img_path = std::string(image_path);string img_name = img_path.substr(img_path.find_last_of('/') + 1, -1);// std::cout << image_path << " name: " << img_name << std::endl;double pose1 = atof(extrinsics->FirstChildElement("pose1")->GetText());double pose2 = atof(extrinsics->FirstChildElement("pose2")->GetText());double pose3 = atof(extrinsics->FirstChildElement("pose3")->GetText());double pose4 = atof(extrinsics->FirstChildElement("pose4")->GetText());double pose5 = atof(extrinsics->FirstChildElement("pose5")->GetText());double pose6 = atof(extrinsics->FirstChildElement("pose6")->GetText());vector<double> pose{pose1, pose2, pose3, pose4, pose5, pose6};// 字典map保存的图片文件名及对应的=位姿map[img_name] = pose;extrinsics = extrinsics->NextSiblingElement();}// 将对应图片的机械臂笛卡尔空间坐标pose转成 旋转矩阵+平移矩阵for (const path &p: imgPaths) {std::string f_name = p.filename().string();try {// 取出每个图片对应的位姿vector<double> &pose = map.at(f_name);if (pose.empty()) {std::cerr << "pose empty" << std::endl;return -1;}
//            std::cout << f_name << " -> ";printPose(pose);cv::Vec3f eulerAngles(pose[3],pose[4],pose[5]);const Mat &R = eulerAnglesToRotationMatrix(eulerAngles);cout << "rotation matrix3 eulerAngles =\n" << eulerAngles << endl;cout << "rotation matrix3 R =\n" << R << endl;cv::Mat t = (cv::Mat_<double>(3,1) << pose[0], pose[1], pose[2]);cout << "translation matrix3 t =\n" << t << endl;R_gripper2base.push_back(R);
//            t_gripper2base.push_back(t);t_gripper2base.push_back(t / 1000);//            const string &s_path = p.string();
//            const Mat &img_mat = imread(s_path, IMREAD_UNCHANGED);
//            Mat smallImg;
//            resize( img_mat, smallImg, Size(), 0.5, 0.5, INTER_LINEAR_EXACT);
//            cv::imshow("img_chess", smallImg);
//            std::cout << s_path << std::endl;
//            waitKey(0);} catch (const std::out_of_range &e) {std::cerr << f_name << " was not found." << std::endl;}}std::cout << " --------------------------------------------- 基坐标Base下末端TCP(gripper)的表达 -------------------------------------------- ↑" << std::endl;//    return 0;//    std::cout << map["raw_color_extrinsic_pose_07_26_17_01_59_965.bmp"].size()<< std::endl;// TCP坐标系下基坐标的表达std::vector<Mat> R_base2gripper, t_base2gripper;// 转换成逆矩阵unsigned long size = R_gripper2base.size();R_base2gripper.reserve(size);t_base2gripper.reserve(size);for (size_t i = 0; i < size; i++) {// 获取每个抓手的姿态(旋转矩阵)Mat R = R_gripper2base[i];Mat Rt = R.t(); // 转置R_base2gripper.push_back(Rt);// 获取每个抓手的位置Mat t = t_gripper2base[i];Mat tinv = -Rt * t;t_base2gripper.push_back(tinv);cout << "base2gripper Rt=\n" << Rt << endl;cout << "base2gripper tinv =\n" << tinv << endl;}std::cout << " --------------------------------------------- 末端TCP坐标下Base的表达 -------------------------------------------- ↑" << std::endl;std::cout << R_target2cam.size()   << ":" << t_target2cam.size()   << '\n' <<R_base2gripper.size() << ":" << t_base2gripper.size() << std::endl;std::cout << "---------------------calibrateHandEye start !---------------------" << std::endl;// 求Base基坐标下相机Cam的表达Mat R_cam2base_est, t_cam2base_est;// 进行手眼标定(外参)cv::calibrateHandEye(R_base2gripper,  t_base2gripper,R_target2cam,    t_target2cam,R_cam2base_est,  t_cam2base_est,HandEyeCalibrationMethod::CALIB_HAND_EYE_DANIILIDIS);cout << "旋转矩阵 est: \n" << R_cam2base_est << endl;cout << "平移矩阵 est: \n" << t_cam2base_est * 1000 << endl;double angle = 0;double axisX = 0;double axisY = 0;double axisZ = 0;double translationX = 0;double translationY = 0;double translationZ = 0;// 使用opencv读取文件cv::FileStorage fs(exCailFilePath, cv::FileStorage::READ);fs["Angle"] >> angle;fs["AxisX"] >> axisX;fs["AxisY"] >> axisY;fs["AxisZ"] >> axisZ;fs["TranslationX"] >> translationX;fs["TranslationY"] >> translationY;fs["TranslationZ"] >> translationZ;// 轴角对Vector3d axisMatrix(axisX, axisY, axisZ);AngleAxisd angleAxisd(angle, axisMatrix);// 获取旋转矩阵const Eigen::AngleAxis<double>::Matrix3 &rotationMatrix = angleAxisd.toRotationMatrix();
//    cout << "旋转矩阵e:" << rotationMatrix << endl;// 获取平移矩阵Vector3d t_cam2base_eigen(translationX, translationY, translationZ);// 获取输出结果
//    cout << "平移向量e:" << t_cam2base_eigen << endl;// 真实值,eigen转成cvcv::Mat_<double> R_cam2base_true(3, 3);cv::eigen2cv(rotationMatrix,R_cam2base_true);cv::Mat_<double> t_cam2base_true(3, 1);cv::eigen2cv(t_cam2base_eigen,t_cam2base_true);cout << "旋转矩阵 true: \n" << R_cam2base_true << endl;cout << "平移矩阵 true: \n" << t_cam2base_true << endl;// 估算的 旋转矩阵->旋转向量
//    Mat rvec_cam2base_est;
//    cv::Rodrigues(R_cam2base_est, rvec_cam2base_est);// 真实的 旋转矩阵->旋转向量
//    Mat rvec_cam2base_true;
//    cv::Rodrigues(R_cam2base_true, rvec_cam2base_true);
//    cout << "旋转矩阵 est: \n" << rvec_cam2base_est << endl;
//    cout << "平移向量 est: \n" << t_cam2base_true << endl;//    double rvecDiff = norm(rvec_cam2base_true, rvec_cam2base_est, NormTypes::NORM_L2);
//    double tvecDiff = norm(t_cam2base_true, t_cam2base_est, NormTypes::NORM_L2);
//    std::cout << "rvecDiff:" << rvecDiff << " tvecDiff:" << tvecDiff << std::endl;return 0;
}void printPose(const vector<double> &pose) {cout << "[" <<pose[0] << " " << pose[1] << " " << pose[2] << " " <<pose[3] << " " << pose[4] << " " << pose[5] << " " <<"]" << endl;
}

2D与3D融合实践¶

根据模板抓取指定物体:

制作模板,并计算取得相机到模板的变换矩阵T1,根据实时相机中拍到的物体进行模板匹配,得到变换矩阵T0,最后和相机的外参矩阵Tc进行矩阵相乘,得到目标在世界坐标系的表示,从而进行抓取操作。

一、制作模板:求T1¶

  1. Kinect相机拍照(得到RGB图和深度图)

    01_PhotoCapture.cpp

  2. 检测抓取位置(u,v),根据内参及深度信息得到三个空间中的点坐标

    02_PointLocator.cpp

    03_TemplateMaker.cpp

  3. 构建坐标系得到旋转矩阵T1,转成RPY进行抓取测试

    04_TestGrabTemplate.cpp

  4. 生成点云图用于模板匹配(进行直通滤波及降采样)

    05_CreatePclCloud.cpp 验证变换矩阵

    06_TemplateCloudFilter.cpp 生成剪切后的模板

    • 实时的拍照得到RGB和深度图
    • 合成目标点云图
    • 通过直通滤波框定范围(得到感兴趣区域)
    • 将感兴趣区域进行降采样(提高模板匹配效率)

二、使用模板:求T0¶

准备好切割后的点云template.pcd以及对应的变换矩阵T1(可以有多个)

  1. Kinect相机拍照(得到RGB图和深度图)

    01_PhotoCapture.cpp

  2. 生成目标点云图

    07_TargetCloudFilter.cpp

  3. 进行模板与目标点云图匹配(统一进行直通滤波及降采样),得到变换矩阵T0

    08_TemplateAlignment.cpp

三、进行抓取测试¶

09_TestGrabTarget.cpp

T0 为目标在模板坐标系的表达 T1 为模板在相机坐标系的表达 Tc 为相机在基坐标系的表达

待优化事宜¶

  1. 安全位置判定
  2. 将盒子抓取到指定位置放置
  3. 不间断抓取多个盒子
  4. 准备多个模板,提高模板匹配姿态识别度
  5. 设置间隔,实时进行模板匹配
  6. 设置目标位置抓取动态延时
  7. 自动避障
  8. 其他

自己封装内外参标定工具¶

  • 命令行版
  • Qt版

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/85352.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

pytorch学习------常见的优化算法

优化算法 优化算法就是一种调整模型参数更新的策略&#xff0c;在深度学习和机器学习中&#xff0c;我们常常通过修改参数使得损失函数最小化或最大化。 优化算法介绍 1、梯度下降算法&#xff08;batch gradient descent BGD&#xff09; 每次迭代都需要把所有样本都送入&…

深入了解队列数据结构:定义、特性和实际应用

文章目录 &#x1f34b;引言&#x1f34b;队列的定义&#x1f34b;队列的实现&#x1f34b;队列的应用&#x1f34b;练习题&#x1f34b;结语 &#x1f34b;引言 队列&#xff08;Queue&#xff09;是计算机科学中一种重要的数据结构&#xff0c;它常用于各种应用程序中&#x…

Hive【Hive(一)DDL】

前置准备 需要启动 Hadoop 集群&#xff0c;因为我们 Hive 是在 Hadoop 集群之上运行的。 从DataGrip 或者其他外部终端连接 Hive 需要先打开 Hive 的 metastore 进程和 hiveserver2 进程。metastore 和 hiveserver2 进程的启动过程比较慢&#xff0c;不要着急。 Hive DDL 数据…

基于SpringBoot的网上超市系统的设计与实现

目录 前言 一、技术栈 二、系统功能介绍 管理员功能实现 用户功能实现 三、核心代码 1、登录模块 2、文件上传模块 3、代码封装 前言 网络技术和计算机技术发展至今&#xff0c;已经拥有了深厚的理论基础&#xff0c;并在现实中进行了充分运用&#xff0c;尤其是基于计…

微软在Windows 11推出Copilot,将DALL-E 3集成在Bing!

美东时间9月21日&#xff0c;微软在美国纽约曼哈顿举办产品发布会&#xff0c;生成式AI成为重要主题之一。 微软表示&#xff0c;Copilot将于9月26日在Windows 11中推出&#xff1b;Microsoft 365 Copilot 将于11 月1日向企业客户全面推出&#xff1b;将OpenAI最新的文本生成图…

【论文阅读 08】Adaptive Anomaly Detection within Near-regular Milling Textures

2013年&#xff0c;太老了&#xff0c;先不看 比较老的一篇论文&#xff0c;近规则铣削纹理中的自适应异常检测 1 Abstract 在钢质量控制中的应用&#xff0c;我们提出了图像处理算法&#xff0c;用于无监督地检测隐藏在全局铣削模式内的异常。因此&#xff0c;我们考虑了基于…

GitHub Copilot Chat

9月21日&#xff0c;GitHub在官网宣布&#xff0c;所有个人开发者可以使用GitHub Copilot Chat。用户通过文本问答方式就能生成、检查、分析各种代码。 据悉&#xff0c;GitHub Copilot Chat是基于OpenAI的GPT-4模型打造而成&#xff0c;整体使用方法与ChatGPT类似。例如&…

TouchGFX之画布控件

TouchGFX的画布控件&#xff0c;在使用相对较小的存储空间的同时保持高性能&#xff0c;可提供平滑、抗锯齿效果良好的几何图形绘制。 TouchGFX 设计器中可用的画布控件&#xff1a; LineCircleShapeLine Progress圆形进度条 存储空间分配和使用​ 为了生成反锯齿效果良好的…

华为云云耀云服务器L实例评测 | minikube部署和使用

### 1 安装Docker 按照官网[Docker docs](https://docs.docker.com/engine/install/centos/)指引安装&#xff1a; shell yum install -y yum-utils yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo yum install docker-ce docker-…

[C++随笔录] vector模拟实现

vector模拟实现 基本结构天选之子构造拷贝构造析构operator 空间reserveresizesize && capacity 增insertpush_back 删erasepop_back 查 && 改swapoperator[] 源码 基本结构 // 可以是不同类型, 用类模板 template <class T> class vector { public:// 源…

git和github的入门操作

之前因为工作中用的都是SVN版本控制工具&#xff0c;没接触过git和github&#xff0c;现在开始深入自学Django框架技术后&#xff0c;看到官网推荐使用git&#xff0c;然后这两天网上查阅了很多文章教程&#xff0c;学到入门操作需要学习的点&#xff0c;太多的知识点要后面慢慢…

Mac配置iTerm样式终端

一、MacOs系统 MacOs中终端使用iTerm2 1. 配置oh-my-zsh oh my zsh 的地址&#xff1a; https//github.com/ohmyzsh/ohmyzsh 插件存放位置&#xff1a;~/.oh-my-zsh/plugins 下载常用的插件 git clone http://github.com/zsh-users/zsh-syntax-highlighting.git 修改配…

英伟达 nvidia 官方code llama在线使用

新一代编程语言模型Code Llama面世&#xff1a;重新定义编程的未来 随着人工智能和机器学习技术的迅速发展&#xff0c;我们现在迎来了一款革命性的大型编程语言模型——Code Llama。该模型是基于Llama 2研发的&#xff0c;为开放模型中的佼佼者&#xff0c;其性能达到了行业领…

React组件化开发

1.组件的定义方式 函数组件Functional Component类组件Class Component 2.类组件 export class Profile extends Component {render() {console.log(this.context);return (<div>Profile</div>)} } 组件的名称是大写字符开头&#xff08;无论类组件还是函数组件…

MyBatisPlus(四)表映射:@TableName

表映射 数据库中的表名&#xff0c;和项目中的实体类名&#xff0c;并不相同&#xff0c;则需要通过注解TableName来进行映射。 未映射前报错示例 数据库表名&#xff1a;tb_user 实体类名&#xff1a;User 测试代码 Autowiredprivate UserMapper userMapper;Testvoid selec…

CUDA和cuDNN的安装

参考资料&#xff1a;https://zhuanlan.zhihu.com/p/83971195 目录 CUDA和cuDNN介绍安装验证 CUDA和cuDNN介绍 CUDA(ComputeUnified Device Architecture)&#xff0c;是显卡厂商NVIDIA推出的运算平台。 CUDA是一种由NVIDIA推出的通用并行计算架构&#xff0c;该架构使GPU能够…

网络初识

一 IP 地址 概念: IP 地址主要用于表示网络主机、其他网络设备&#xff08;如路由器&#xff09;的网络地址。简单说&#xff0c;IP地址用于定位主机的网络地址 格式 IP 地址是一个32为的二进制数&#xff0c;通常被分割为4个“8位二进制数“&#xff08;也就是4个字节&…

排序算法(一)

排序算法(一&#xff09; 冒泡排序选择排序插入排序希尔排序堆排序 冒泡排序 冒泡排序是一种十分稳定的排序&#xff0c;其思想是通过两两比较&#xff0c;改变位置&#xff0c;从而每次让一个数出现在其该出现的位置该排序由于很稳定&#xff0c;所以不论数据是否有序&#xf…

什么是语法糖?Java中有哪些语法糖?

什么是语法糖&#xff1f;Java中有哪些语法糖&#xff1f; 语法糖 语法糖&#xff08;Syntactic Sugar&#xff09;&#xff0c;也称糖衣语法&#xff0c;是由英国计算机学家 Peter.J.Landin 发明的一个术语&#xff0c;指在计算机语言中添加的某种语法&#xff0c;这种语法对…