Hi Chris Barker:
I just know you are the author of FloatCanvas, As I asked befor, I want to draw numpy on panel. (Infact I am building a ImageProcessing framework based on wx, which can plugin any numpy based function and libs, such as scipy.ndimage, skimag, opencv, itk..., just like ImageJ, a famous Java app)
I follow floatcanvas for a long time, But I cannot find more information in wx's document, But I found a demo on project's demo folder...(forgive me). I want to make sure two questions:
1. If canvas can update image directly? (I know we can remove the old one, then add the new one, if we can share memory?)
2. I need to draw ROI(Polygon and lines) on canvas, and I need to edit them. If I can use the same memory? when I change a point's xy, then update on canvas? (some times the shape is very complex)
by the way, are you intresting imagepy? I think it's a good project, but I am not very good at ui, (draw numpy, multi thread process and update...)
YXDragon
I need to draw a Numpy array on panel (zoom out and in ...). I use buffer to give the pixel data to the wxbitmap, but I did not find a method in dc can draw bitmap with offset and scale. so I must trans the wxbitmap to wximage, then scale and trans back to wxbitmap to draw.
yes, I think that's what you need to do :-)
though I would suspect that skimage would have a scaling ability -- maybe scale in numpy , then draw to wx.
but it cost so much memory and time (when the picture is large and scale large, a 1000 * 1000 picture scale 100 times will be 100000 * 100000). so I do a lot of work to count the final extent and corp the Numpy array first,
yup -- that's what you need to do -- again, unless skimage has this functionality.
in wx.lib.floatcanvas ScaledBitmap2, that's how I do it -- (though not from a numpy array) -- a bit of finicky code, but you really can't expect to scale up an entire huge image in memory -- so you need to crop it first.
I'm not trying to get any kind of "frame rate" with FC -- but it seems snappy enough.
then: numpy -> bitmap -> image -> scale -> bitmap -> draw. It works, but so complex, and with a bad performance (Far inferior to Java's drawImage...)
you should be able to:
crop_in_numpy->wxImage->scale->wxBitmap-Draw
wxImage is scaling in C++, so you're not going to get much faster unless you can use a particularly smart algorithm (or simple one -- are you interpolation, or ???
I hope that is enough to get you started, or inspire a correction from someone who knows a better way. I should admit that I have not tested this approach thoroughly with Python 3.
nor have I :-(
--
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
wxpython-user...@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.