提取export

This commit is contained in:
jerryzeng 2025-12-06 00:11:43 +08:00
parent 036e1079a7
commit 66b044e787
11 changed files with 202 additions and 56 deletions

View File

@ -1,10 +1,8 @@
#pragma once #pragma once
#include "SG_baseAlgo_Export.h" #include "SG_algo_Export.h"
#include "SG_baseDataType.h"
#include <vector> #include <vector>
#define _OUTPUT_DEBUG_DATA 1 #define _OUTPUT_DEBUG_DATA 1
typedef struct typedef struct
@ -55,11 +53,7 @@ SG_APISHARED_EXPORT void sx_BQ_lineDataR(
const double* camPoseR, const double* camPoseR,
double groundH); double groundH);
<<<<<<< HEAD
//瓊혤댈쌈보룹
=======
//提取工件角点及定位长度信息 //提取工件角点及定位长度信息
>>>>>>> 19b51a73a7f69f892049985dacce8d76724f405c
SG_APISHARED_EXPORT SSX_BQworkpieceResult sx_BQ_getWorkpieceCorners( SG_APISHARED_EXPORT SSX_BQworkpieceResult sx_BQ_getWorkpieceCorners(
std::vector< std::vector<SVzNL3DPosition>>& scanLines, std::vector< std::vector<SVzNL3DPosition>>& scanLines,
const SSG_cornerParam cornerPara, const SSG_cornerParam cornerPara,
@ -70,8 +64,4 @@ SG_APISHARED_EXPORT SSX_BQworkpieceResult sx_BQ_getWorkpieceCorners(
#if _OUTPUT_DEBUG_DATA #if _OUTPUT_DEBUG_DATA
SSX_debugInfo* debug_conturs, SSX_debugInfo* debug_conturs,
#endif #endif
<<<<<<< HEAD
int* errCode); int* errCode);
=======
int* errCode);
>>>>>>> 19b51a73a7f69f892049985dacce8d76724f405c

View File

@ -0,0 +1,22 @@
#pragma once
#if defined(_MSC_VER) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
# define Q_DECL_EXPORT __declspec(dllexport)
# define Q_DECL_IMPORT __declspec(dllimport)
#else
# define Q_DECL_EXPORT __attribute__((visibility("default")))
# define Q_DECL_IMPORT __attribute__((visibility("default")))
#endif
#if defined(SG_API_LIBRARY)
# define SG_APISHARED_EXPORT Q_DECL_EXPORT
#else
# define SG_APISHARED_EXPORT Q_DECL_IMPORT
#endif
#include "SG_baseDataType.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846 // pi
#endif // !M_PI

View File

@ -4,8 +4,7 @@
#define BAG_ALGO_USE_CORNER_FEATURE 1 #define BAG_ALGO_USE_CORNER_FEATURE 1
#define RGN_HIST_SIZE 16 //目标颜色统计的数目 #define RGN_HIST_SIZE 16 //目标颜色统计的数目
#include "SG_baseAlgo_Export.h" #include "SG_algo_Export.h"
#include "SG_baseDataType.h"
#include <vector> #include <vector>
typedef struct typedef struct

View File

@ -1,12 +1,5 @@
#pragma once #pragma once
#include "SG_algo_Export.h"
#if defined(SG_API_LIBRARY)
# define SG_APISHARED_EXPORT __declspec(dllexport)
#else
# define SG_APISHARED_EXPORT __declspec(dllimport)
#endif
#include "SG_baseDataType.h"
#include <vector> #include <vector>
#include <opencv2/opencv.hpp> #include <opencv2/opencv.hpp>

View File

@ -1,12 +1,16 @@
#include "SG_baseDataType.h" #include "SG_baseDataType.h"
#include "SG_baseAlgo_Export.h" #include "SG_baseAlgo_Export.h"
#include <vector> #include <vector>
#ifdef __WIN32
#include <corecrt_math_defines.h> #include <corecrt_math_defines.h>
#endif // __WIN32
#include <cmath> #include <cmath>
#include <unordered_map> #include <unordered_map>
//¼ئثمة¨أèROI
SVzNL3DRangeD sg_getScanDataROI( SVzNL3DRangeD sg_getScanDataROI(
//¼ÆËãɨÃèROI
SVzNL3DLaserLine* laser3DPoints, SVzNL3DLaserLine* laser3DPoints,
int lineNum) int lineNum)
{ {

View File

@ -1,9 +1,7 @@
#pragma once #pragma once
#include "SG_baseAlgo_Export.h" #include "SG_algo_Export.h"
#include "SG_baseDataType.h"
#include <vector> #include <vector>
#include <opencv2/opencv.hpp>
typedef enum typedef enum
{ {

View File

@ -0,0 +1,62 @@
#include "SG_baseDataType.h"
#include "SG_baseAlgo_Export.h"
#include <vector>
void wd_noiseFilter(
std::vector< std::vector<SVzNL3DPosition>>& scanLines,
const SSG_outlierFilterParam filterParam,
int* errCode)
{
*errCode = 0;
int lineNum = (int)scanLines.size();
int nPointCnt = (int)scanLines[0].size();
bool vldGrid = true;
//垂直方向过滤
for (int i = 0; i < lineNum; i++)
{
if (nPointCnt != (int)scanLines[i].size())
vldGrid = false;
wd_vectorDataRemoveOutlier_overwrite(
scanLines[i],
filterParam);
}
if (false == vldGrid)
{
*errCode = SG_ERR_3D_DATA_INVLD;
return;
}
//水平方向过滤
int hLineNum = nPointCnt; //Grid格式所有扫描线的点数是一样的
//生成水平扫描数据
std::vector<std::vector<SVzNL3DPosition>> filterHLines;
filterHLines.resize(hLineNum);
for (int i = 0; i < hLineNum; i++)
filterHLines[i].resize(lineNum);
for (int line = 0; line < lineNum; line++)
{
for (int j = 0; j < hLineNum; j++)
{
filterHLines[j][line] = scanLines[line][j];
filterHLines[j][line].pt3D.x = scanLines[line][j].pt3D.y;
filterHLines[j][line].pt3D.y = scanLines[line][j].pt3D.x;
}
}
for (int hLine = 0; hLine < hLineNum; hLine++)
{
//滤波,滤除异常点
std::vector<SVzNL3DPosition> filterData;
std::vector<int> lineNoise;
sg_lineDataRemoveOutlier(
(SVzNL3DPosition*)filterHLines[hLine].data(),
(int)filterHLines[hLine].size(),
filterParam,
filterData,
lineNoise);
for (int j = 0; j < lineNoise.size(); j++)
{
int lineIdx = lineNoise[j];
scanLines[lineIdx][hLine].pt3D.z = 0;
}
}
return;
}

View File

@ -1,9 +1,7 @@
#pragma once #pragma once
#include "SG_baseAlgo_Export.h" #include "SG_algo_Export.h"
#include "SG_baseDataType.h"
#include <vector> #include <vector>
#include <opencv2/opencv.hpp>
#define OUTPUT_DEBUG 0 #define OUTPUT_DEBUG 0

103
sourceCode/aruco.hpp Normal file
View File

@ -0,0 +1,103 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html
#ifndef OPENCV_ARUCO_HPP
#define OPENCV_ARUCO_HPP
#include "opencv2/objdetect/aruco_detector.hpp"
#include "aruco/aruco_calib.hpp"
namespace cv {
namespace aruco {
/**
* @defgroup aruco Aruco markers, module functionality was moved to objdetect module
* @{
* ArUco Marker Detection, module functionality was moved to objdetect module
* @sa ArucoDetector, CharucoDetector, Board, GridBoard, CharucoBoard
* @}
*/
//! @addtogroup aruco
//! @{
/** @brief detect markers
@deprecated Use class ArucoDetector::detectMarkers
*/
CV_EXPORTS_W void detectMarkers(InputArray image, const Ptr<Dictionary> &dictionary, OutputArrayOfArrays corners,
OutputArray ids, const Ptr<DetectorParameters> &parameters = makePtr<DetectorParameters>(),
OutputArrayOfArrays rejectedImgPoints = noArray());
/** @brief refine detected markers
@deprecated Use class ArucoDetector::refineDetectedMarkers
*/
CV_EXPORTS_W void refineDetectedMarkers(InputArray image,const Ptr<Board> &board,
InputOutputArrayOfArrays detectedCorners,
InputOutputArray detectedIds, InputOutputArrayOfArrays rejectedCorners,
InputArray cameraMatrix = noArray(), InputArray distCoeffs = noArray(),
float minRepDistance = 10.f, float errorCorrectionRate = 3.f,
bool checkAllOrders = true, OutputArray recoveredIdxs = noArray(),
const Ptr<DetectorParameters> &parameters = makePtr<DetectorParameters>());
/** @brief draw planar board
@deprecated Use Board::generateImage
*/
CV_EXPORTS_W void drawPlanarBoard(const Ptr<Board> &board, Size outSize, OutputArray img, int marginSize,
int borderBits);
/** @brief get board object and image points
@deprecated Use Board::matchImagePoints
*/
CV_EXPORTS_W void getBoardObjectAndImagePoints(const Ptr<Board> &board, InputArrayOfArrays detectedCorners,
InputArray detectedIds, OutputArray objPoints, OutputArray imgPoints);
/** @deprecated Use Board::matchImagePoints and cv::solvePnP
*/
CV_EXPORTS_W int estimatePoseBoard(InputArrayOfArrays corners, InputArray ids, const Ptr<Board> &board,
InputArray cameraMatrix, InputArray distCoeffs, InputOutputArray rvec,
InputOutputArray tvec, bool useExtrinsicGuess = false);
/**
* @brief Pose estimation for a ChArUco board given some of their corners
* @param charucoCorners vector of detected charuco corners
* @param charucoIds list of identifiers for each corner in charucoCorners
* @param board layout of ChArUco board.
* @param cameraMatrix input 3x3 floating-point camera matrix
* \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$
* @param distCoeffs vector of distortion coefficients
* \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
* @param rvec Output vector (e.g. cv::Mat) corresponding to the rotation vector of the board
* (see cv::Rodrigues).
* @param tvec Output vector (e.g. cv::Mat) corresponding to the translation vector of the board.
* @param useExtrinsicGuess defines whether initial guess for \b rvec and \b tvec will be used or not.
*
* This function estimates a Charuco board pose from some detected corners.
* The function checks if the input corners are enough and valid to perform pose estimation.
* If pose estimation is valid, returns true, else returns false.
* @deprecated Use CharucoBoard::matchImagePoints and cv::solvePnP
* @sa use cv::drawFrameAxes to get world coordinate system axis for object points
*/
CV_EXPORTS_W bool estimatePoseCharucoBoard(InputArray charucoCorners, InputArray charucoIds,
const Ptr<CharucoBoard> &board, InputArray cameraMatrix,
InputArray distCoeffs, InputOutputArray rvec,
InputOutputArray tvec, bool useExtrinsicGuess = false);
/** @deprecated Use cv::solvePnP
*/
CV_EXPORTS_W void estimatePoseSingleMarkers(InputArrayOfArrays corners, float markerLength,
InputArray cameraMatrix, InputArray distCoeffs,
OutputArray rvecs, OutputArray tvecs, OutputArray objPoints = noArray(),
const Ptr<EstimateParameters>& estimateParameters = makePtr<EstimateParameters>());
/** @deprecated Use CharucoBoard::checkCharucoCornersCollinear
*/
CV_EXPORTS_W bool testCharucoCornersCollinear(const Ptr<CharucoBoard> &board, InputArray charucoIds);
//! @}
}
}
#endif

View File

@ -1,22 +1,6 @@
#pragma once #pragma once
#include "SG_algo_Export.h"
#if defined(_MSC_VER) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
# define Q_DECL_EXPORT __declspec(dllexport)
# define Q_DECL_IMPORT __declspec(dllimport)
#else
# define Q_DECL_EXPORT __attribute__((visibility("default")))
# define Q_DECL_IMPORT __attribute__((visibility("default")))
#endif
#if defined(SG_API_LIBRARY)
# define SG_BELTSHARED_EXPORT Q_DECL_EXPORT
#else
# define SG_BELTSHARED_EXPORT Q_DECL_IMPORT
#endif
#include "SG_baseDataType.h"
#include <vector> #include <vector>
#define ENABLE_CROSS_WISE_TEAR 0 #define ENABLE_CROSS_WISE_TEAR 0
@ -91,7 +75,7 @@ typedef struct
}SSG_hLineProInfo; }SSG_hLineProInfo;
SG_BELTSHARED_EXPORT void sg_detectBeltTearing( SG_APISHARED_EXPORT void sg_detectBeltTearing(
SVzNL3DLaserLine* laser3DPoints, //一条扫描线 SVzNL3DLaserLine* laser3DPoints, //一条扫描线
int lineIdx, int lineIdx,
int nPointCount, //每条扫描线的点数量。当采用Grid数据格式时每条扫描线的点的数量是相同的。必须使用Grid格式 int nPointCount, //每条扫描线的点数量。当采用Grid数据格式时每条扫描线的点的数量是相同的。必须使用Grid格式

View File

@ -1,16 +1,9 @@
#pragma once #pragma once
#if defined(SG_API_LIBRARY) #include "SG_algo_Export.h"
# define WD_APISHARED_EXPORT __declspec(dllexport)
#else
# define WD_APISHARED_EXPORT __declspec(dllimport)
#endif
#include "SG_baseDataType.h"
#include <vector> #include <vector>
#include <opencv2/opencv.hpp> #include <opencv2/opencv.hpp>
typedef struct typedef struct
{ {
cv::Size patternSize; //3x3 mark cv::Size patternSize; //3x3 mark
@ -26,10 +19,10 @@ typedef struct
int boardChaucoIDNum; //每块Mark的charuco码的数量。对于3x3的charuco, 二维码的个数为4 int boardChaucoIDNum; //每块Mark的charuco码的数量。对于3x3的charuco, 二维码的个数为4
}SWD_BQ_MarkBoardInfo; }SWD_BQ_MarkBoardInfo;
//读版本号 //读版本号
WD_APISHARED_EXPORT const char* wd_charuco3DMarkVersion(void); SG_APISHARED_EXPORT const char* wd_charuco3DMarkVersion(void);
//提取查科Mark3D信息 //提取查科Mark3D信息
WD_APISHARED_EXPORT void wd_BQ_getCharuco3DMark( SG_APISHARED_EXPORT void wd_BQ_getCharuco3DMark(
cv::Mat& leftImage, cv::Mat& leftImage,
cv::Mat& rightImage, cv::Mat& rightImage,
cv::Mat& cameraMatrixL, cv::Mat& cameraMatrixL,