Skip to content

Hope add a new function, achieve search through the coverage rate of matching quantity. #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wilon opened this issue Mar 13, 2025 · 0 comments

Comments

@wilon
Copy link

wilon commented Mar 13, 2025

Such as func FindCoverageRate(bitmap, source_bitmap robotgo.CBitmap, tolerance float64, rate float64) (int, int)

bitmap => Needle 2x3
source_bitmap => Haystack 5x4
tolerance => 0.1
rate => 0.5, same as 50%

From the first w violent match, Until match four b, 4/6 > 50%, return (3, 1)

		/* TODO: The above commented out code fails at certain edge cases, e.g.:
		 * Needle: [B, b
		 *          b, b,
		 *          B, b]
		 * Haystack: [w, w, w, w, w
		 *            w, w, w, w, b
		 *            w, w, w, b, b
		 *            w, w, w, w, b]
		 * The previous algorithm noticed that the first 3 x 3 block had nothing
		 * in common with the image, and thus, after scanning the first row,
		 * skipped three blocks downward to scan the next (which didn't exist,
		 * so the loop ended). However, the needle was hidden IN-BETWEEN this
		 * jump -- skipping was appropriate for scanning the column but not
		 * the row.
		 *
		 * I need to figure out a more optimal solution; temporarily I am just
		 * scanning every single y coordinate, only skipping on x's. This
		 * always works, but is probably not optimal.
		 */

/* TODO: The above commented out code fails at certain edge cases, e.g.:

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

No branches or pull requests

1 participant