Nain57 / Smart-AutoClicker

An open-source auto clicker on images for Android
GNU General Public License v3.0
2.05k stars 361 forks source link

Screen conditions with 2% accuracy do not get detected for me #504

Closed IARI closed 1 month ago

IARI commented 2 months ago

Version of Smart AutoClicker

3.0.3

Device brand and model

Emulator: LDPlayer

Version of your Android OS

9

Type

Smart scenario

Describe what happened?

I am capturing any region as a screen condition. I set the accuracy to 2% or 1% When I test the condition immidiately afterwards where the region of the screen is 100% pixel perfect the same, the condition never triggers.

Describe what should have happened?

The condition should trigger

IARI commented 2 months ago

When I set up a Detection Area which is slightly bigger than the Captured area, and then click test, I get this situation:

image

Obviousely the images do not match 100%. While I do the capturing, the windows of the application where the Area is captured is scaled down by Klickr - Maybe there is some sort of error there?

Toby-Null commented 1 month ago

set to 4-7% if you click the play button in condition it will show you % it detect, usually on same image it detect 97%.

Nain57 commented 1 month ago

Hi and thank you for your feedback.

As it will take a lot of time to simply compare the pixels one by one, image detection is based on a template matching algorithm powered by OpenCv. This algorithm uses another way to determine if there is a matching or not in picture (complicated mathematics, but everything is open source and even explained on Wikipedia if you want to hurt yourself 😄). This method is way faster, but sacrifice the precision.

You also have to take in account the downscaling. To make the template matching even faster, Klick'r is also downscaling your screen display and your conditions. This can be controlled with the Detection Quality slider in the scenario dialog (the value is actually the resolution scaling).

With that in mind, you can easily understand that the detection will rarelly be 100%, that's why you have another setting, the Image Condition Tolerated difference, allowing you to define the detection threshold per image.

Finally, your screenshot is just a visual glitch. I had write to whole overlay ui myself as i could not find any convincing open source solution 🥲

I will close this ticket as this is not a bug, but feel free to ask questions here if still have some.