-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
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.:
Metadata
Metadata
Assignees
Labels
No labels