2016/09/18

[Windows] Visual Studio + OpenCV

Reference:
將OpenCV完美建置於Visual Studio上
Setting Up OpenCV 3.1 in Visual Studio 2015 (Youtube Video)

To make OpenCV work correctly with Visual Studio 2015, you should download OpenCV which version is newer than 3.1

You can use the testing code below to confirm whether it works
Remember to add

#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

at the beginning of the source code
#include 
#include 
#include 

using namespace std;
using namespace cv;

int main(int argc, char** argv)
{
 argv[1] = "D:\\picure.jpg";
 Mat image;
 image = imread(argv[1], CV_LOAD_IMAGE_COLOR);

 if (!image.data)
 {
  cout << "No Image" << std::endl;
  return -1;
 }

 namedWindow("Display", CV_WINDOW_NORMAL);
 imshow("Display", image);
 waitKey(0);

 return 0;
}
 

1 則留言:

  1. C programming for free,
    All C programs are written in text files with the extension ".c" for example hello.C . You can use text editor to write your C program to a file. learn C programming, I assume you know how to edit a text file and write programming instructions inside a program file. More deteal link https://www.smartduniya.co.in/2020/10/learn-c-programming-c-programming-for.html

    回覆刪除