Nain57 / Smart-AutoClicker

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

The image is not detected #516

Closed talebianasal closed 5 hours ago

talebianasal commented 2 weeks ago

Version of Smart AutoClicker

3.0.4

Device brand and model

Samsung S23

Version of your Android OS

12.1

Type

Smart scenario

Describe what happened?

hello I have a big problem. In my setup scenario, there are about 10 events that are executed one after the other (each event deactivates itself after finishing and activates the next event to execute). When all the events were completely finished once, I made the first event to be activated and run again. The problem is that after re-executing the events in some cases, the image detection does not happen and my event does not start and my scenario actually stops (this does not happen only for a specific event, but randomly, this problem appears in different events) Therefore, the probability of my error in creating the events is practically 0) It should be noted that I set the image detection to 20% sensitivity, and also in 'display anywhere on the screen' mode. Thank you for helping me because it has caused problems in my project. thank you

Describe what should have happened?

Considering that after finishing the last event, I activate the first event again so that my events are placed in an infinite loop, it must perform image detection without limits so that this endless loop does not step.

hsantanna commented 2 weeks ago

Possible duplicate for #501

talebianasal commented 2 weeks ago

Possible duplicate for #501

It is not repetitive! I did my work exactly according to your backup file and I have encountered a problem. My problem happens sometimes and not in a specific event

hsantanna commented 2 weeks ago

The cause is the same, there is a bug which affects the event order when enabling and disabling events. The backup file at #501 is just a test to trigger the bug, but the bug will appear for the most scenarios where events are disabled and reenabled.

developercrazy021 commented 2 weeks ago

Is there no one to help?! I have the same problem @Nain57

talebianasal commented 1 week ago

After a lot of research, I think I found the problem! If our events are only part of one of the screen or triggers models, there will be no problem. But if the combination of both of them is used, either there will be a lot of delays in the execution of the events, or the scenario stops as if it stopped completely! (In this example, you will not encounter the full stop scenario, but we will encounter the full stop problem in real examples.) I have prepared a backup of a scenario for you that you can use for testing, you will see that when the scenario goes to the end and wants to start again, it takes a strange time (please if you encounter the mentioned error If you didn't, let the work continue until it runs into trouble. You will definitely encounter the mentioned problem.

This scenario has been tested on the Android Studio emulator, so you can use it for a better test: Pixel 7 Pro API 31 6.71" 1440x3120 560dpi

Note: The events are created only for testing. You will see an event that is only supposed to delay the task for 7 seconds. Naturally, we are not going to use events in this way Note2: I tested the scenario in different detection quality and the problem persists

Test Scenario Download @Nain57

talebianasal commented 1 week ago

Also, according to our friend @hsantanna , if several events meet the conditions at the same time, only the first one will be executed and the rest will not be used. Maybe this function is good, but when the events are of 2 models (screens and triggers), other screen events will not be executed.

talebianasal commented 1 week ago

In the context of the problem that I mentioned, it stops completely and detection does not take place, I checked the logs and found that after some time of activity, the following error occurs: ROI is invalid, 0/ 0 554/1200 in 13550/ 2400 And this error occurs consecutively and no detection is done anymore (the triggers activity continues to work, but no image is detected anymore) So, either there is a problem with detecting the image in the com.buzbuz.smartautoclicker.core.detection package, or there is a problem with the DisplayRecorder, which does not transfer the image correctly.

It should be mentioned that I realized the problem of the delay in the execution of triggers is from the following code in the DetectorEngine class: displayRecorder.acquireLatestBitmap()?.let { screenFrame -> Sometimes screenFrame is returned null Therefore, to solve this problem of delay in the execution of triggers, it is enough to separate the scenarioProcessor?.process() code for triggers and images and place the process related to triggers outside the following section: displayRecorder.acquireLatestBitmap()?.let { screenFrame -> That is, the processScreenImages class code becomes like this:

private suspend fun processScreenImages() {
 _state.emit(DetectorState.DETECTING)

 scenarioProcessor?.invalidateScreenMetrics()
 while (processingJob?.isActive == true) {
 scenarioProcessor?.process()
 displayRecorder.acquireLatestBitmap()?.let { screenFrame ->
 scenarioProcessor?.process(screenFrame)
 }
 delay(NO_IMAGE_DELAY_MS)
 }
 }

@Nain57 @hsantanna

talebianasal commented 2 days ago

My problem is too vague or I did not convey my meaning correctly that no one will help?! @Nain57

talebianasal commented 23 hours ago

My problem is not fixed even by updating to version 3.0.5. It still steps in the middle of the work and does not detect the screen anymore and gives the following error:

ROI is invalid, 0/ 554/1200 in 13550/ 2400

Also, in most cases, the screenFrame value in the DetectorEngine class is equal to null.

Nain57 commented 6 hours ago

Hi, can you specify on which platform did you install the app ? The PlayStore or F-Droid ?

talebianasal commented 6 hours ago

Hi, can you specify on which platform did you install the app ? The PlayStore or F-Droid ?

F-Droid I should also mention that I have made some changes to the project, but my changes are not at all in your code or the core of the software. For example, I have made it so that on the first login, the default scenarios that I have already created are downloaded.

And one question Will changing the applicationId in smartautoclicker cause a problem? Because I have changed it but the other parts have not been changed.

Nain57 commented 5 hours ago

As specified in the issue form, I do not provide help on custom implementation of Klick'r. I have been looking for an issue for a week for nothing.

If you are encountering the issue on an official release of the application, please provide the minimal use case scenario to reproduce it with clear steps for reproduction and open a new ticket