本次试验用的WINFORM ,要先绘制窗体 ,自己测试的时候注意对象名就可以了。
public Form1()
{
InitializeComponent();
}
static Mat mat1 = new Mat(@"timg.jpg", ImreadModes.AnyColor);
static Mat result = new Mat();
static OpenCvSharp.Point minLocation, maxLocation;
static Mat src = new Mat();
static Mat grayImage = new Mat();
static Mat ThresholdImage = new Mat();
static Bitmap bitmap, bitmap2, bitmap3;
static VideoCapture capture = new VideoCapture();
int a, b;
//运行摄像头
private void runVideo()
{
FrameSource frame = Cv2.CreateFrameSource_Camera(0);
while (true