[wxPython-users] speed up display of image data from 3rd party C++
extension
Christopher Barker
Chris.Barker at noaa.gov
Tue Feb 13 15:31:10 PST 2007
F. Oliver Gathmann wrote:
> I would like to speed up the process of getting image data from my
> custom C++ image processing extension into my wxPython image viewer
> widget. So far, I have been taking the rather cumbersome route
>
> C++ image -> Python string -> wx.Image -> wx.Bitmap
>
> which is then blitted to the screen, but I would rather do
>
> C++ image -> wx.Bitmap
>
> directly using code similar to the recently added BitmapFromBuffer
> functions. Does this make sense?
It sure does -- that's what it's there for.
> And if it does - I would much rather
> use the wxPython API from within my extension than the other way around,
I'm not sure I quite follow this -- are you saying you want to create a
wxBitmap in your C++ code? I can't help with that, but...
If you make your "C++ Image" follow the Python buffer protocol:
http://docs.python.org/api/abstract-buffer.html
then you should be able to do the wx.BitmapFromBuffer call in Python.
You might also want to consider taking a look at the numpy array
interface/ndarray object spec. It could be handy to make your Images
manipulatable with numpy anyway.
I wish I could help more, but please do report back how it works out for
you, and how you did it.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the wxpython-users
mailing list