public void Stream() { camera.Update(); Bitmap image = camera.CalcBitmap(); System.Diagnostics.Debug.WriteLine("Sending Images"); NetworkStream clientStream = tClient.GetStream(); BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(clientStream, image); }
private void button1_Click(object sender, EventArgs e) { if (!camera.IsConnected()) { camera.Connect(); camera.Update(); MemoryStream ms = new MemoryStream(); camera.CalcBitmap().Save(ms, ImageFormat.Bmp); byte[] bitmapData = ms.ToArray(); MemoryStream stream = new MemoryStream(bitmapData); pictureBox1.Image = new Bitmap(stream); } else { Application.Exit(); } }