Jump to content

Detect pixel changes on specific screen area?


Recommended Posts

Hey.

Is there anything that does the same thing as this?

 

Namely I'm talking about detecting when something has changed on screen.

The FastFind library is crashing without any errors after running:

FFSnapShot($left, $top, $right, $bottom, 0)
FFSnapShot($left, $top, $right, $bottom, 1)
$diff = FFLocalizeChanges(0, 1)

And then trying to overwritite the old snapshot (0 or 1).

If I use always different snapshot numbers its using too much memory and will eventually crash my pc.

I tried downloading older versions but they're not working and the author is inactive.

 

It takes 2 snapshots and compares them returning the area that has changed very quickly (left, top, right ,bottom).

Can anyone help me do this?

Looping PixelGetColor would require a bunch of extra code to my purpose and its not as efficient...

 

Thanks

 

 

Link to post
Share on other sites
7 minutes ago, Nine said:

Ya keep on staying very vague about your "private" application.  Gonna have hard time to find help as nobody can read in crystal ball anymore...

Bro, what are you talking about lmao? I've said exactly what I'm looking for: an alternative for FastFind. Stop trolling. There's nothing complicated about the question. A simple "No" would've sufficied if there's no alternative. Wowwie.

 

Well anyway I somewhat managed to work with PixelGetColor so I'll just go with that and save myself the headache of replying to these or creating a new library.

Link to post
Share on other sites
2 hours ago, JockoDundee said:

Unlikely

Well, he might have found something really great.  So it is understandable that he wants to keep it secret and private.  He might have invented the next generation of FaceBook or Twitter. 

WAIT, he wants to automate it with PixelGetColor, a few MouseClick and lots of Send.  True Robust Software...

Link to post
Share on other sites

how about this?

 


   $winChecksum = PixelChecksum(870, 530, 970, 600)

   Send("{ENTER}")

   While $winCheckSum = PixelChecksum(870, 530, 970, 600)       ;  wait for next panel
       Sleep(100)
   WEnd

Edited by pkil_k
added stuff
Link to post
Share on other sites
10 hours ago, Nine said:

Well, he might have found something really great.  So it is understandable that he wants to keep it secret and private.  He might have invented the next generation of FaceBook or Twitter. 

WAIT, he wants to automate it with PixelGetColor, a few MouseClick and lots of Send.  True Robust Software...

This is how you get your kicks isn't it? That's sad.. No I haven't 'invented' anything, there's no hill billy harry potter stuff going on. I just wanted to detect what area has changed on screen.
But I forgot that this is the internet and people like you exist.
 

 

5 hours ago, pkil_k said:

how about this?

 


   $winChecksum = PixelChecksum(870, 530, 970, 600)

   Send("{ENTER}")

   While $winCheckSum = PixelChecksum(870, 530, 970, 600)       ;  wait for next panel
       Sleep(100)
   WEnd

Thanks but as the function description says:
A checksum only allows you to see if "something" has changed in a region - it does not tell you exactly what has changed.
I need the area that has changed. Apart from that it's also slow. But as I said I already managed to work with PixelGetColor since I'm just getting trolled here (not by you).

Link to post
Share on other sites
50 minutes ago, kellariluukku said:

A checksum only allows you to see if "something" has changed in a region - it does not tell you exactly what has changed.
I need the area that has changed. 

That’s exactly what it tells you, the area changed is the region you define.

54 minutes ago, kellariluukku said:

Apart from that it's also slow.

Well, they are both a bit slow for my taste, but if the total area that you need to monitor for changes is more than a few hundred pixels or so, it’s way quicker to use multiple pixelchecksums in a binary search until your target area is small enough to brute thru pixelgetcolor.

 

 

Code hard, but don’t hard code...

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Dave1
      Hello everyone,
      I have several signals on the screen that need to be monitored while a program is running. These signals are scattered around an image which is maximized on 4  equal resolution screens - the AutoIT Window Info does not recognize any objects on the program meaning that I'm left with the PixelSearch() and PixelCheckSum() functions to monitor the signals:
      The signals are as small as a 5x5 pixel area and their coordinates are known.
      I've been digging around for a while now in this forum about the PixelSearch() and PixelCheckSum()  and found some interesting and useful ideas for the use of them. I also came across some other UDF functions like MultiMon(), FastFind(), TtColXY() and the ImageSearch2015 scripts that might be useful for the final output. I don't know if hovering the mouse by using TtColXY() and output its ToolTip() information onto the log file will be faster than using PixelSearch() and/or PixelCheckSum() in a loop for all signals' coordinates.
      The colours of the signals are below:
      red - 0x00FF00 (opaque red)
      green - 0x00FF00 (opaque green)
      yellow - 0xFFFF00 (opaque yellow)
      black - 0x000000 (opaque black, default colour)
      EDIT:
      The desired output is to monitor and record/log the changes and status of each inside a .txt file or a .csv with the below format: 
      Local Machine Time        Signal,      Change,               delta-t
      14:32:07                  Signal1     Green - Yellow         DELTA-t1
      14:34:02                  Signal1     Yellow - Red           DELTA-t1
      14:35:14                  Signal2     Yellow - Red           DELTA-t2
      ...
      Below is the code I came up with. 
      #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> #include <misc.au3> #include <Date.au3> #include <Array.au3> #include <File.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> #include <WinAPIHObj.au3> Global $program_name, $program_open, $Wname, $tCurrent Global $button_xy[2] = [150, 175] Global $iniColour, $ColourCheck, $NewCheck Global $Red, $Green, $Blue, $Nil Global $sFilePath = @ScriptDir & "\Signals_status.txt" Global $SignalID[10] = ["Signal_1", "Signal_2", "Signal_3", "Signal_4", "Signal_5", "Signal_6", "Signal_7", "Signal_8", "Signal_9", "Signal_10"] $program_name = "Signals.exe" $Wname = "Training Task 3" $program_open = ShellExecute($program_name, @ScriptDir) WinWait($Wname) $iniColour = "0x" & Hex(PixelGetColor($button_xy[0], $button_xy[1]), 6) ;~ $iniChecksum = "0x" & Hex(PixelChecksum($button_xy[0], $button_xy[0] - 5, $button_xy[1], $button_xy[1] + 5), 6) $ColourCheck = "0x" & Hex(PixelChecksum($button_xy[0], $button_xy[0] - 5, $button_xy[1], $button_xy[1] + 5, 1, $Wname), 6) ConsoleWrite(_ColourID($iniColour) & " // " & _ColourID($ColourCheck) & @CRLF) ;~ $ColourCheck = "0x " & Hex(PixelGetColor($button_xy[0], $button_xy[1]), 6) $iniColour = $ColourCheck ;$iniChecksum = $currentCheck Do ;~ While 1 _WindowOnTop() _Close_Notepad() $NewCheck = "0x" & Hex(PixelChecksum($button_xy[0], $button_xy[0] - 5, $button_xy[1], $button_xy[1] + 5, 1, $Wname), 6) $tCurrent = _NowCalc() $LogFile = FileOpen($sFilePath, 2) FileWriteLine($LogFile, "Local Machine Time " & "Signal, " & "Change, " & "delta-t") ;~ $ColourCheck = "0x" & Hex(PixelChecksum($button_xy[0], $button_xy[0] - 5, $button_xy[1], $button_xy[1] + 5, 1, $Wname), 6) If $ColourCheck <> $NewCheck Then ;If there's a colour change from the current colour $ColourCheck = $NewCheck Local $tChange, $NewCheckID, $ColourCheckID, $sLogMsg $tChange = _NowCalc() ConsoleWrite("Colour changed!" & @CRLF) $ColourCheckID = _ColourID($ColourCheck) $NewCheckID = _ColourID($NewCheck) $iTimeDiffh = _DateDiff('h', $tChange, $tCurrent) ; time difference in hours $iTimeDiffm = _DateDiff('n', $tChange, $tCurrent) ; time difference in minutes $iTimeDiffs = _DateDiff('s', $tChange, $tCurrent) ; time difference in seconds $durationCheckSum = $iTimeDiffh & ":" & $iTimeDiffm & ":" & $iTimeDiffs ; Timestamp of the signal until PixelCheckSum $sLogMsg = " " & $SignalID[0] & " " & $ColourCheckID & " - " & $NewCheckID & " " & $durationCheckSum _FileWriteLog($LogFile, $sLogMsg) ElseIf $ColourCheck = $NewCheck Then Local $Colour_check = _ColourID("0x" & Hex(PixelChecksum($button_xy[0], $button_xy[0] - 5, $button_xy[1], $button_xy[1] + 5, 1, $Wname), 6)) ConsoleWrite($tCurrent & " " & $Colour_check & @CRLF) EndIf FileClose($sFilePath) Until Not ProcessExists($program_name) And Not WinExists($Wname) _IsProgramOpen() Func _Close_Notepad() $notepad_open = ProcessExists("notepad.exe") ? ProcessClose("notepad.exe") : ProcessClose("notepad.exe") $notepad_open = WinActive("[CLASS:Notepad]") ? WinClose("[CLASS:Notepad]") : ProcessClose("notepad.exe") EndFunc ;==>_Close_Notepad Func _ColourID($sColour) $Red = Int("0x" & StringRegExpReplace($sColour, "(..)(..)(..)(..)", "\2")) $Green = Int("0x" & StringRegExpReplace($sColour, "(..)(..)(..)(..)", "\3")) $Blue = Int("0x" & StringRegExpReplace($sColour, "(..)(..)(..)(..)", "\4")) If $Green > $Blue And $Red > $Blue And $Green >= 0xB0 And $Red >= 0xB0 Then $sCol = "Yellow" ElseIf $Blue > 0xE0 And $Green > 0xE0 And $Red > 0xE0 Then $sCol = "White" ElseIf $Blue > 0x50 And $Blue = $Green And $Blue = $Red Then $sCol = "Grey" ElseIf $Red > $Green And $Red > $Blue And $Red > 0x70 Then $sCol = "Red" ElseIf $Green > $Red And $Green >= $Blue And $Green > 0x70 Then $sCol = "Green" ElseIf $Blue > $Red And $Blue > $Green And $Blue > 0x70 Then $sCol = "Blue" Else $sCol = "Nil" EndIf Return $sCol EndFunc ;==>_ColourID Func _WindowOnTop() WinActivate($Wname) WinSetOnTop($Wname, "", $WINDOWS_ONTOP) Opt("MouseCoordMode", 0) EndFunc ;==>_WindowOnTop Func _IsProgramOpen() If Not ProcessExists($program_name) And Not WinExists($Wname) Then Break(1) EndIf EndFunc ;==>_IsProgramOpen When the program is running, the window opens in the centre of the screen however, the PixelChecksum function is not looking at the correct area. In addition:
      1 - I'm not sure about how to put the message into the log file.
      2 - I tested this script but it is not recording the message into the log file.
      3 - Is there other way to calculate the duration in these lines?
      $iTimeDiffh = _DateDiff('h', $tChange, $tCurrent) ; time difference in hours $iTimeDiffm = _DateDiff('n', $tChange, $tCurrent) ; time difference in minutes $iTimeDiffs = _DateDiff('s', $tChange, $tCurrent) ; time difference in seconds $durationCheckSum = $iTimeDiffh & ":" & $iTimeDiffm & ":" & $iTimeDiffs ; Timestamp of the signal until PixelCheckSum $sLogMsg = " " & $SignalID[0] & " " & $ColourCheckID & " - " & $NewCheckID & " " & $durationCheckSum _FileWriteLog($LogFile, $sLogMsg) Thanks in advance!
    • By nacerbaaziz
      good morning autoit team
      please i need your help
      am trying to make an program that work with hotkeys
      it function is to change the volume to the current application
      e.g when i select the vlc window by using this hotkey i will be able to change the vlc volume with out changing the system volume.
       am able to get the process handle and the process name of the window
      but when am trying to get or set the volume i does not succeded
      i tried to search in this forums but no result.
      can you please guide me to do that.
      am waiting for your answers
      thanks in advanced
    • By nacerbaaziz
      hello autoit team
      please i've a question for you.
      am creating a audio player
      and in this audio player i want to show the current trac info
      such as the total time and the position ... etc
      i know i can show it as label
      but the screen reader for the blind read the text every change
      because it have a screen scan
      what i want is to show this informations but such image or icon
      i mean i need to create
      GUICtrlCreatepic or GUICtrlCreateicon ....
      or some thing as that
      and show this informations as image on it
      i think that i can do that with the 
      _GDIPlus functions
      but i couldn't find the currect way to do it
      i tried the _GDIPlus_GraphicsDrawString
      but i couldn't know how it work
      what i need is a small example that create a GUI
      and add a multy line text to it as graphic or image.
      so i need a simple way because it will changed every sec
      i hope any one can help me to do that
      global $GUI = GUICreate("text", 400, 400) global $label = GUICtrlCreateLabel(GetText(), 10, 10, 380, 380) GUISetState() do sleep(100) until GUIGetMSG() = -3 exit func GetText() return StringFormat("file name is test.mp3 \r\n total time is 00:30:00 \r\n position is 00:05:50") endFunc  
    • By dejhost
      Happy New Year everyone!
      I would like to extract the color values of certain pixels in an image.  This is how I picture the workflow: 
      User opens an image of his choice. Image is shown on the screen. User draws a line into the image. This happens by marking the startpixel and the endpixel of the line The line is drawn, so the user can check visually if he is happy with the line.  The following pixel based properties belonging to the line are stored in Excel: X-Coordinate Y-Coordinate Color Value Additional operations: Extracting for max- and min. color values; Statistical operations.   Browsing through the helpfile of AutoIt I find plenty of functions for treating images (e.g. GDIPlus), but I am completely unsure if Autoit will get me there. Should I read the entire image into an array? Should I rather attempt to script an external image software (e.g. IrfanView, Gimp)?
      I would be very thankful if someone could give some recommendations and maybe list a couple of the most important commands to use.
      Thank you very much.
      Dejhost
       
       
    • By Nick3399
      I have loaded FastFind into my code and it takes a snapshot and creates a BMP file from it. 
      My issue is now I want to imagesearch from that BMP file (or snapshot memory) and look for a specific image from that image and get the coordinates from that. 
      I have looked at all the documentation but I cannot find anything to assist me.
       
      Does anyone have any idea?
×
×
  • Create New...