1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Merge branch 4.x

This commit is contained in:
Alexander Smorkalov
2026-02-19 17:10:14 +03:00
120 changed files with 650 additions and 465 deletions
+2 -2
View File
@@ -518,9 +518,9 @@ void CharucoBoardImpl::generateImage(Size outSize, OutputArray img, int marginSi
for(int x = 0; x < size.width; x++) {
if(legacyPattern && (size.height % 2 == 0)) { // legacy behavior only for even row count patterns
if((y + 1) % 2 != x % 2) continue; // white corner, dont do anything
if((y + 1) % 2 != x % 2) continue; // white corner, don't do anything
} else {
if(y % 2 != x % 2) continue; // white corner, dont do anything
if(y % 2 != x % 2) continue; // white corner, don't do anything
}
float startX = pixInSquare * float(x);
@@ -905,7 +905,7 @@ struct ArucoDetector::ArucoDetectorImpl {
// only CORNER_REFINE_SUBPIX implement correctly for useAruco3Detection
// Todo: update other CORNER_REFINE methods
// scale to orignal size, this however will lead to inaccurate detections!
// scale to original size, this however will lead to inaccurate detections!
for (auto &vecPoints : candidates)
for (auto &point : vecPoints)
point *= 1.f/fxfy;
@@ -1399,7 +1399,7 @@ void ArucoDetector::refineDetectedMarkers(InputArray _image, const Board& _board
// last filter, check if inner code is close enough to the assigned marker code
int codeDistance = 0;
// if errorCorrectionRate, dont check code
// if errorCorrectionRate, don't check code
if(refineParams.errorCorrectionRate >= 0) {
// extract bits
@@ -117,7 +117,7 @@ struct CharucoDetector::CharucoDetectorImpl {
minDist = min(dist, minDist);
counter++;
}
// if this is the first closest marker, dont do anything
// if this is the first closest marker, don't do anything
if(counter == 0)
continue;
else {
@@ -163,7 +163,7 @@ struct CharucoDetector::CharucoDetectorImpl {
const int end = range.end;
for (int i = begin; i < end; i++) {
vector<Point2f> in;
in.push_back(filteredChessboardImgPoints[i] - Point2f(0.5, 0.5)); // adjust sub-pixel coordinates for cornerSubPix
in.push_back(filteredChessboardImgPoints[i]);
Size winSize = filteredWinSizes[i];
if (winSize.height == -1 || winSize.width == -1)
winSize = Size(arucoDetector.getDetectorParameters().cornerRefinementWinSize,
@@ -172,7 +172,7 @@ struct CharucoDetector::CharucoDetectorImpl {
TermCriteria(TermCriteria::MAX_ITER | TermCriteria::EPS,
arucoDetector.getDetectorParameters().cornerRefinementMaxIterations,
arucoDetector.getDetectorParameters().cornerRefinementMinAccuracy));
filteredChessboardImgPoints[i] = in[0] + Point2f(0.5, 0.5);
filteredChessboardImgPoints[i] = in[0];
}
});
// parse output
+9 -4
View File
@@ -1576,7 +1576,7 @@ bool QRCodeDecoderImpl::errorCorrectionBlock(std::vector<uint8_t>& codewords) {
uint8_t b = 1; // discrepancy from last L update
std::vector<uint8_t> C(numSyndromes, 0); // Error locator polynomial
std::vector<uint8_t> B(numSyndromes, 0); // A copy of error locator from previos L update
std::vector<uint8_t> B(numSyndromes, 0); // A copy of error locator from previous L update
C[0] = B[0] = 1;
for (size_t i = 0; i < numSyndromes; ++i) {
CV_Assert(m + L - 1 < C.size()); // m >= 1 on any iteration
@@ -1629,9 +1629,15 @@ bool QRCodeDecoderImpl::errorCorrectionBlock(std::vector<uint8_t>& codewords) {
std::vector<uint8_t> errEval;
gfPolyMul(C, syndromes, errEval);
// Precompute all X values for error locations to avoid duplicated computation
std::vector<uint8_t> X_values(errLocs.size());
for (size_t j = 0; j < errLocs.size(); ++j) {
X_values[j] = gfPow(2, static_cast<int>(codewords.size() - 1 - errLocs[j]));
}
for (size_t i = 0; i < errLocs.size(); ++i) {
uint8_t numenator = 0, denominator = 0;
uint8_t X = gfPow(2, static_cast<int>(codewords.size() - 1 - errLocs[i]));
uint8_t X = X_values[i];
uint8_t inv_X = gfDiv(1, X);
for (size_t j = 0; j < L; ++j) {
@@ -1639,12 +1645,11 @@ bool QRCodeDecoderImpl::errorCorrectionBlock(std::vector<uint8_t>& codewords) {
}
// Compute demoninator as a product of (1-X_i * X_k) for i != k
// TODO: optimize, there is a dubplicated compute
denominator = 1;
for (size_t j = 0; j < errLocs.size(); ++j) {
if (i == j)
continue;
uint8_t Xj = gfPow(2, static_cast<int>(codewords.size() - 1 - errLocs[j]));
uint8_t Xj = X_values[j];
denominator = gfMul(denominator, 1 ^ gfMul(inv_X, Xj));
}