Ask Your Question

Revision history [back]

My simple code doesnt work, it says CV_WINDOWS_NORMAL is an undeclared identifier, what should I do, is there some other lib that I need to include?

include <iostream>

include <stdio.h>

include <stdlib.h>

include <opencv2 opencv.hpp="">

include <opencv2 core="" core.hpp="">

include <opencv2 highgui="" highgui.hpp="">

include <opencv2 imgproc="" imgproc.hpp="">

using namespace std; using namespace cv;

int main(int argc, char** argv) {

VideoCapture capture(0);

if (argc == 1 && capture.isOpened() == false)
{
    cerr << "Cannot capture images from the web camera ..." << endl;
    return -1;
}

namedWindow("original", CV_WINDOW_NORMAL);
namedWindow("processed", CV_WINDOW_NORMAL);
namedWindow("blurred", CV_WINDOW_NORMAL);

Mat frame;
Mat grayImage;
Mat processedImage;
Mat bluredImage = frame;
//bluredImage = Scalar::all;
for (int keyCode = -1; keyCode < 0; )
{
    if (argc == 1)
        capture >> frame;
    else
        frame = imread(argv[1], CV_LOAD_IMAGE_COLOR);

    if (frame.empty() == true)
        break;

    cvtColor(frame, grayImage, CV_BGR2GRAY);

    //TODO: Add the selected image processing function calls ...
    cvtColor(frame, processedImage, CV_BGR2GRAY); // This should be replaced!

    medianBlur(frame, bluredImage, 3);

    imshow("original", frame);
    imshow("processed", processedImage);
    imshow("blurred", bluredImage);


    if (argc == 1)
        keyCode = waitKey(10) % 256;
    else
        keyCode = waitKey(0) % 256;
}



destroyWindow("original");
destroyWindow("processed");

}

My simple code doesnt work, it says CV_WINDOWS_NORMAL is an undeclared identifier, what should I do, is there some other lib that I need to include?

include <iostream>

include <stdio.h>

include <stdlib.h>

include <opencv2 opencv.hpp="">

include <opencv2 core="" core.hpp="">

include <opencv2 highgui="" highgui.hpp="">

include <opencv2 imgproc="" imgproc.hpp="">

Code:

#include <iostream>
#include <stdio.h> 
#include <stdlib.h>

#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

using namespace std;
using namespace cv;

cv; int main(int argc, char** argv) {

{

    VideoCapture capture(0);

 if (argc == 1 && capture.isOpened() == false)
 {
     cerr << "Cannot capture images from the web camera ..." << endl;
     return -1;
 }

 namedWindow("original", CV_WINDOW_NORMAL);
 namedWindow("processed", CV_WINDOW_NORMAL);
 namedWindow("blurred", CV_WINDOW_NORMAL);

 Mat frame;
 Mat grayImage;
 Mat processedImage;
 Mat bluredImage = frame;
 //bluredImage = Scalar::all;
 for (int keyCode = -1; keyCode < 0; )
 {
     if (argc == 1)
         capture >> frame;
     else
         frame = imread(argv[1], CV_LOAD_IMAGE_COLOR);

     if (frame.empty() == true)
         break;

     cvtColor(frame, grayImage, CV_BGR2GRAY);

     //TODO: Add the selected image processing function calls ...
     cvtColor(frame, processedImage, CV_BGR2GRAY); // This should be replaced!

     medianBlur(frame, bluredImage, 3);

     imshow("original", frame);
     imshow("processed", processedImage);
     imshow("blurred", bluredImage);


     if (argc == 1)
         keyCode = waitKey(10) % 256;
     else
         keyCode = waitKey(0) % 256;
 }



 destroyWindow("original");
 destroyWindow("processed");
}

}