LoginSignup
7
5

More than 5 years have passed since last update.

Homebrewがインストールされているとします。

brew install pkg-config
brew install opencv  

適当なプログラムを書きます。

test_opencv.cpp
#include <opencv2/opencv.hpp>

int main(){
    cv::Mat a = cv::imread("img.jpg", 1); 
    cv::imshow("hello", a); 
    cv::waitKey();
}

コンパイル時にpkg-configを使って必要なヘッダやライブラリを設定します。

g++ `pkg-config --libs --cflags opencv` test_opencv.cpp

動作確認をします。

./a.out
7
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
5