← Back to team overview

sikuli-driver team mailing list archive

[Bug 810301] Re: [request] get color of one pixel very fast

 

-- @Brian Parma (bj0) 
Hello.
Actually, Python is faster tha Java. But you use the java.robot and work in jython doesn't change anything about this.
To accelerate your program, you can use the class BufferedImage of Java. The color of a pixel is faster when you obtain from your buffer.

-- @RailMan
In Jython :

from java.awt import Robot
from java.awt import Color
from java.awt import Rectangle

def getListColor(SCREEN, r, g, b):
    i = Robot().createScreenCapture(Rectangle(SCREEN.getX(), 
                SCREEN.getY(), SCREEN.getW(), SCREEN.getH()))
    c = Color(r, g, b)
    l = []
    for x in range(0, SCREEN.getW()):
        for y in range(0, SCREEN.getH()):
            if c == Color(i.getRGB(x, y)):
                l.append(Location(x, y))
    return l
# For the list of black Pixel
l = getListColor(SCREEN, 0, 0, 0) 

-- @EveryOne
Hope it's help.
Regards.

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/810301

Title:
  [request] get color of one pixel very fast

Status in Sikuli:
  In Progress

Bug description:
  I would like a function that can return to me the RGB value of a
  single pixel either within a Region or relative to a Screen (I don't
  care which), but it must be fast. By fast, I mean that I should be
  able to sample roughly 500 different pixels at 30Hz. Therefore, I
  don't want any image processing going on during this operation.

  AutoIt3 (on Windows) can (in conjunction with OLE) sample individual
  pixels from any scripting language incredibly fast, and I would like
  the same capabilities on Mac and Linux. Sikuli looks very promising,
  but appears to be missing this feature, so I would like to request it.

  Thank you!

  -- Glenn

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/810301/+subscriptions


References