how to get IntPtr data from byte[]

asked 2014-07-07 21:59:09 -0500

there are already image data in byte[] arr, 3 channels of bmp file, and also a MIplImage raw reated for it. how to get raw.imageData from arr? using CvInvoke.cvSetData() failed, as 2 parameters both need IntPtr type; using Marshal.StructureToPtr() passed compile, but crush when runs, indicates "Specify the structure must be able to directly copied to the unit structure, or has the layout information" so, how can I get the imagedata of byte[] into IntPtr for MIplImage?

edit retag flag offensive close merge delete

Comments

Maybe convert it to Mat, then use Mat::convertTo(...) to change it?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2014-07-08 02:37:12 -0500 )edit
1

ppl here can help you with opencv issues, not so much with specific emgu/c# problems.

mind asking here : http://www.emgu.com/forum ?

berak gravatar imageberak ( 2014-07-08 08:15:54 -0500 )edit

@thdrksdfthmn MIplImage inherits from Mat, both of them have the IntPtr data, so I guess Mat will not help.... @berak I already asked on emgu.com at the same time, but also no answers ... http://www.emgu.com/forum/viewtopic.php?f=7&t=4868&p=10040#p10040

alex17swim gravatar imagealex17swim ( 2014-07-08 20:31:39 -0500 )edit

Try it, and post the minimal code, maybe more help will come...

thdrksdfthmn gravatar imagethdrksdfthmn ( 2014-07-09 02:13:19 -0500 )edit