|
Post by AnkuLua on Oct 4, 2019 12:59:53 GMT
Hi, Really starting to enjoy Ankulua, exactly what I was looking for !
The documentation for exists / existsClick is not clear enough to me. The behavior with or without the 'seconds' parameter is not explicit. Typically what I want to control is that a single screenshot be taken, and then wait if it is unsucessful : while not myregion:existsClick("myimage.png", seconds) do sleep(10.0) end If I simply use
myregion:existsClick("myimage.png")
does the "seconds" parameter take a default value ? how much ? how many screenshots are then taken ?
I also tried something like this :
while not myregion:existsClick("myimage.png", 10.0) do toast("not found") end
and it seems it was causing my script to become unstable: my script simply stopped running after a while, without any error message
It is now much more stable with for example :
while not myregion:existsClick("myimage.png", 0.5) do sleep(10.0) end Please explain what's happening under the hood !
I'm running latest 8.5.5 Pro
Thanks
The default value of second is 3. Therefore myregion:existsClick("myimage.png") is the same as myregion:existsClick("myimage.png", 3) As for how many screenshots taken in 3 seconds, it depends on the device computation power.
|
|
jumk
New Member
Posts: 4
|
Post by jumk on Oct 4, 2019 14:10:41 GMT
The default value of second is 3. Therefore myregion:existsClick("myimage.png") is the same as myregion:existsClick("myimage.png", 3) As for how many screenshots taken in 3 seconds, it depends on the device computation power. OK thanks. I discovered we can pass 0 for the seconds parameter : do you confirm this is how to ensure a single screenshot is taken ?
|
|
|
Post by AnkuLua on Oct 4, 2019 15:40:10 GMT
The default value of second is 3. Therefore myregion:existsClick("myimage.png") is the same as myregion:existsClick("myimage.png", 3) As for how many screenshots taken in 3 seconds, it depends on the device computation power. OK thanks. I discovered we can pass 0 for the seconds parameter : do you confirm this is how to ensure a single screenshot is taken ?
Yes.
|
|
Eebado
Contributors
Posts: 165
|
Post by Eebado on Oct 4, 2019 16:34:47 GMT
Small ask for the Admin:
For the text which says "The following methods could only be called from Region and Match objects." could we get that as a header or something? I missed it and was confused why Highlight wasn't working for me. It is not clear at all that highlight is a method specifically for the Region class. Or even rename the method list to have Region.highlight.
Thanks.
|
|
|
Post by AnkuLua on Oct 4, 2019 23:37:45 GMT
Small ask for the Admin: For the text which says "The following methods could only be called from Region and Match objects." could we get that as a header or something? I missed it and was confused why Highlight wasn't working for me. It is not clear at all that highlight is a method specifically for the Region class. Or even rename the method list to have Region.highlight. Thanks. OK. And the examples should help.
|
|
jumk
New Member
Posts: 4
|
Post by jumk on Oct 8, 2019 8:13:00 GMT
Hi, There is no documentation about Pattern:mask(). Can you please complete the documentation to give details about how it is working, and supposed to be used ? What pixels can be considered masked: black ? white ? do you support PNG transparency ? other color ? is it configurable ? does it take another image as parameter for the mask, like in sikulix ?
If I create a Pattern from a PNG with transparency, are the transparent pixels automatically discarded for matching algorithms ?
Thanks
|
|
|
Post by AnkuLua on Oct 8, 2019 10:08:10 GMT
Hi, There is no documentation about Pattern:mask(). Can you please complete the documentation to give details about how it is working, and supposed to be used ? What pixels can be considered masked: black ? white ? do you support PNG transparency ? other color ? is it configurable ? does it take another image as parameter for the mask, like in sikulix ?
If I create a Pattern from a PNG with transparency, are the transparent pixels automatically discarded for matching algorithms ?
Thanks Please refer to sikulix mask. All sikulix mask functions are supported. sikulix-2014.readthedocs.io/en/latest/pattern.htmlIn short, PNG transparency is supported. If PNG without alpha layer, black color is considered as transparency. It also take another image as paramter for the mask. You should create pattern and call mask(). Just a PNG with transparency is not enough, just like the behavior of sikulix.
|
|
jumk
New Member
Posts: 4
|
Post by jumk on Oct 8, 2019 12:10:15 GMT
Hi, There is no documentation about Pattern:mask(). Can you please complete the documentation to give details about how it is working, and supposed to be used ? What pixels can be considered masked: black ? white ? do you support PNG transparency ? other color ? is it configurable ? does it take another image as parameter for the mask, like in sikulix ?
If I create a Pattern from a PNG with transparency, are the transparent pixels automatically discarded for matching algorithms ?
Thanks Please refer to sikulix mask. All sikulix mask functions are supported. sikulix-2014.readthedocs.io/en/latest/pattern.htmlIn short, PNG transparency is supported. If PNG without alpha layer, black color is considered as transparency. It also take another image as paramter for the mask. You should create pattern and call mask(). Just a PNG with transparency is not enough, just like the behavior of sikulix.
OK for the behavior. I did not test Sikulix but the documentation suggest that PNG with transparency are automatically masked. cf "Masks are internally created from given images having either black parts (masked on request) or transparency (masked automatically). Images having set some 100% transparency in the PNG-alpha-channel will always be treated as masked images so that the transparent parts are ignored during the search."
After some tests, it returns a lot of false positive unless I set the similarity to a very high value. This suggests there might be a bug in how the similarity value is computed (counted for all pixels of the image, instead of only the non-transparent ones ?).
|
|
|
Post by AnkuLua on Oct 8, 2019 12:37:23 GMT
Please refer to sikulix mask. All sikulix mask functions are supported. sikulix-2014.readthedocs.io/en/latest/pattern.htmlIn short, PNG transparency is supported. If PNG without alpha layer, black color is considered as transparency. It also take another image as paramter for the mask. You should create pattern and call mask(). Just a PNG with transparency is not enough, just like the behavior of sikulix.
OK for the behavior. I did not test Sikulix but the documentation suggest that PNG with transparency are automatically masked. cf "Masks are internally created from given images having either black parts (masked on request) or transparency (masked automatically). Images having set some 100% transparency in the PNG-alpha-channel will always be treated as masked images so that the transparent parts are ignored during the search."
After some tests, it returns a lot of false positive unless I set the similarity to a very high value. This suggests there might be a bug in how the similarity value is computed (counted for all pixels of the image, instead of only the non-transparent ones ?).
We did the same test on Sikulix and AnkuLua. The result is the same. You need to set the similarity high if with large mask area.
|
|
|
Post by gslinux on Jan 11, 2020 2:25:14 GMT
Hello,
I haven't had the chance to test yet (unable to at the moment), but are the following methods supported by the Region object, or are planned to be supported? I don't see them listed as supported: getTopLeft() getTopRight() getBottomLeft() getBottomRight()
And while I'm at it, is the resize method supported by Pattern object? if not, any plans to support it? Thanks in advance!
|
|
|
Post by AnkuLua on Jan 11, 2020 3:04:47 GMT
Hello, I haven't had the chance to test yet (unable to at the moment), but are the following methods supported by the Region object, or are planned to be supported? I don't see them listed as supported: getTopLeft() getTopRight() getBottomLeft() getBottomRight() And while I'm at it, is the resize method supported by Pattern object? if not, any plans to support it? Thanks in advance! They are not supported. But you can get them easily with getX(),getY(), getW(), getH() Pattern resizing is not supported. setCompareDimension() do the jobs.
|
|
|
Post by gslinux on Jan 11, 2020 3:26:36 GMT
Hello, I haven't had the chance to test yet (unable to at the moment), but are the following methods supported by the Region object, or are planned to be supported? I don't see them listed as supported: getTopLeft() getTopRight() getBottomLeft() getBottomRight() And while I'm at it, is the resize method supported by Pattern object? if not, any plans to support it? Thanks in advance! They are not supported. But you can get them easily with getX(),getY(), getW(), getH() Pattern resizing is not supported. setCompareDimension() do the jobs. I thought about using getX/Y and getW/H, just thought I asked if those methods were supported. I'll look into setCompareDimension(). Thanks for replying.
|
|
4life
New Member
Posts: 3
|
Post by 4life on Feb 7, 2023 12:07:04 GMT
Hello, where can I learn about the grow() method, or usage examples?
|
|
|
Post by AnkuLua on Feb 9, 2023 0:44:18 GMT
Hello, where can I learn about the grow() method, or usage examples? grow(left, right, top, bottom) The new region is defined by extending (>0) or shrinking (<0) the current region’s dimensions in all directions reg = Region(100, 200, 50, 60) regGrow = reg:grow(1, 2, 3, 4) -- regGrow will be the same as Region(99, 197, 53, 67)
|
|
4life
New Member
Posts: 3
|
Post by 4life on Feb 12, 2023 17:58:12 GMT
Hi, I get an error when using this method highlightUpdate(text): update the highlight text "Invalid method call. No such method" help me, please.
|
|