c# and Motion C5 SDK

c# and Motion C5 SDK

I'm using the Motion C5 1.11.2 SDK and trying to hack my way through integrating the camera with my application. All is going well, except that I don't have the demo apps so I'm stuck. I'm trying to take a picture and save it to disk. I'm able to get the preview to a panel to work and I'm able to get the capture to work. From what I've read, the image is stored in the Camera.Images property and that it is in a bitmap format. Unfortunately, I'm stuck using the COM wrapper and I need to change the Camera.Images to something (besides object) so I can extract the bitmap from the collection. Here is my code:

private void button1_Click(object sender, EventArgs e) {
this._camera.CaptureFrame();

Bitmap bmp = (Bitmap)this._camera.Frames;

bmp.Save("test.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
}

I honestly have no idea where to go from here. If someone could point me in the right direction I would really appreciate it.

Jason

5 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

Hi jasonw,

The internal format is a bitmap. You can save it to a file in .BMP format with:

myFrame.Image.Save ("MyImage.bmp");

If you search the MCA SDK forum using the keyword image you will find quite a bunch of discussion on this topic.

Also, please note that with MCA SDK 2.0 there is increased camera support. All the supported camera modes are no listed, ie. image and video resolutions, and video frame rate to enable the application to set the optimal settings for image and video capture. GIF and TIFF image formats are also supported.

Thanks,
Steve

Steve,

Thanks for the help. My issue was in converting the COM based stuff to .Net stuff since the current dev kit that the C5 has only provides the COM based IntelHealthCareLib.dll. For anyone interested, to get the COM stuff to work with C# and get a bitmap image that can be manipulated and saved, you can use the following code:

this._camera.CaptureFrame();

Frames tmp = (Frames)this._camera.Frames;

Frame tmpFrame = (Frame) tmp[0];

using (MemoryStream ms = new MemoryStream((byte[])tmpFrame.RawImage)) {
using (Bitmap bmp = new Bitmap(ms)) {
bmp.Save("test.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
}
}

This code can probably be cleaned up a bunch since it was me hacking around trying to get things to work, but this captures an image and saves it to the same directory as the program in jpeg format. You could make modifications to the image before saving in memory, but you need to leave the MemoryStream open while working with the image.

Thanks Jason for the feedback. We always appreciate those of you willing to share your code samples with the rest of us.

-Steve

Quoting - Steven Murray (Intel)

Thanks Jason for the feedback. We always appreciate those of you willing to share your code samples with the rest of us.

-Steve, Thank you,clothes fashion korean wholesale fashion fashion wholesale fashion models garment. Movie film phim phim online viet entertainment phim han quoc drama clips

5 star rated.. for those who are willing to help when people in need is even more appreciated. I just discovered this forum(omg) and found out it might have saved me times aton before instead of sitting there knocking my head googling around. The little search button on top left corner is very helpful too

Sincerely,

Laisser un commentaire

Veuillez ouvrir une session pour ajouter un commentaire. Pas encore membre ? Rejoignez-nous dès aujourd’hui