build: upgrade to go 1.17 and upgrade dependencies

This commit is contained in:
2021-09-02 12:03:56 +02:00
parent b48ac6679e
commit 5436dfebc2
761 changed files with 133691 additions and 105807 deletions

131
vendor/gocv.io/x/gocv/features2d.cpp generated vendored
View File

@@ -237,10 +237,13 @@ struct KeyPoints FastFeatureDetector_Detect(FastFeatureDetector f, Mat src) {
}
ORB ORB_Create() {
// TODO: params
return new cv::Ptr<cv::ORB>(cv::ORB::create());
}
ORB ORB_CreateWithParams(int nfeatures, float scaleFactor, int nlevels, int edgeThreshold, int firstLevel, int WTA_K, int scoreType, int patchSize, int fastThreshold) {
return new cv::Ptr<cv::ORB>(cv::ORB::create(nfeatures, scaleFactor, nlevels, edgeThreshold, firstLevel, WTA_K, static_cast<cv::ORB::ScoreType>(scoreType), patchSize, fastThreshold));
}
void ORB_Close(ORB o) {
delete o;
}
@@ -413,6 +416,50 @@ struct MultiDMatches BFMatcher_KnnMatchWithParams(BFMatcher b, Mat query, Mat tr
return ret;
}
FlannBasedMatcher FlannBasedMatcher_Create() {
return new cv::Ptr<cv::FlannBasedMatcher>(cv::FlannBasedMatcher::create());
}
void FlannBasedMatcher_Close(FlannBasedMatcher f) {
delete f;
}
struct MultiDMatches FlannBasedMatcher_KnnMatch(FlannBasedMatcher f, Mat query, Mat train, int k) {
std::vector< std::vector<cv::DMatch> > matches;
(*f)->knnMatch(*query, *train, matches, k);
DMatches *dms = new DMatches[matches.size()];
for (size_t i = 0; i < matches.size(); ++i) {
DMatch *dmatches = new DMatch[matches[i].size()];
for (size_t j = 0; j < matches[i].size(); ++j) {
DMatch dmatch = {matches[i][j].queryIdx, matches[i][j].trainIdx, matches[i][j].imgIdx,
matches[i][j].distance};
dmatches[j] = dmatch;
}
dms[i] = {dmatches, (int) matches[i].size()};
}
MultiDMatches ret = {dms, (int) matches.size()};
return ret;
}
struct MultiDMatches FlannBasedMatcher_KnnMatchWithParams(FlannBasedMatcher f, Mat query, Mat train, int k, Mat mask, bool compactResult) {
std::vector< std::vector<cv::DMatch> > matches;
(*f)->knnMatch(*query, *train, matches, k, *mask, compactResult);
DMatches *dms = new DMatches[matches.size()];
for (size_t i = 0; i < matches.size(); ++i) {
DMatch *dmatches = new DMatch[matches[i].size()];
for (size_t j = 0; j < matches[i].size(); ++j) {
DMatch dmatch = {matches[i][j].queryIdx, matches[i][j].trainIdx, matches[i][j].imgIdx,
matches[i][j].distance};
dmatches[j] = dmatch;
}
dms[i] = {dmatches, (int) matches[i].size()};
}
MultiDMatches ret = {dms, (int) matches.size()};
return ret;
}
void DrawKeyPoints(Mat src, struct KeyPoints kp, Mat dst, Scalar s, int flags) {
std::vector<cv::KeyPoint> keypts;
cv::KeyPoint keypt;
@@ -428,3 +475,85 @@ void DrawKeyPoints(Mat src, struct KeyPoints kp, Mat dst, Scalar s, int flags) {
cv::drawKeypoints(*src, keypts, *dst, color, static_cast<cv::DrawMatchesFlags>(flags));
}
SIFT SIFT_Create() {
// TODO: params
return new cv::Ptr<cv::SIFT>(cv::SIFT::create());
}
void SIFT_Close(SIFT d) {
delete d;
}
struct KeyPoints SIFT_Detect(SIFT d, Mat src) {
std::vector<cv::KeyPoint> detected;
(*d)->detect(*src, detected);
KeyPoint* kps = new KeyPoint[detected.size()];
for (size_t i = 0; i < detected.size(); ++i) {
KeyPoint k = {detected[i].pt.x, detected[i].pt.y, detected[i].size, detected[i].angle,
detected[i].response, detected[i].octave, detected[i].class_id
};
kps[i] = k;
}
KeyPoints ret = {kps, (int)detected.size()};
return ret;
}
struct KeyPoints SIFT_DetectAndCompute(SIFT d, Mat src, Mat mask, Mat desc) {
std::vector<cv::KeyPoint> detected;
(*d)->detectAndCompute(*src, *mask, detected, *desc);
KeyPoint* kps = new KeyPoint[detected.size()];
for (size_t i = 0; i < detected.size(); ++i) {
KeyPoint k = {detected[i].pt.x, detected[i].pt.y, detected[i].size, detected[i].angle,
detected[i].response, detected[i].octave, detected[i].class_id
};
kps[i] = k;
}
KeyPoints ret = {kps, (int)detected.size()};
return ret;
}
void DrawMatches(Mat img1, struct KeyPoints kp1, Mat img2, struct KeyPoints kp2, struct DMatches matches1to2, Mat outImg, const Scalar matchesColor, const Scalar pointColor, struct ByteArray matchesMask, int flags) {
std::vector<cv::KeyPoint> kp1vec, kp2vec;
cv::KeyPoint keypt;
for (int i = 0; i < kp1.length; ++i) {
keypt = cv::KeyPoint(kp1.keypoints[i].x, kp1.keypoints[i].y,
kp1.keypoints[i].size, kp1.keypoints[i].angle, kp1.keypoints[i].response,
kp1.keypoints[i].octave, kp1.keypoints[i].classID);
kp1vec.push_back(keypt);
}
for (int i = 0; i < kp2.length; ++i) {
keypt = cv::KeyPoint(kp2.keypoints[i].x, kp2.keypoints[i].y,
kp2.keypoints[i].size, kp2.keypoints[i].angle, kp2.keypoints[i].response,
kp2.keypoints[i].octave, kp2.keypoints[i].classID);
kp2vec.push_back(keypt);
}
cv::Scalar cvmatchescolor = cv::Scalar(matchesColor.val1, matchesColor.val2, matchesColor.val3, matchesColor.val4);
cv::Scalar cvpointcolor = cv::Scalar(pointColor.val1, pointColor.val2, pointColor.val3, pointColor.val4);
std::vector<cv::DMatch> dmatchvec;
cv::DMatch dm;
for (int i = 0; i < matches1to2.length; i++) {
dm = cv::DMatch(matches1to2.dmatches[i].queryIdx, matches1to2.dmatches[i].trainIdx,
matches1to2.dmatches[i].imgIdx, matches1to2.dmatches[i].distance);
dmatchvec.push_back(dm);
}
std::vector<char> maskvec;
for (int i = 0; i < matchesMask.length; i++) {
maskvec.push_back(matchesMask.data[i]);
}
cv::drawMatches(*img1, kp1vec, *img2, kp2vec, dmatchvec, *outImg, cvmatchescolor, cvpointcolor, maskvec, static_cast<cv::DrawMatchesFlags>(flags));
}