Advanced Pixel recognition

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
UnknownHost
Newbie
Posts: 4
Joined: Fri Oct 29, 2021 7:08 pm

Advanced Pixel recognition

Post by UnknownHost » Fri Oct 29, 2021 7:14 pm

Hi there dear Macro Scheduler Forum Community,

I usually never ask for other people's help and figure the problem out myself but, this time I want to make the code a bit simpler rather than advanced.

Before we start, I'm very familiar with Macro Scheduler I would say, unless I can be proven wrong, and I'll accept any help. I do NOT want to make several pixel checkpoints where if all checks up then it results in a green light for the script to execute, I know how to do that and it will not work in this case.

So, with that out of the way, here's my question, is there a way to make a rectangle window with given coordinates;
TLX, TLY, BRX, BRY (Top left coordinates, bottom right coordinates)

And then have a

Code: Select all

GetPixelColor 
function that search that entire rectangle, instead of a specific set of coordinates, say for example;

Code: Select all

gpc> 155,182,nColor

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Advanced Pixel recognition

Post by Dorian (MJT support) » Fri Oct 29, 2021 8:02 pm

I was going to suggest the thing you don't want to do. What you're asking isn't an option. Other than that, Image Recognition with a tiny sampling of pixels within that area.

I've even seen posts on here where users have used image recognition for a 1 pixel image. And of course that can be performed in a specific area.
Yes, we have a Custom Scripting Service. Message me or go here

UnknownHost
Newbie
Posts: 4
Joined: Fri Oct 29, 2021 7:08 pm

Re: Advanced Pixel recognition

Post by UnknownHost » Fri Oct 29, 2021 8:42 pm

The problem is what I am trying to recognize has different phases but the same color throughout these phases, it stretches out from 0 to 35% for example remaining 1 color, then from 36 to 65 a color, then 66 to 100 a color, but it has a stretching motion which has a whole set of different sprites *pictures* so it will be near impossible to take image recognition of all the 0 to 35% picture changes, then 36 to 65, and so on.

So there isn't a way to do it in Macro Scheduler? Like in Python it would be pretty simple, you would set a basic set of colors as variables, with their respective color codes, and make it search them within a rectangle you set, then triggers the code.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Advanced Pixel recognition

Post by Dorian (MJT support) » Fri Oct 29, 2021 8:48 pm

No, but don't forget in Macro Scheduler 15 you can use Python. So if you can do it in Python, use that within Macro Scheduler.
Yes, we have a Custom Scripting Service. Message me or go here

UnknownHost
Newbie
Posts: 4
Joined: Fri Oct 29, 2021 7:08 pm

Re: Advanced Pixel recognition

Post by UnknownHost » Fri Oct 29, 2021 9:07 pm

Yes, that's very correct however I would like it to be a function within MSched tbh, I think we should forward the suggestion of having the function GPC able to search an entire rectangle and not only specific coordiantes, i would love to see that change in the future.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Advanced Pixel recognition

Post by Dorian (MJT support) » Fri Oct 29, 2021 9:47 pm

Noted. Thank you.
Yes, we have a Custom Scripting Service. Message me or go here

UnknownHost
Newbie
Posts: 4
Joined: Fri Oct 29, 2021 7:08 pm

Re: Advanced Pixel recognition

Post by UnknownHost » Fri Oct 29, 2021 10:20 pm

Well, either way, thanks for your reply, I appreciate it, and for everyone else that would go under this same issue that I am having, I found a temporary solution to capture certain pictures which might help you in the future.

There's a technique we use when we set up cameras to capture scenery changes in real life that blitzes off milliseconds and captures thousands of pictures to see every single frame, well I created something similar on a much smaller scale of course because what we're talking about is merely 20-30 frames at most.

What this does is basically capture a huge set of pictures of the specific location I want, then I see the result, keep repeating the process until I see minor changes to what I want, to see the whole animation, then take .BMP pictures of that specific object to then later use for image recognition, and create a whole image recognition code with tons of "or"/"and" depends on what you like, either way here's the technique i thought i'd share it:

Code: Select all

ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen1.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen2.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen3.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen4.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen5.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen6.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen7.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen8.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen9.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen10.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen11.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen12.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen13.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen14.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen15.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen16.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen17.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen18.bmp
Wait>0.1
ScreenCapture>640,0,1260,1062,C:\Users\x\Desktop\x\screen19.bmp
wait>10000
Basically it's a simple code, but the idea behind it is cool, so it captures the screen area I want over and over several times, saves different bmp's, , and then I review them, see the results, and take pictures of the result that I like, repeat the process a couple of times while I repeat the task at hand, and then later on use all of the pictures i've gathered for image recognition, that way it's easier for you to keep doing the task, then make it automatically take pictures.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts