c# - Bitmap error when converting it -


i'm using emgucv create histogram, need bitmap create image<gray, byte>.

when load image file bitmap variable this:

bitmap bmpimg = new bitmap(filepath);

image<gray, byte> emguimg = new image<gray, byte>(bmpimg);

the image creation works fine , i'm able display image. however, need create image image<gray, byte> emguimg structure comes camera.

public struct tframe {     public intptr ancillarybuffer;     public uint ancillarybuffersize;     public uint ancillarysize;     public tbayerpattern bayerpattern;     public uint bitdepth;     public tframectx context;     public timageformat format;     public uint framecount;     public uint height;     public intptr imagebuffer;     public uint imagebuffersize;     public uint imagesize;     public uint regionx;     public uint regiony;     public terr status;     public uint timestamphi;     public uint timestamplo;     public uint width; } 

when create bitmap this:

bitmap bmpimg = new bitmap((int)frame.width, (int)frame.height, stride, pxformat, frame.imagebuffer);

i'm able display image after converting bitmapsource, i'm assuming until point code right.

when try this:

image<gray, byte> emguimg = image<gray, byte>(bmpimg);

i error, exception emgu.cv.cvinvoke

my question .. why on first case, when load image bitmap , pass image image<gray, byte> every thing works fine when create bitmap structure , pass image<gray, byte> exception?

i tried creating image this:

image<gray, byte> emguimg = new image<gray, byte>((int)frame.width, (int)frame.height, stride, frame.imagebuffer);

the same error occurs. =\

help please.

thank you.

[edit1]

the problem 1 *.dll missing. if tutorial on emgucv wiki you'll see recomend copy few *.dlls debug folder. did , more, there're 22 *.dlls in emgu's folder, copied 21 .. , problem missing *.dll 1 noob move .. don't forget copy *.dlls

if exception on line:

image<gray, byte> emguimg = new image<gray, byte>((int)frame.width, (int)frame.height, stride, frame.imagebuffer); 

what values of frame.width, frame.height, , stride. systems use negative height or negative stride differentiate top-down bottom-up pixel order, , library may unhappy that.

or alignment issue.

set breakpoint in debugger , see you're asking library do.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -