My code runs normaly in visual studio but when I try to run on vscode with a makefile I start to receive some errors and throws exceptions thats because imread returns a empty cv::mat
This is the code part of cv::imread:
#include <iostream>
#include <stdio.h>
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/core/mat.hpp>
#include <opencv2/imgproc.hpp>
#include <math.h>
#include "Funcs.h"
#include "cvui.h"
#define WINDOW_NAME "Rows and Columns"
int main()
{
// cvui
cv::Mat frame = cv::Mat(900, 1300, CV_8UC3);
cv::Mat display1;
cv::Mat display2 = cv::Mat(520, 600, CV_8U, cv::Scalar(0, 0, 0));
int colorCount = 0;
std::vector<std::string> cores = { "Amarelo","Azul", "Vermelho", "Verde", "Rosa" };
// fonts of frame
cv::Mat imgdefault = cv::imread("C/Users/tisie/Documents/opencvtest/img.lena.jpg", cv::IMREAD_COLOR);
cv::Mat imgstatic = cv::imread("./model1.png", cv::IMREAD_COLOR);
cv::VideoCapture vid("ball_move.mp4");
cv::VideoCapture webC(0);
int pathChose = 0;
// perspective
int mouse_count = 0;
int cornerx[4] = {0};
int cornery[4] = {0};
cv::Mat_<float> dst = (cv::Mat_<float>(4, 2) <<
0, 0, 600, 0,
0, 520, 600, 520);
bool applyPerspective = false;
bool applyMask = false;
and this is my make file:
cmake_minimum_required(VERSION 3.0.0)
project(opencvtest VERSION 0.1.0)
set(CMAKE_TOOLCHAIN_FILE "C:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake")
set(CMAKE_PREFIX_PATH "C:/dev/vcpkg/installed/x64-windows/share")
set(OpenCV_DIR "C:/dev/vcpkg/installed/x64-windows/share/opencv")
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS})
add_library(
CVUI
cvui.h
cvui.cpp
)
add_library(
funcoes
Funcs.h
Funcs.cpp
)
add_executable(opencvtest main.cpp)
link_directories(${OpenCV_LIB_DIR})
target_link_libraries( opencvtest PRIVATE ${OpenCV_LIBS} funcoes CVUI )