Problem with System.ArgumentException in call to method from dll
I want to use a method from an API to control a camera (xiApi.NETX64.dll).
The method is described in two ways:
//
void GetImage( out WriteableBitmap image, int timeout)
Description : This function acquires image and returns fills WritableBitmap
object. Supports UNSAFE buffer policy mode.
Parameters :
out WriteableBitmap image : WPF BitmapSource to be filled.
int timeout : Time interval required to wait for the image (in
milliseconds).
//
void GetImage(WriteableBitmap image, int timeout)
Description : This function acquires image and returns fills WritableBitmap
object. Supports SAFE buffer policy mode.
Parameters :
WriteableBitmap image : WPF BitmapSource to be filled.
int timeout : Time interval required to wait for the image (in
milliseconds).
//
The code in a c#-sample looks like this (I skipped the initialisation of
myCam, but if it helps I can provide the complete code):
//
using System.Windows.Media.Imaging;
int timeout = 10000;
BitmapSource myBitmapSrc;
myCam.GetImage(out myBitmapSrc, timeout);
//
This code I can compile, and it is working.
I tried to keep the python code as close as possible, but I get errors I do
not understand:
##
import clr
import sys
sys.path.append("C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\WPF")
clr.AddReference("PresentationCore")
clr.AddReference("xiAPI.NETX64")
from xiApi.NET import *
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:
participants (5)
-
Barton
-
brad@fie.us
-
Daniel Krause
-
Jeffrey Bush
-
Tribble, Brett