Jump to content

PixelGetColor speed issues


Xibalba
 Share

Recommended Posts

  • Moderators

Would you stop trolling, the guy already said what's it about.

 

How is this kind of post anything but trolling?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

My endgame is live Picture- and Video-analysis and manipulation - so speed is of most importance.

Rest assured though, it's not against any of the forum rules.

If anyone know the GDIPlus equivalent to PixelGetColor(), with a minimalistic example using what is currently shown on the screen, I'd be very grateful.

Thx

Would that not just be a call to GetPixel()

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

  • Moderators

I did read it, just don't see the point of mewling about it :)

 

BTW - "Cursing is the last vestige of the small minded"

Or - "Prestani kukati i jebanja." if you prefer :)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

trancexx,

You make pointed comments like that - you can expect to get pointed responses. ;)

And please moderate your language in future - there is absoutely no need to use such terms in a programming forum. :naughty:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Oh, isn't that absolutely lovely. Go away.

 

 

@Xibalba, gdip solution could be suggested GetPixel(), which written in AutoIt using flat API would be (pay attention that you get ARGB value):

Func GdipBitmapGetPixel($pBitmap, $iX, $iY)
    Local $aCall = DllCall($ghGDIPDll, "long", "GdipBitmapGetPixel", _ ; uses internal _GDIPlus dll handle
            "ptr", $pBitmap, _
            "long", $iX, _
            "long", $iY, _
            "dword*", 0)
    If @error Or $aCall[0] Then Return SetError(1, 0, 0)
    Return $aCall[4] ; ARGB
EndFunc
Latest standard GDIPlus.au3 has this function also, it's called _GDIPlus_BitmapGetPixel().

 

Just to show that it works here's small example of drawing section of screen using absolutely dumb method of colored labels which rapes the AutoIt GUI feature:

#include <GDIPlus.au3>
#include <ScreenCapture.au3>

_GDIPlus_Startup()

Global $hBMP = _ScreenCapture_Capture("")
Global $pBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBMP)

; Display 100 X 150 region of screen with pixel size of 2 (granulation)
CreateGUI_Thing($pBitmap, 100, 150, 2)


_GDIPlus_BitmapDispose($pBitmap)
_WinAPI_DeleteObject($hBMP)

_GDIPlus_Shutdown()



Func CreateGUI_Thing($pBitmap, $iX_Size, $iY_Size, $iPixelSize)
    GUICreate("My Super Duper Capture", $iX_Size + 20, $iY_Size + 20)

    ; Draw little labels colored based on pixel color of the gdip bitmap
    Local $iColor
    For $i = 1 To $iX_Size Step $iPixelSize
        For $j = 1 To $iY_Size Step $iPixelSize
            $iColor = BitAND(_GDIPlus_BitmapGetPixel($pBitmap, $i, $j), 0xFFFFFF) ; RGB portion of the color extracted
            GUICtrlCreateLabel("", 10 + $i, 10 + $j, $iPixelSize, $iPixelSize)
            GUICtrlSetBkColor(-1, $iColor)
        Next
    Next

    GUISetState(@SW_SHOW)
    While 1
        If GUIGetMsg() = -3 Then ExitLoop
    WEnd
    GUIDelete()
EndFunc
So the idea would be to capture the screen into bitmap object and read pixel from that. I'm not sure that's the best idea because screen capturing takes time also.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

  • Moderators

trancexx,

Oh, isn't that absolutely lovely. Go away.

Absolutely no chance. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

trancexx,

You flatter yourself - nothing would please me more than never having to have anything to do with you ever again. So you stop causing me to be called into threads to moderate and then I will have no reason to be there. Your choice. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

<Watching Melba retch into a bucket at the thought> :x

 

@Xibalba, we will actually get back to answering your question after a short interlude :)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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
 Share

×
×
  • Create New...