c# - Capturing an image with Emgu - black image -
i'm newbie in emgu cv , major project i'm trying capture image webcam , show in image box, it's showing black image.
what wrong following code?
using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using emgu.cv; using emgu.cv.structure; using emgu.cv.ui; using emgu.util; namespace windowsformsapplication7 { public partial class form1 : form { private capture capture; public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { if (capture == null) capture = new capture(); image<bgr,byte> img=capture.queryframe(); imagebox1.image = img; } } }
i think there minor mistake.
use instead:
declare global variable:
capture capture = default(capture);
put in load:
capture = new capture(0); control.checkforillegalcrossthreadcalls = false; system.threading.thread t = new system.threading.thread(grab); t.start();
create sub grab , put in,
do { imagebox1.image = capture.queryframe(); } while (true);
cheers
shreyas
Comments
Post a Comment