1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Visual Studio 2017 で OpenCVのテンプレートプロジェクトを作成する

Posted at

環境

・Windows 7 Professional 64bit
・Visual Studio 2017 Version 15.9.14
・OpenCV 3.4.1

OpenCVの導入方法などは、下記を参照ください。
Visual Studio 2017 + OpenCV 3.4.1 + CUDA 10.0 + Intel TBB 2018U5 ビルド手順

手順

  1. Visual Studio 2017 を起動
  2. ファイル>新規作成>プロジェクト>Visual C++>空のプロジェクト を選択
  3. ソリューションエクスプローラー>ソースファイル>追加>新しい項目>C++ファイルを新規作成
  4. ソリューションエクスプローラーからプロジェクトのプロパティを開く
  5. 構成を"すべての構成" 、プラットフォームを"すべてのプラットフォーム"に設定
    WS000000.png
    WS000001.png
  6. C/C++>全般>追加のインクルードディレクトリを設定
    WS000002.png
    WS000003.png
    WS000004.png
  7. リンカー>全般>追加のライブラリディレクトリを設定
    ※x86のライブラリもある方は両方設定してください(私の環境ではx86のCMakeは行っていないので、今回はx64しか設定していません)
    WS000005.png
    WS000006.png
    WS000007.png
  8. 手順3.で作成したC++ファイルにテスト用のコードでも記述しておきます
main.cpp
# include <iostream>
# include <opencv/cv.hpp>
# include <opencv2/opencv.hpp>
# include <opencv_lib.hpp>

int main()
{
	//OpenCV ビルド情報の表示
	std::cout << cv::getBuildInformation() << std::endl;
	system("pause");

	return 0;
}
  1. プロジェクトをテンプレート化します
    メインメニュー>プロジェクトテンプレートのエクスポート でテンプレートをするためのウィザードが出てくるので設定します
    WS000008.png
    WS000009.jpg

確認

Visual Studio を起動して、プロジェクトの作成に入ると以下のような、テンプレートが読み込まれ一覧に表示される
WS000010.jpg

余談

テンプレートファイルはzip形式なので、コピペなどで簡単にバックアップや移行したりできると思います。

参考サイト

[1]:プロジェクト テンプレートを作成する

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?