Closed lookforward-github closed 3 years ago
That method takes an existing buffer into which it'll write data. See:
If you aren't using XAML's WriteableBitmap
you'll need to compute the size of the buffer from the bitmap.
You can also try SoftwareBitmap.LockBuffer, which gets you direct access to the frame of data without making a copy.
Thank you, jonwis. If I use SoftwareBitmap.LockBuffer I have to cast MemoryByffer to IMemoryBufferByteAccess. But I dont know where I can find class which implements this interface or how can I cast MemoryBuffer or MemoryBufferReference to it in Python.
WritebaleBitmap is not available due to I cannot import system.windows.media.imaging
ModuleNotFoundError: No module named 'system' # import system.windows.media.imaging
ModuleNotFoundError: No module named 'winrt.system' # import winrt.system.windows.media.imaging
ModuleNotFoundError: No module named 'winrt.windows.media.imaging' # import winrt.windows.media.imaging
I meant the Windows.UI.Xaml.Media.Imaging.WriteableBitmap type, sorry. @dlech has #743 which adds buffer support; maybe that needs to be expanded to include IMemoryBuffer
?
FYI, https://github.com/microsoft/cppwinrt/pull/956 is required for accessing the buffer from IMemoryBuffer
.
You can find a test build that implements the CPython buffer protocol on IMemoryBufferReference
at https://github.com/dlech/xlang/actions/runs/932253215. Let me know if that works for you.
I'm trying to create application to work with infrared camera.
I'm using pywinrt to get access to camera and Tkinter to render picture as bitmap. In one moment I have to get data buffer from frame reader and I have to pass variable by reference to retrieve it. But Python cant work with references.
My code:
Error message:
How I should correct pass variable?