# LengthAndWidth_Detection **Repository Path**: cz-newborn/LengthAndWidth_Detection ## Basic Information - **Project Name**: LengthAndWidth_Detection - **Description**: 参考A4 纸尺寸检测矩形物体长+宽 - **Primary Language**: C++ - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-10-24 - **Last Updated**: 2022-10-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### A4 纸区域内检测矩形物体长+宽 ```c++ /** * @brief MainWindow::getContours 【获取轮廓信息】 * @param img 源图像 * @param cThr0 边缘检测阈值1 * @param cThr1 边缘检测阈值2 * @param showCanny 是否显示边缘检测图标志 * @param minArea 检测的闭合边缘的最小面积 * @param filter 轮廓多边形拟合的顶点数筛选值 * @param draw 是否绘制检测轮廓 * @return 检测轮廓信息结构体向量 */ vector MainWindow::getContours(Mat img,int cThr0, int cThr1, bool showCanny, float minArea, int filter, bool draw) ``` ```c++ /** * @brief MainWindow::warpImg 【将图像仿射变换】 * @param img 源图像 * @param points 目标图像的4顶点 * @param w 目标图像宽度 * @param h 目标图像高度 * @param pad 边缘裁剪量 * @return 目标图像 */ Mat MainWindow::warpImg(Mat img, vector points, int w, int h, int pad) ``` ```c++ /** * @brief MainWindow::reOrder 【顶点重排序】 * @param points 输入点向量 * @return 左上角起点,顺时针排序后点向量 */ vector MainWindow::reOrder(vector points) ``` ### 检测结果