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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | using OpenCvSharp; using OpenCvSharp.CPlusPlus; using OpenCvSharp.Extensions; namespace WindowsFormsApplication3 { public partial class Form1 : Form { IplImage frame1, frame2; CvCapture capture1, capture2; IplImage resize1, resize2, resize3; int w, h; public Form1() { InitializeComponent(); Video_Overlay(); } public void Video_Overlay() { capture1 = CvCapture.FromFile("C://drop.avi"); capture2 = CvCapture.FromFile("C://bird.avi"); w = capture2.FrameWidth; h = capture2.FrameHeight; // capture2 ์์ ์ฌ์ด์ฆ ํต์ผ resize1 = Cv.CreateImage(Cv.Size(w, h), BitDepth.U8, 3); resize2 = Cv.CreateImage(Cv.Size(w, h), BitDepth.U8, 3); resize3 = Cv.CreateImage(Cv.Size(w, h), BitDepth.U8, 3); while (true) { frame1 = Cv.QueryFrame(capture1); frame2 = Cv.QueryFrame(capture2); if (frame1 == null) { capture1 = CvCapture.FromFile("C://drop.avi"); continue; } if(frame2 == null) { capture2 = CvCapture.FromFile("C://bird.avi"); continue; } Cv.Resize(frame1, resize1); Cv.Resize(frame2, resize2); Cv.Add(resize1, resize2, resize3, null); Cv.ShowImage("Test", resize3); if (Cv.WaitKey(33) == 27) break; } Cv.ReleaseCapture(capture1); Cv.ReleaseCapture(capture2); Cv.DestroyWindow("Test"); } } } | cs |
- ์ฌ์ด์ฆ๊ฐ ๋ค๋ฅธ ๋ ๊ฐ์ ๋์์์ capture1, capture2์ ์ ์ฅํ ํ, capture2์ ์ ์ฅ๋ ๋์์ ์ฌ์ด์ฆ๋ก ๋๊ฐ์ ๋์์ ์ฌ์ด์ฆ๋ฅผ Resize ํ๋ค.
- ๋์์ ์ถ๋ ฅ ์, ๋๊ฐ์ ๋์์ ์ฌ์ ์๊ฐ์ด ๋ค๋ฅด๋ฏ๋ก Cv.Add์์ Null ์์ธ๊ฐ ๋ฐ์ํ๋ค. ๋ฐ๋ผ์ ๊ฐ frame1, frame2์ ์ ์ฅ๋ ๋์์ ์ฌ์์ด ๋ค ๋๋์ null์ด ๋์์ ๊ฒฝ์ฐ ๋ค์ํ๋ฒ ๋์์ ํ์ผ์ ์คํํ์ฌ capture1, capture2 ๋ณ์๋ฅผ ์ด๊ธฐํ ์์ผ์ค๋ค.
- ๊ฒฐ๊ณผํ๋ฉด
์ถ์ฒ : http://dsnight.tistory.com/20
๋์์(avi) ์ถ์ฒ : http://www.engr.colostate.edu/me/facil/dynamics/avis.htm
728x90
๋ฐ์ํ
'๊ฐ๋ฐ๐ป > OpenCVSharp' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[OpenCVSharp] ๋์์ํ์ผ ์ฌ์ํ๊ธฐ (0) | 2017.02.10 |
---|---|
[OpenCVSharp] Mat -> Bitmap // Bitmap -> Mat ํ๋ณํ (0) | 2017.02.09 |