mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 11:10:21 +08:00
Merge pull request #24779 from MaximSmolskiy:fix-bug-in-ChessBoardDetector-findQuadNeighbor
Fix bug in ChessBoardDetector::findQuadNeighbors #24779 ### Pull Request Readiness Checklist `corners` and `neighbors` indices means not filling order, but relative position. So, for example if `quad->count = 2`, it doesn't mean that `quad->neighbors[0]` and `quad->neighbors[1]` are filled. And we should should iterate over all four `neighbors`. See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
parent
8850a8219e
commit
28d22d7b84
@ -156,7 +156,8 @@ struct ChessBoardQuad
|
||||
float edge_len; // quad edge len, in pix^2
|
||||
// neighbors and corners are synced, i.e., neighbor 0 shares corner 0
|
||||
ChessBoardCorner *corners[4]; // Coordinates of quad corners
|
||||
struct ChessBoardQuad *neighbors[4]; // Pointers of quad neighbors
|
||||
struct ChessBoardQuad *neighbors[4]; // Pointers of quad neighbors. M.b. sparse.
|
||||
// Each neighbors element corresponds to quad corner, but not just sequential index.
|
||||
|
||||
ChessBoardQuad(int group_idx_ = -1) :
|
||||
count(0),
|
||||
@ -1701,12 +1702,12 @@ void ChessBoardDetector::findQuadNeighbors()
|
||||
continue;
|
||||
|
||||
// Check that each corner is a neighbor of different quads
|
||||
for(j = 0; j < closest_quad->count; j++ )
|
||||
for(j = 0; j < 4; j++ )
|
||||
{
|
||||
if (closest_quad->neighbors[j] == &cur_quad)
|
||||
break;
|
||||
}
|
||||
if (j < closest_quad->count)
|
||||
if (j < 4)
|
||||
continue;
|
||||
|
||||
// check whether the closest corner to closest_corner
|
||||
|
Loading…
Reference in New Issue
Block a user