小弟测试如何让两支CCD摄影机同时显示不同画面
但是程式一次都只能抓到其中一台摄影机的画面,程式画面都是显示同一台
已经有使用PYLON VIEWER测试过两台CCD摄影机的功能都是正常的
都有传送封包.想问问各位大大帮忙看一下小弟的程式哪里出错了
private void CaptureCamera()//启动相机的执行续
{
_cameraThread = new Thread(new
ThreadStart(CaptureCameraCallback));
_cameraThread.Start();
}
private void CaptureCameraCallback()
{
CvCapture cap0 = CvCapture.FromCamera(0);//PO0
IplImage tpr = Cv.LoadImage("CaptureR.bmp", LoadMode.Color);//读样
版图档案
CvCapture cap1 = CvCapture.FromCamera(1);//PO1
IplImage tpl = Cv.LoadImage("CaptureL.bmp", LoadMode.Color);//读样
版图档案
CvPoint minloc, maxloc;
double minval, maxval;
myUI("", minloc_X);//minloc_X写为空白
while (true)
{
IplImage img0 = cap0.QueryFrame();
IplImage res0 = Cv.CreateImage(Cv.Size(img0.Width - tpr.Width
+ 1, img0.Height - tpr.Height + 1), BitDepth.F32, 1);//MatchTemplate result的
公式
Cv.MatchTemplate(img0, tpr, res0,
MatchTemplateMethod.SqDiffNormed);//MatchTemplate(image, templ, result,
method) 影像对比
Cv.MinMaxLoc(res0, out minval, out maxval, out minloc, out
maxloc, null);
//Cv.Rectangle(img, Cv.Point(minloc.X , minloc.Y),
Cv.Point(minloc.X + tpl.Width, minloc.Y + tpl.Height), CvColor.Red, 1, 0, 0);
Bitmap bm0 = BitmapConverter.ToBitmap(img0);//将img转成BMP档
bm0.SetResolution(pictureBox2.Width, pictureBox2.Height);//设
定BMP档的分辨率为picturebox2的长宽
pictureBox2.Image = bm0;
IplImage img1 = cap1.QueryFrame();
IplImage res1 = Cv.CreateImage(Cv.Size(img1.Width - tpl.Width
+ 1, img1.Height - tpl.Height + 1), BitDepth.F32, 1);//MatchTemplate result的
公式
Cv.MatchTemplate(img1, tpl, res1,
MatchTemplateMethod.SqDiffNormed);//MatchTemplate(image, templ, result,
method) 影像对比
Cv.MinMaxLoc(res1, out minval, out maxval, out minloc, out
maxloc, null);
//Cv.Rectangle(img, Cv.Point(minloc.X , minloc.Y),
Cv.Point(minloc.X + tpl.Width, minloc.Y + tpl.Height), CvColor.Red, 1, 0, 0);
Bitmap bm1 = BitmapConverter.ToBitmap(img1);//将img转成BMP档
bm1.SetResolution(pictureBox1.Width, pictureBox1.Height);//设
定BMP档的分辨率为picturebox1的长宽
pictureBox1.Image = bm1;
}