[c#][Aforge] 웹캠 영상출력



http://www.codeproject.com/KB/game/VidTextureClassWebcamApp.aspx?msg=2630927
는 속도도 그렇고., 품질이 조금 아닌듯 하여..

Aforge 로 캠영상을 받아서 픽셀을 실시간으로 Texture2D로 카피하는 계획을 세웠다.

우선 Aforge.net 으로 매우 간단한 캠 영상받기


Created with colorer-take5 library. Type 'csharp'

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AForge.Video.DirectShow;
using AForge.Controls;

namespace AforgeTest
{
    public partial class Form1 : Form
    {
        // 크기설정
        int _wid = 640;
        int _hei = 480;


        VideoSourcePlayer player;
        public Form1()
        {
            setPlayer();
            InitializeComponent();

            this.ClientSize = new System.Drawing.Size(_wid, _hei);
            this.Load += new EventHandler(Form1_Load);
            this.FormClosing += new FormClosingEventHandler(Form1_FormClosing);
        }

        //플레이어 셋팅
        void setPlayer()
        {
            player = new VideoSourcePlayer();
            player.Width = _wid;
            player.Height = _hei;
            this.Controls.Add(player);
        }

        //초기화
        void Form1_Load(object sender, EventArgs e)
        {
            //디바이스�� 설정
            FilterInfoCollection device = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            //카메라�� 설정 :: 디바이스�� 0 번째를 가져��다( 카메라가 하나일경우 )
            VideoCaptureDevice cam = new VideoCaptureDevice(device[0].MonikerString);
            //카메라�� fps 설정 :: 안해도 됨
            //cam.DesiredFrameRate = 30;

            //플레이어에 적용 / 시작
            player.VideoSource = cam;
            player.Start();
        }

        //종료
        void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            player.SignalToStop();
            player.WaitForStop();
        }

    }
}





Aforge : http://code.google.com/p/aforge/
            http://www.aforgenet.com/

참고 : http://stackoverflow.com/questions/1789684/webcam-calling-in-xna




추가 :: avi 불러오기
다음과 같이 초기화 하면 된다.


            FileVideoSource video = new FileVideoSource(@"G:\Down\movie.avi");
            player.VideoSource = video;
            player.Start();





속도가... 빠르다..
 

 
Yamecoder 야매코더_
tags : , ,
C# 2010. 12. 4. 02:27

댓글을 달아 주세요

  1. 이전 댓글 더보기
  2. BlogIcon meizitang strong version 2014.10.23 13:52  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  3. BlogIcon barbour sale 2014.10.24 05:59  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  4. BlogIcon woolrich Sito ufficiale 2014.10.24 05:59  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  5. BlogIcon barbour quilted jacket 2014.10.24 07:24  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  6. BlogIcon doudoune moncler fille 2014.11.09 10:36  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  7. 匿名 2014.11.10 17:32  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  8. BlogIcon 眼镜批发市场 2014.11.12 00:50  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  9. BlogIcon moncler hector 2014.11.12 11:44  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  10. BlogIcon moncler 2012 jackets 2014.11.12 11:45  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  11. BlogIcon hogan scarpe donna 2014.11.20 03:29  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  12. BlogIcon Polo Ralph Lauren priser 2014.11.23 08:08  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  13. BlogIcon canada goose kensington parka 2014.12.03 10:45  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  14. 匿名 2015.01.07 17:45  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  15. BlogIcon tiffany co sunglasses 2015.03.05 17:04  수정/삭제  댓글쓰기

    단일you do not need to shop for valium on the drug store across town; you'll be able to shop for indearValium online and feature it delivered for your house.

    Valium is a drug that falls under the eleganceof medicines referred to as "benzodiazepines". Valium works by affecting the chemicals within the brain that do not seem to be balanced and cause anxiety. This drugsis findd so as to regard alcoh니부

  16. BlogIcon burberry parfum femme 2015.03.27 21:10  수정/삭제  댓글쓰기

    분있le mélange de la marinade, la fte des lanternes.李众敏 chose honnte réfuté dit: "il y a un instrument de division. mais principalement dans le sens de l'honneur officier britannique sans compromis, une ère stratégiques à chaque pays est la stratégie agricole ". avant d'édition.Commandant,Cette marque est soumis à des efforts des dé예리

  17. BlogIcon chaussure burberry pas cher 2015.03.31 00:03  수정/삭제  댓글쓰기

    는가URL aIci,sacs burberry相关的主题文章:비가

  18. 匿名 2015.03.31 08:50  수정/삭제  댓글쓰기

    히할Admittedly the Apple names itself is enough to sell most products, however the iPhone 4 proves it is worthy of its popularity with a range of features which exceed what can be found on any other handset.. The latest version operating system has been released to coincide with the iPhone 4, and this is also teamed up with a brand new processor which makes the already speedy iPhone even faster. This 로할

  19. 匿名 2015.04.03 13:49  수정/삭제  댓글쓰기

    메적Lacoste boots and a beret big mesh, or even the entire pleated skirt, tights and wool biker boots. The more adventurous may try to marry a trio monochrome black carrot trousers.



    Badia will be a mini-skirt skater, opaque tights and Minnetonka for a look kindly teenager,Age Compliance - An Unconventional But Valuable Us, as she wants deliciously shifted pair of trousers, sweater and glasses u고메

  20. 匿名 2015.04.03 17:37  수정/삭제  댓글쓰기

    뉴분Fiberglass motorcycle helmets offer an excellent combination of hardness and flexibility and are becoming increasingly popular with all types of bike riders. The outer shells are constructed of laminated fiberglass and designed to absorb as much of the blunt trauma of an impact as possible. They are more likely than plastic to experience shatters and cracks, but this "brittleness" is what gives 법야

  21. 匿名 2015.04.06 01:07  수정/삭제  댓글쓰기

    로던Like the above, knitted hat and a jacket with a lining seam searsucker-like. We're not normally a heavy logo'd pieces, but the embroidered letters feels like a part of the winter-generic design.



    Few have left thoughts about the current collection. Moncler is not for everyone because not everyone can come from the look of nyloned painted in a bright color, but there are some interesting piec뉴그

Powerd by Tistory, designed by criuce
rss