스트리밍
- 컴퓨터 화면 실시간 스트리밍 프로그램 만들기 #1 2019.08.03 1
컴퓨터 화면 실시간 스트리밍 프로그램 만들기 #1
2019. 8. 3. 16:49
원리는 간단하다.
1. 0.1초마다 사진을 찍듯 캡쳐를 한다.
2. WinForm의 Picture box에 띄워준다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading;
using System.IO;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
Size sz;
Bitmap bitmap;
Graphics graphics;
Thread thread;
MemoryStream ms;
byte[] buf;
public Form1()
{
InitializeComponent();
graphics = Graphics.FromImage(bitmap);
thread = new Thread(Capture_Thread);
ms = new MemoryStream();
}
public void Capture_Thread()
{
while (true)
{
graphics.CopyFromScreen(0, 0, 0, 0, sz);
try
{
buf = ms.ToArray();
}
catch(Exception e)
{
}
pictureBox1.ImageLocation = "x2.jpg";
Thread.Sleep(100);
}
}
private void button1_Click(object sender, EventArgs e)
{
if (!thread.IsAlive)
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
최종 목표는 이미지를 Byte로 변환하여 TCP 통신하는 것이다.
그리고 현 상태의 문제점은 초당 10 프레임이라는 것.
'C#' 카테고리의 다른 글
Delegate (델리게이트) 사용법 및 예시 (0) | 2019.08.27 |
---|---|
외부 FONT 프로젝트에 적용하기 (0) | 2019.04.06 |
폴더 디렉터리 목록 불러오기 및 수정,삭제,저장 (0) | 2019.03.25 |