[Mono-list] Mono + Webcam (cross-platform solution)?
luis adrian rodriguez muñoz
luisadrianmr83 at gmail.com
Fri Oct 8 18:31:37 EDT 2010
//Sorry here is more explained
//Ok here is the example in Gtk.Window
using System;
using Gtk;
using Emgu.CV;
using Emgu.CV.UI;
using Emgu.CV.Structure;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
// I declared global variables
Gdk.Pixbuf pix;
Emgu.CV.UI.ImageViewer viewer = new ImageViewer(); //create an image
viewer
Emgu.CV.Capture capture = new Capture ();
System.Drawing.Bitmap bitmap = null;
//When we start the form we are gonna use a timer for mono
public MainWindow () : base(Gtk.WindowType.Toplevel)
{
Build ();
//--------------------Event Timer------------------------------
GLib.Timeout.Add (180, new GLib.TimeoutHandler (update_status));
}
//This is the event
private bool update_status ()
{
Image<Bgr, Byte> Photo=capture.QueryFrame();
viewer.Image = Photo;
bitmap = viewer.Image.Bitmap; //this maybe wont appear (.Bitmap), buy just
write it like i did
MemoryStream memor = new MemoryStream ();
bitmap.Save(memor,System.Drawing.Imaging.ImageFormat.Png);
pix = new Gdk.Pixbuf(memor.ToArray());
this.image2.Pixbuf = pix;
memor.Dispose();
return true;
}
//**********************************************************************************
//this is my own Message.Box on linux(monodevelop)
//and it returns a ResponseType that i used for question y other thing
//the same like in visual studio
//**********************************************************************************
using System;
using Gtk;
namespace WebCam.MessageBox
{
/// <summary>
/// Class for simulate a MessageBox
/// </summary>
public static class MessageBox
{
/// <summary>
/// Show
/// </summary>
/// <param name="window">
/// A <see cref="Gtk.Window"/>
/// </param>
/// <param name="dialogflags">
/// A <see cref="Gtk.DialogFlags"/>
/// </param>
/// <param name="msgType">
/// A <see cref="MessageType"/>
/// </param>
/// <param name="btnType">
/// A <see cref="ButtonsType"/>
/// </param>
/// <param name="Message">
/// A <see cref="System.String"/>
/// </param>
/// <returns>
/// A <see cref="Gtk.ResponseType"/>
/// </returns>
/// <remarks>
/// AUTHOR: LUIS ADRIAN RODRIGUEZ MUÑOZ
/// DATE: SEP/30/2010
/// SYSTEM: VISITOR SYSTEM
/// </remarks>
public static Gtk.ResponseType Show(Gtk.Window window,
Gtk.DialogFlags dialogflags,
MessageType msgType,ButtonsType
btnType,string Message,String caption )
{
MessageDialog md = new MessageDialog
(window,dialogflags,msgType,btnType, Message);
md.Title = caption;
ResponseType tp = (Gtk.ResponseType)md.Run();
md.Destroy();
return tp;
}//end Show
}
}//end namesapce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20101008/f1f65b53/attachment.html
More information about the Mono-list
mailing list