|
Post by theycallmek on Mar 26, 2017 0:56:25 GMT
Is there a way to detect images that are not rectangle? My thoughts are maybe being able to have a certain color that is ignored, like lime green or magenta. for example: imgur.com/UWwz1kTin that image I would want the image detection to ignore R:255, G:0, B:255 or magenta. Because the area behind the stars changes often its easy to get false positives when trying to detect if there are 1,2,3,4,5, or 6 stars.
|
|
|
Post by AnkuLua on Mar 26, 2017 1:13:43 GMT
One way is to blacken the unwanted area of the cropped area. Then take a suitable similarity.
|
|
|
Post by AutoBOT on Mar 26, 2017 4:46:13 GMT
One way is to blacken the unwanted area of the cropped area. Then take a suitable similarity. I was wondering about this too. but for me how to search the image that has different background. is blackening works? I need to crop everything using Photoshop and only take that parts to make it work.
|
|
|
Post by AnkuLua on Mar 26, 2017 9:22:44 GMT
You could try. There are users who said working. The other method is taking the region as long as many stars, or ever longer. Then compare with images from one to six stars. And get the most similar one. You can refer to existsMultiMax() in commonLib. ankulua.boards.net/thread/169/common-library-autoresize
|
|
|
Post by theycallmek on Mar 30, 2017 23:44:57 GMT
The black out method was giving me trouble, but I have extended the method and now it seems to be working really well. The one downside is it bulks the code up a bit.
Basically I take the image like the stars I linked previously imgur.com/UWwz1kT and I will change all the magenta to solid black in one version, and solid white in another version of the .png file. Now just tell the code to check for both images and return true if it finds a match for one of them.
now you could take this even further and make copies of the png and change the magenta to different maxed out RGB color values. For Example
IMAGE______background rgb value____ image1.png 000:000:000 image2.png 255:255:255 image3.png 255:000:000 image4.png 000:255:000 image5.png 000:000:255
Would the most effecient way to write the code be something like:
while a < 5 do if existsClick(Pattern(starString), 1) then fodRegion:existsClick(Pattern("fod.png"), 1) break else a = a + 1 starString = "star" .. a .. ".png" end end
|
|