C# OpenCV _ 4. 카메라 출력
2020. 7. 8. 20:11ㆍC# 언어/C# OpenCV
반응형

* 포스팅은 "C# 파이썬을 활용한 OpenCV4 프로그래밍" 서적을 기반으로 작성합니다!
* 저자님 블로그에 가시면 더 자세한 방법이 나와있습니다!
076923
C#, Python, OpenCV, Tensorflow, Computer Vision, Machine learning, etc.
076923.github.io
Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using OpenCvSharp; // OpenCVSharp 추가 | |
namespace opencv | |
{ | |
class Program | |
{ | |
private const string VideoFrame = "VideoFrame"; | |
static void Main(string[] args) | |
{ | |
VideoCapture capture = new VideoCapture(0); // 노트북 내장 num = 0번 | |
Mat frame = new Mat(); | |
capture.Set(VideoCaptureProperties.FrameWidth, 640); | |
capture.Set(VideoCaptureProperties.FrameHeight, 480); | |
while (true) | |
{ | |
if(capture.IsOpened() == true) | |
{ | |
capture.Read(frame); | |
Cv2.ImShow(VideoFrame, frame); | |
if (Cv2.WaitKey(33) == 'q') break; | |
} | |
} | |
capture.Release(); | |
Cv2.DestroyAllWindows(); | |
} | |
} | |
} |
출력

V V
반응형