S
S
stasersmailov2021-06-18 19:11:57
C++ / C#
stasersmailov, 2021-06-18 19:11:57

How to open an image in open cv?

I am trying to open an image with the following code

cv::Mat UploadImage()
  {		
    cv::Mat image;
    while (image.empty())
    {
      std::string path;
      std::cout << "Enter image path: ";
      std::cin >> path;
      image = cv::imread(path);
      if (image.empty())
      {
        std::cout << "No image\n\n";
      }
    }
    return image;
  }

But I don’t know what to do anymore, it just refuses to open the file, as soon as I didn’t try
60ccc54035b25600815805.png
But the result is always the same, the file is in the directory with the project and in the root F I
60ccc56a0d2a4073353747.png
60ccc58d6717e963896671.png
tried to change the name and extension of the file, I also tried to hardcode the path to the file, nothing works

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
stasersmailov, 2021-06-18
@stasersmailov

I just changed the project and everything started to function normally, I don’t know what it was connected with, but the problem was solved.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question