[python-win32] 2D array from win32com

Filippo Scotti puirippo at gmail.com
Thu Feb 16 22:50:02 EST 2017


Hello,

I am expecting a 720x480 array (safearray, 1 byte/pixel) from the method
below from a camera SDK but win32com is returning a byte buffer of size
720. Extracting the data from the buffer I can get pixel values of only 1
row of pixels and not the entire 2D array. How can I get the 2D array?

I've seen posts on relatively similar topics but couldn't solve the problem.

Thank you for any help that you can provide.

Regards,

Filippo




Python 2.7.6, pywin32 (220)

>>> import win32com.client
>>> import struct
>>> cam=win32com.client.Dispatch(AA)
>>> a=cam.GetRawData()
>>> a
<read-write buffer ptr 0x0000000002D19738, size 720 at 0x0000000002D19700>
>>> len(a)
720
>>> a[0]
'\x12'
>>> struct.unpack('b', a[0])
(18,)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20170216/c63627a8/attachment.html>


More information about the python-win32 mailing list