Jump to content
tester

Compare 2 bitmaps and locate the difference

Recommended Posts

Hello out there.

 

I think I need some help with a problem which I am confronted now.

 

Example:

I take a screenshot with 1024x768 resolution.

One second later i take another screenshot with the same resolution.

The screenshots differs in one or more sections with a size of 10x10px.

 

These sections are the interesting areas which I need to find.

 

Any ideas?

 

PS: The colors of the sections are changing every 100ms- cause of this fact, a comparison of difference is the only practable way to find them out.

 

Thanks a lot for your help

Link to comment
Share on other sites

ok... first of all, thanks for your answer.

 

Here are some more informations - hints.

 

The objects i want to find are attached to this post. The colours are blue and yellowlike and they are rotating.

 

Maybe it is possible to get the form / profile of it.

 

Any suggestions?

 

PS: the screenshots down below are one and the same screenarea at different times (the colour rotating thing of my first post)

screenshot.18.jpg

screenshot.19.jpg

screenshot.20.jpg

screenshot.21.jpg

screenshot.22.jpg

Link to comment
Share on other sites

Yeah, the Seafight slitters, I've been over this, it's a lot harder than it looks to find, I had a fairly accurate method that I could basically improve by inputting more and more data about them into it, but the approach did have some issues. The way I looked at it was first finding the glitters by comparing the color values of the puts, basically trying to find a pattern and then wait a small amount of time to check whether they had changed. However, these are all calculations that will be fairly to very slow in SCAR.

Link to comment
Share on other sites

Yeah, the Seafight slitters, I've been over this, it's a lot harder than it looks to find, I had a fairly accurate method that I could basically improve by inputting more and more data about them into it, but the approach did have some issues. The way I looked at it was first finding the glitters by comparing the color values of the puts, basically trying to find a pattern and then wait a small amount of time to check whether they had changed. However, these are all calculations that will be fairly to very slow in SCAR.

 

mhhh... ok..

 

My next idea was to put every px in an multi-array and compare each px with the next taken screentshot array. I don't know, think thats too much runtime...

Tricky thing...

 

ahh... next idea..

 

what about to search for the most appearing color on the screenshot (eg. blue for the seamap) and then we just have to look for an 10x10px area where the color ist more different than blue (eg. yellow).

Rule: the px colors nearby or around the 10x10px area should be then most apperaring color blue. (that would mean that we never get slitters near islands or monsters, but better than nothing)

If this area is in the next screenshot different than before, then we have found the shiny/glitter/glitzi/slitters or how is it called.

 

Good, bad or shxxx idea?

 


Yeah, the Seafight slitters, I've been over this, it's a lot harder than it looks to find, I had a fairly accurate method that I could basically improve by inputting more and more data about them into it, but the approach did have some issues. The way I looked at it was first finding the glitters by comparing the color values of the puts, basically trying to find a pattern and then wait a small amount of time to check whether they had changed. However, these are all calculations that will be fairly to very slow in SCAR.

 

mhhh... ok..

 

My next idea was to put every px in an multi-array and compare each px with the next taken screentshot array. I don't know, think thats too much runtime...

Tricky thing...

 

ahh... next idea..

 

what about to search for the most appearing color on the screenshot (eg. blue for the seamap) and then we just have to look for an 10x10px area where the color ist more different than blue (eg. yellow).

Rule: the px colors nearby or around the 10x10px area should be then most apperaring color blue. (that would mean that we never get slitters near islands or monsters, but better than nothing)

If this area is in the next screenshot different than before, then we have found the shiny/glitter/glitzi/slitters or how is it called.

 

Good, bad or shxxx idea?

 

 

 

harrr... think i've got a solution.

 

Step1: take screenshot 1 and put every px and colour in an 1. array.

Step2: take screenshot 2 and put every px and colour in an 2. array.

Step3: find every difference- first hitrate should be very negative (driving ships, acting monsters eg.)

Step4: take screenshot 3 and put every px and colour in an 3. array.

Step5: check every founded slitter coordinate from Step 3 in the 3. array. If there are still changing colours at the spots, then we have found the slitters.

 

 

mhh. waiting for my lunchbreak. then i'm going to test it.

 

 

Link to comment
Share on other sites

I am just working on the same shit :)

 

and freddy i love you for Scar 3.28 - this is exactly what i just need :)

 

and by the way - iam still not able with 3.27 even with reinstalling to get my functions list back

 

its still grey and i cannot activate it again :(

 

this really sucks ... you got a hint for me how to get the list back or do i have to reinstall windows XP complete ?

 

greetz

 

 

edit: yiha i found out that i still have the list in portable version :)

Link to comment
Share on other sites

I am just working on the same shit :)

 

and freddy i love you for Scar 3.28 - this is exactly what i just need :)

 

and by the way - iam still not able with 3.27 even with reinstalling to get my functions list back

 

its still grey and i cannot activate it again :(

 

this really sucks ... you got a hint for me how to get the list back or do i have to reinstall windows XP complete ?

 

greetz

 

 

edit: yiha i found out that i still have the list in portable version :)

 

I wasn't aware you had this issue, I've had this myself though, I'm not sure what the exact cause is, but you can easily fix it. Close SCAR and then go into "C:\Users\[You]\AppData\Local\SCAR Divi\" and delete "docks-settings.isf", then start SCAR again. I'll probable remove saving the dock settings in 3.28 anyway since it's not that important.

Link to comment
Share on other sites

I am just working on the same shit :)

 

and freddy i love you for Scar 3.28 - this is exactly what i just need :)

 

and by the way - iam still not able with 3.27 even with reinstalling to get my functions list back

 

its still grey and i cannot activate it again :(

 

this really sucks ... you got a hint for me how to get the list back or do i have to reinstall windows XP complete ?

 

greetz

 

 

edit: yiha i found out that i still have the list in portable version :)

 

 

Hi out there.

 

 

@wundertüte any more ideas for the glitzi / slitter thing?

 

putting each px colour into an array is just to slow... needed minutes over minutes for it.

 

Link to comment
Share on other sites

I am just working on the same shit :)

 

and freddy i love you for Scar 3.28 - this is exactly what i just need :)

 

and by the way - iam still not able with 3.27 even with reinstalling to get my functions list back

 

its still grey and i cannot activate it again :(

 

this really sucks ... you got a hint for me how to get the list back or do i have to reinstall windows XP complete ?

 

greetz

 

 

edit: yiha i found out that i still have the list in portable version :)

 

 

Hi out there.

 

 

@wundertüte any more ideas for the glitzi / slitter thing?

 

putting each px colour into an array is just to slow... needed minutes over minutes for it.

 

 

hmm it is possible to do this faster... think of your logical structure again

 

if you wait for colorchange between each point and do one point after one is slow

 

you have to scan all for colors and then wait for change and then scan again...

 

Link to comment
Share on other sites

What I would do is:

 

Split the whole area into little bitmaps, then use For i := 0 to High(BitmapArray)

If not findbitmap(....) then Result that Bitmap coords.

 

 

~Home

 

Even that will take time since he said one or more areas of 10 x 10 pixels change and i'm not sure if we can find out what changed in the 100-200ms time. If it were upto me i would get the colors of the changing thing, use ACA and find out the tolerance/whatever put them in an array and search the whole screen using getcolorstolerance or similar then split the TPA using splittpa which hopefully should work, but im not sure how long that will take.

Link to comment
Share on other sites

Hi,

 

I've got another question about the scar-divi and the comparing thing.

 

Is it possible to exclude my screenshotfiles into another scar-file.

 

It looks very nasty, when i got all my "bitmapfromstring" variables in my main form?

 

Thx for your help out there.

Link to comment
Share on other sites

Yes, you can create a method in another scar file, containing all of the bitmapfromstring code and all of the variables and use {.include file.Scar} to include it in your script. The include would look something like:

 

[scar]var

bmp1, bmp2, ...: Integer;

 

procedure LoadBitmaps;

begin

bmp1 := BitmapFromString(...);

bmp2 := BitmapFromString(...);

...

end;[/scar]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...