κ°œλ°œπŸ’»/OpenCVSharp

[OpenCVSharp] λ™μ˜μƒνŒŒμΌ μž¬μƒν•˜κΈ°

VIP 2017. 2. 10. 10:03
728x90
λ°˜μ‘ν˜•

- 쑰건

1. VisualStudio 2015

2. OpenCVSharp 2.4.10



- μ°Έμ‘°λΆ€λΆ„



- μ†ŒμŠ€μ½”λ“œ
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
using OpenCvSharp;
using OpenCvSharp.CPlusPlus;
using OpenCvSharp.Extensions;
 
namespace WindowsFormsApplication3
{
    public partial class Form1 : Form
    {
        IplImage frame1;
 
        CvCapture capture1;
        
        public Form1()
        {
            InitializeComponent();
 
            Video_Overlay();
        }
 
 
        public void Video_Overlay()
        {
            capture1 = CvCapture.FromFile("C://drop.avi");
     
            while (true)
            {
                frame1 = Cv.QueryFrame(capture1);
         
                if (frame1 == null)
                {
                    capture1 = CvCapture.FromFile("C://drop.avi");
                    continue;
                }
 
                Cv.ShowImage("Test", frame1);
                if (Cv.WaitKey(33== 27)
                    break;
            }
            Cv.ReleaseCapture(capture1);
            Cv.DestroyWindow("Test");
        }
    }
}
cs

- frame1 값이 null이면 λ‹€μ‹œ capture1 λ³€μˆ˜μ— λ™μ˜μƒ νŒŒμΌμ„ ν• λ‹Ήν•¨μœΌλ‘œμ¨ λ™μ˜μƒμ΄ λ¬΄ν•œμœΌλ‘œ μž¬μƒλ˜λ„λ‘ μ„€μ •

- λ™μ˜μƒ νŒŒμΌμ„ ν•œλ²ˆλ§Œ μž¬μƒν•˜κ³  μ’…λ£Œν•˜κ³  μ‹ΆμœΌλ©΄ μ•„λž˜μ™€ 같이 ifλ¬Έ μˆ˜μ •

1
2
3
4
if (frame1 == null)
{
    break;
}
cs


- κ²°κ³Όν™”λ©΄



좜처 : http://dsnight.tistory.com/20
λ™μ˜μƒ(avi) 좜처 : http://www.engr.colostate.edu/me/facil/dynamics/avis.htm


728x90
λ°˜μ‘ν˜•