Faster Alternate For dc.GetPixel?

Hello List,

In my testing with the latest wxpython 2.5
I notcied that the following line takes some time to do:

  lightness = dc.GetPixel(x, y).Red()

It adds changes a normal script that, without the dc Pixel, takes about 6 seconds to run and changes it to 110 seconds. Is there another way that I can get the color of a pixel without having the overhead?

Thanks,
Steve Milner

Steve Milner wrote:

Hello List,

In my testing with the latest wxpython 2.5
I notcied that the following line takes some time to do:

lightness = dc.GetPixel(x, y).Red()

It adds changes a normal script that, without the dc Pixel, takes about 6 seconds to run and changes it to 110 seconds. Is there another way that I can get the color of a pixel without having the overhead?

The speed will probably vary based on what kind of DC that it is and also which platform you are on. As far as speeding it up probably the only way to to keep track of the colour some other way. If there is no way to do that then anohter approach might work depending on what your needs are. For example if you need to traverse the whole DC then blitting to a memoryDC and then converting its bitmap to an wx.Image and accessing the colors from the image may give enough of a boost to justify the conversion to image. Or perhaps just using GetPixel on the memory dc will be fast enough.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Steve Milner wrote:

In my testing with the latest wxpython 2.5
I notcied that the following line takes some time to do:

lightness = dc.GetPixel(x, y).Red()

How many times are you calling this? I've found DC.GetPixel() to be very fast, at least with a wxMemoryDC.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov