Skip to content

Cache unionfind structure across detect calls and lazy-initialize size array#434

Open
bouk wants to merge 1 commit into
AprilRobotics:masterfrom
bouk:bouk/cache-unionfind
Open

Cache unionfind structure across detect calls and lazy-initialize size array#434
bouk wants to merge 1 commit into
AprilRobotics:masterfrom
bouk:bouk/cache-unionfind

Conversation

@bouk
Copy link
Copy Markdown
Contributor

@bouk bouk commented Mar 26, 2026

For large images (3088x2064) this gives me an 1.33x(!) speedup.

Surprisingly only on Linux, on my macbook there's no difference

@Gold856
Copy link
Copy Markdown
Contributor

Gold856 commented Mar 27, 2026

apriltag_demo segfaults if I pass in two images on the second image, with the first one having a smaller resolution (640x400, followed by 1280x951). Switching the order such that the first image has the larger resolution does not trigger a segfault.

@bouk
Copy link
Copy Markdown
Contributor Author

bouk commented Mar 27, 2026

@Gold856 you're right, I inverted a condition. Fixed now and I added a regression test

@bouk bouk force-pushed the bouk/cache-unionfind branch 2 times, most recently from c4d82fb to 05bcde0 Compare March 27, 2026 09:59
Comment thread apriltag_quad_thresh.c
@bouk bouk force-pushed the bouk/cache-unionfind branch 2 times, most recently from d185f23 to 57d5243 Compare March 27, 2026 13:36
@christian-rauch
Copy link
Copy Markdown
Collaborator

Can you rebase this and provide some details in the commit message what this change does and how it works?

…e array

This saves a potentially big allocation if multiple detections are performed
after each other. For 6MP images this gives me a 1.33x increase in
detection throughput.
@bouk bouk force-pushed the bouk/cache-unionfind branch from 57d5243 to a155516 Compare May 18, 2026 07:40
@bouk
Copy link
Copy Markdown
Contributor Author

bouk commented May 18, 2026

@christian-rauch I've rebased and added a little bit more detail in the commit

@christian-rauch
Copy link
Copy Markdown
Collaborator

@mkrogius

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants