Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to cast 'System.IntPtr' to 'float[]'?

Tags:

c#

converters

How can I get a float[] for this IntPtr so I can operate on it? Or please let me know any method can be operated. (I've tried using Array, Marshaling but all doesn't operate.) Please see the following.

Any help would be appreciate!

IntPtr pt = IntPtr.Zero;
Camera.Memory.ToIntPtr(s32MemID, out pt);

MIL.MbufPut(MilImage, pt); 

> C:\Ctest\idsCS\idsCS\Form1.cs(100,35): error CS1503: Argument '2': cannot convert from 'System.IntPtr' to 'float[]'

Syntax for those methods

uEye.Memory.ToIntPtr(out System.IntPtr ptr)
**uEye.Memory.ToIntPtr**(int s32MemId, out System.IntPtr ptr)

Description
Returns a pointer to the image memory of the active/given image memory ID.

Parameter

s32MemId(Image memory ID)

ptr(Pointer to the image memory)
  void **MbufPut**(
  MIL_ID DestBufId,  //in  
const void *UserArrayPtr  //in  
)
like image 269
shko Avatar asked Apr 10 '26 16:04

shko


1 Answers

Use Marshal.Copy (this overload: http://msdn.microsoft.com/en-us/library/a53bd6cz(v=vs.80).aspx )

like image 177
Jcl Avatar answered Apr 12 '26 06:04

Jcl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!