How to reduce size of image captured from webcam

I am using a webcam to capture images in Silverlight. Is there a way to configure the webcam to catch images with a lower resolution?


http://programmerpayback.com/2010/01/21/use-silverlight-to-resize-images-and-increase-compression-before-uploading/

public static WriteableBitmap GetImageSource(Stream stream, double maxWidth, double maxHeight)
{
      BitmapImage bmp = new BitmapImage();
      bmp.SetSource(stream);

      Image img = new Image();
      img.Effect = new DropShadowEffect() { ShadowDepth = 0, BlurRadius = 0 };
      img.Source = bmp;

      double scaleX = 1;
      double scaleY = 1;

      if (bmp.PixelHeight > maxHeight)
          scaleY = maxHeight / bmp.PixelHeight;
      if (bmp.PixelWidth > maxWidth)
          scaleX = maxWidth / bmp.PixelWidth;

      // maintain aspect ratio by picking the most severe scale
      double scale = Math.Min(scaleY, scaleX);

      return new WriteableBitmap(img, new ScaleTransform() { ScaleX = scale, ScaleY = scale });
  }
链接地址: http://www.djcxy.com/p/81030.html

上一篇: “从网络摄像头捕捉图像”再次

下一篇: 如何减少从网络摄像头捕获的图像的大小