c++ - Image not being displayed using webcam in opencv -
i have started learn opencv, stuck in program.
i trying run program displays video in-built webcam.
#include <opencv2\highgui\highgui.hpp> int main() { cvnamedwindow("streaming", cv_window_autosize); cvcapture* capture = cvcreatecameracapture(0); iplimage* frame; while (1) { frame = cvqueryframe(capture); if (!frame) break; cvshowimage("streaming", frame); char c = cvwaitkey(33); if (c == 27) break; } cvreleasecapture(&capture); cvdestroywindow("streaming"); return 0; }
all working fine no errors being thrown, when run program new window named streaming being opened , webcam light switch on (means webcam has started), inspite of no video being displayed in new window opened.
can on this? beginner in this.
thanks in advance!!
i suggest migrating old cv
implementation newly made methods opencv 2
.
take @ videocapture class, has more intuitive methods. example, can use method isopened()
check if webcam has been activated.
there's nice tutorial on here out new methods.
Comments
Post a Comment