c# - OpenCVsharp: Live streaming -
i working on project requires stream wowza streaming server using rtsp or rtmp. know how capture video. tried using cvvideowrier. didn't work.
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; } this did till now. please me.. stuck @ point more 2 days.
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); } } } }
Comments
Post a Comment