Ask Your Question

hoder's profile - activity

2014-03-29 07:30:05 -0500 asked a question Why does my program not show output on namedWindow ?

I am using opencv 2.4.8 on VS express 2013 for desktop.I am using C++ language.

#include "opencv2/highgui/highgui.hpp"
#include "opencv2\imgproc\imgproc.hpp"
int main() {
    cv::namedWindow("Example3", cv::WINDOW_AUTOSIZE);
    cv::VideoCapture cap;;
    if (!cap.isOpened())
        return -2;
    cv::Mat frame;
    while (1) {
        cap >> frame;
        if (! return -1;
        cv::imshow("Example3", frame);
        if (cv::waitKey(33) >= 0) break;
    return 0;

This program is always returning -1 and not showing any output on namedwindow.

But, if I do"file_name"); It gives desired output (i.e. plays the video)
What may be wrong?