<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dipsa.RU &#187; C# и Net</title>
	<atom:link href="http://dipsa.ru/category/csharp/feed/" rel="self" type="application/rss+xml" />
	<link>http://dipsa.ru</link>
	<description>Блог программиста</description>
	<lastBuildDate>Mon, 21 Nov 2011 12:32:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Web-камера в C#</title>
		<link>http://dipsa.ru/2010/06/15/webcam_in_csharp/</link>
		<comments>http://dipsa.ru/2010/06/15/webcam_in_csharp/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 13:03:41 +0000</pubDate>
		<dc:creator>builder</dc:creator>
				<category><![CDATA[C# и Net]]></category>

		<guid isPermaLink="false">http://dipsa.ru/?p=109</guid>
		<description><![CDATA[Заинтересовавшись возможностью подключить web-камеру в свой проект немного погуляв по интернету нашёл сборку для подключения камеры. Пользоваться ей элементарно. Создадим форму с элементом PictureBox (WebFrame), подключаем сборку и пишем: using WebCam_Capture; Код в классе формы: private WebCamCapture webcam; public Form1() { InitializeComponent(); webcam = new WebCamCapture(); webcam.ImageCaptured += new WebCamCapture.WebCamEventHandler(webcam_ImageCaptured); webcam.Start(0); } void webcam_ImageCaptured(object source, [...]]]></description>
			<content:encoded><![CDATA[<p>Заинтересовавшись возможностью подключить web-камеру в свой проект немного погуляв по интернету нашёл <a href="http://sites.google.com/site/webcamlibrarydotnet/wpf-and-csharp-sample-code-and-download" target="_blank">сборку для подключения камеры</a>.</p>
<p>Пользоваться ей элементарно. Создадим форму с элементом PictureBox (WebFrame), подключаем сборку и пишем:</p>
<pre class="brush:csharp">using WebCam_Capture;</pre>
<p>Код в классе формы:</p>
<p><span id="more-109"></span></p>
<pre class="brush:csharp">private WebCamCapture webcam;

public Form1()
{
InitializeComponent();

webcam = new WebCamCapture();
webcam.ImageCaptured += new WebCamCapture.WebCamEventHandler(webcam_ImageCaptured);

webcam.Start(0);
}

void webcam_ImageCaptured(object source, WebcamEventArgs e)
{
Image Frame = e.WebCamImage;
WebFrame.Image = Frame;

/*

//Делает изображение черно-белым

Bitmap Bitmap = new Bitmap(Frame);

int[,] Matrix = new int[320, 240];

for (int y = 0; y &lt; 240; y++)
{
for (int x = 0; x &lt; 320; x++)
{

Matrix[x,y] = (int)((Bitmap.GetPixel(x, y).R + Bitmap.GetPixel(x, y).G + Bitmap.GetPixel(x, y).B) / 3);

Bitmap.SetPixel(x, y, Color.FromArgb(Matrix[x, y], Matrix[x, y], Matrix[x, y]));
}
}

Frame = (Image)Bitmap;

//Второй PictureBox для сравнения
OutFrame.Image = Frame;

*/
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://dipsa.ru/2010/06/15/webcam_in_csharp/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

