|
Post by jakomoto on May 5, 2017 1:21:50 GMT
Try to detect a totally black region in a screen using reg:exists() but it always return false, any idea what did I do wrong? The matching image is a totally black PNG.
Sorry, it's actually the other way around: Trying to reg:exists() whether a region in an image (that is not black) is totally black with a black image pattern, always return true (telling me the the image is black, although it's not)
|
|
|
Post by AnkuLua on May 5, 2017 1:45:03 GMT
Please share the screenshot, image and script.
|
|
|
Post by jakomoto on May 5, 2017 4:51:40 GMT
Please share the screenshot, image and script. Attached the script and pattern image, run it on any screen which is not black test1
|
|
|
Post by AnkuLua on May 5, 2017 14:01:40 GMT
It turns out that there is bug when the image is all black. Please add some white dots to the image. The result should be correct now. Please report the result.
|
|
|
Post by jakomoto on May 5, 2017 15:59:39 GMT
It turns out that there is bug when the image is all black. Please add some white dots to the image. The result should be correct now. Please report the result. Although adding white (tried near black grey works too) dots to the pattern image fixed for non-black image, unfortunately matching a completely black image fails now, which is what I wanted to do. Any other workaround?
|
|
|
Post by AnkuLua on May 6, 2017 0:13:07 GMT
When cropping the image, please not only the all black part. Please crop some non-black part.
|
|
|
Post by jakomoto on May 6, 2017 1:45:11 GMT
When cropping the image, please not only the all black part. Please crop some non-black part. I wanted to detect whether the screen goes into a complete black stage (loading), so there's no non-black part to crop
|
|
|
Post by theycallmek on May 6, 2017 2:22:15 GMT
what about the ankulua stop button? that should still be visible on-screen.
you could match an image 50-75 pixels tall across the entire bottom of the screen, if the button is in the bottom left hand corner, for example.
|
|
|
Post by AnkuLua on May 6, 2017 2:24:43 GMT
You can hide stop button in Pro2.
You can now setButtonPosition() to move the button in script.
|
|
|
Post by d354n on May 6, 2017 11:34:55 GMT
You Can also use getColor() Get color in 5 location if return Black Then it loading screen
|
|
|
Post by jakomoto on May 10, 2017 15:51:08 GMT
Some update, managed to hack through this by using the simple getColor() trick as suggested by d354n, thanks man! Also thanks for all the other suggestions as well! But am wondering how getColor() works, because it returns different RGB value every time I getColor() on the same region of the same image, does it simply pick any color from the region and return?
|
|
|
Post by d354n on May 10, 2017 16:02:55 GMT
is the difference value high or not? if it is just about 1-10 value you can use tolerance value
|
|
|
Post by AnkuLua on May 10, 2017 16:04:00 GMT
If getColor() with region, it will return the color of the center of the region.
For your purpose, there is an alternative. 1. add a white dot to the image. 2. check the score of all black image with the image with one white dot. if (exists(Pattern("black.png"):similar(0.1)) then print(getLastMatch():getScore()) end 3. Now set the proper similarity (a little lower than the score) and do the searching.
|
|
|
Post by jakomoto on May 10, 2017 16:40:55 GMT
If getColor() with region, it will return the color of the center of the region. For your purpose, there is an alternative. 1. add a white dot to the image. 2. check the score of all black image with the image with one white dot. if (exists(Pattern("black.png"):similar(0.1)) then print(getLastMatch():getScore()) end 3. Now set the proper similarity (a little lower than the score) and do the searching. Oh shoot, sorry, my mistake, I tested getColor() again, and it returns the same value everytime now, should be center of the region as pointed out. Probably my eyes was too tired and playing tricks on me. I want to detect completely black region so getColor() does the trick, thanks for the another good tip again!
|
|