OpenCV tutorial problems

0

I am doing a few basic tutorial on OpenCV. However on this: "https://docs.opencv.org/master/d4/d14/tutorial_windows_visual_studio_image_watch.html" tutorial I am running into problems.

Here is my code:

#include <opencv2/opencv.hpp>

using namespace cv;

int main(int argc, char** argv)
{
    char* imageName = argv[1];

    Mat image;
    image = imread(imageName, IMREAD_COLOR);

    if (argc != 2 || !image.data);
    {
        return -1;
    }

    Mat gray_image;
    cvtColor(image, gray_image, COLOR_BGR2GRAY);

    imwrite("C:\OpenCV-test-imgs", gray_image);

    namedWindow(imageName, WINDOW_AUTOSIZE);
    namedWindow("Gray image", WINDOW_AUTOSIZE);

    imshow(imageName, image);
    imshow("Gray image", gray_image);

    waitKey(0);

    return(0);
}

It is basically the same as in the tutorial. I am expecting one or two windows to pop up showing me the two images of the cat. except I'm getting the error :

The program '[14300] image-watch-demo.exe' has exited with code -1 (0xffffffff).

What am I doing wrong here? Should I make a folder containing an image? And if so where should this folder be place and how should it be called.

I'm sorry if this is a dumb quest, I am a beginner to OpenCV and coding/visual studio in general.

Thanks in advance

c++
opencv
visual-studio-2019
asked on Stack Overflow Mar 18, 2020 by Bartrae

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0