我正在进行一个项目,它需要使用RTSP或RTMP向wowza流服务器流。我知道怎么拍录像。我试过使用CvVideoWrier。但这没什么用。
CvCapture cap = CvCapture.FromCamera(0);
cap.SetCaptureProperty(CaptureProperty.FrameHeight, pictureBox1.Height);
cap.SetCaptureProperty(CaptureProperty.FrameWidth, pictureBox1.Width);
while (true)
{
IplImage img = cap.QueryFrame();
Bitmap bm = BitmapConverter.ToBitmap(img);
bm.SetResolution(pictureBox1.Width, pictureBox1.Height);
pictureBox1.Image = bm;
img = null;
bm = null;
}
这就是我到现在为止所做的。请帮帮我..。我在这点上被困了超过两天。
发布于 2015-12-25 13:27:35
using System;
using OpenCvSharp;
namespace EdgeDetect
{
class Template
{
public Template()
{
CvCapture cap = CvCapture.FromCamera(1);
CvWindow w = new CvWindow("Template Matching");
IplImage tpl = Cv.LoadImage("speedlimit55.jpg", LoadMode.Color);
CvPoint minloc, maxloc;
double minval, maxval;
while (CvWindow.WaitKey(10) < 0)
{
IplImage img = cap.QueryFrame();
IplImage res = Cv.CreateImage(Cv.Size(img.Width - tpl.Width + 1, img.Height - tpl.Height + 1), BitDepth.F32, 1);
Cv.MatchTemplate(img, tpl, res, MatchTemplateMethod.CCoeff);
Cv.MinMaxLoc(res, 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);
w.Image = img;
Cv.ReleaseImage(res);
Cv.ReleaseImage(img);
}
}
}
}
https://stackoverflow.com/questions/30167201
复制相似问题