As previously said you have to probably do something like: from System.Windows.Media.Imaging import BitmapSource bitmapsrc = None cam = xiCam() cam.OpenDevice(0) cam.SetParam(PRM.BUFFER_**POLICY, BUFF_POLICY.SAFE) cam.SetParam(PRM.IMAGE_DATA_**FORMAT, IMG_FORMAT.MONO8) cam.StartAcquisition() timeout = 1000 cam.GetImage.Overloads[BitmapSource, int](bitmapsrc, timeout) cam.StopAcquisition()
On Wed, Jan 23, 2013 at 10:07 AM, Daniel Krause < m.daniel.kra...@googlemail.com> wrote: > I tried this approach: > > class PyBitmapSource(BitmapSource): > pass > bitmapsrc = PyBitmapSource() > print bitmapsrc > > The console output does not really change: > TypeError: cannot instantiate abstract class > > > > 2013/1/23 Barton <bar...@bcdesignswell.com> > >> The Python.Runtime is a bit tricky when it comes to out parameters: >> In C# DateTime.TryParse(String, out DateTime) becomes >> >> >>> d = DateTime(0) # just a dummy to call the method on >> >>> d2 = DateTime(0) # another dummy to satisfy the out parameter (could >> be the same instance, d) >> # d3 is were the result is passed out >> >>> result, d3 = d.TryParse("2013/01/22", d2) >> >>> d3.ToString() >> u'1/22/2013 12:00:00 AM' >> >>> # this is the same behavior as iPy >> >> >> >> I can't test this - I'm on Linux, but: >> Here you've given the type (class) >> >> from System.Windows.Media.Imaging import BitmapSource >> bitmapsrc = BitmapSource >> print bitmapsrc >> cam = xiCam() >> cam.OpenDevice(0) >> cam.SetParam(PRM.BUFFER_**POLICY, BUFF_POLICY.SAFE) >> cam.SetParam(PRM.IMAGE_DATA_**FORMAT, IMG_FORMAT.MONO8) >> cam.StartAcquisition() >> timeout = 1000 >> bitmapsrc = cam.GetImage(bitmapsrc, timeout) >> cam.StopAcquisition() >> ## >> >> Console output: >> <class 'System.Windows.Media.Imaging.**BitmapSource'> >> >> What you need is an instance, perhaps: >> bitmapsrc = BitmapSource() # or something to that effect. >> >> >> On 01/22/2013 11:58 AM, Daniel Krause wrote: >> >>> from System.Windows.Media.Imaging import BitmapSource >>> bitmapsrc = BitmapSource >>> print bitmapsrc >>> cam = xiCam() >>> cam.OpenDevice(0) >>> cam.SetParam(PRM.BUFFER_**POLICY, BUFF_POLICY.SAFE) >>> cam.SetParam(PRM.IMAGE_DATA_**FORMAT, IMG_FORMAT.MONO8) >>> cam.StartAcquisition() >>> timeout = 1000 >>> bitmapsrc = cam.GetImage(bitmapsrc, timeout) >>> cam.StopAcquisition() >>> ## >>> >>> Console output: >>> <class 'System.Windows.Media.Imaging.**BitmapSource'> >>> >> >> > > _________________________________________________ > Python.NET mailing list - PythonDotNet@python.org > http://mail.python.org/mailman/listinfo/pythondotnet >
_________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet