Type conversion problem #2375
feketeimre
started this conversation in
General
Replies: 2 comments 1 reply
-
Hi I got the same question. Did you figure it out? Like how to convert imgBuf into the ref type needed in C# function? Thank you! |
Beta Was this translation helpful? Give feedback.
1 reply
-
I spent time on this and managed to figure it out, sort of... # System.ArgumentException: PylonC.NET.PylonBuffer`1[System.Byte] value cannot be converted to PylonC.NET.PylonBuffer`1[T] in method ..... Apparently, you can construct a specific type of the function like: grabFrame = Pylon.DeviceGrabSingleFrame[Byte]
ret = grabFrame(hDev, Int32(0), imgBuf, grabResult, UInt32(500)) In most cases i think this would work, but in my case i need to pass imgBuf and grabResult by reference that cannot be done in pythonnet. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to interface with a .NET dll to read stuff from a camera and i have trouble figuring out the types for a function call. Admittedly i have just started using pythonnet so my problem might be trivial.
Here is the truncated version of my program:
I have doubts if the imgBuf = PylonBufferByte is equivalent to the original c: PylonBuffer imgBuf = null;

But mainly the type conversion error is what i have no idea why it doesnt work. I am certain that Byte is a valid type for PylonBuffer.
With dnSpy i looked into the problematic function and found this:
Also im not sure how to deal with the ref and out keywords.
Any help is welcomed,
Thank you
Beta Was this translation helpful? Give feedback.
All reactions