{"id":18115,"date":"2018-04-10T13:48:34","date_gmt":"2018-04-10T04:48:34","guid":{"rendered":"http:\/\/yukisako.xsrv.jp\/entry\/opencv-mac"},"modified":"2018-04-10T13:48:34","modified_gmt":"2018-04-10T04:48:34","slug":"opencv-mac","status":"publish","type":"post","link":"https:\/\/skill-hacks.co.jp\/media\/opencv-mac\/","title":{"rendered":"\u3010Mac\u30e6\u30fc\u30b6\u5411\u3051\u3011C++\u304a\u3088\u3073OpenCV3\u3092Xcode\u3067\u52d5\u304b\u3059\u624b\u9806"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\uff0c\u5b66\u751f\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u8feb\u4f51\u6a39(<a href=\"https:\/\/twitter.com\/yuki_99_s?lang=ja\" target=\"_blank\" rel=\"noopener\">@yuki_99_s<\/a>)\u3067\u3059\uff0e<\/p>\n<p>\u4eca\u56de\u306f\uff0cC++\u304a\u3088\u3073OpenCV3\u3092XCode\u4e0a\u3067\u52d5\u304b\u3059\u624b\u9806\u306b\u3064\u3044\u3066\u307e\u3068\u3081\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\uff0e<\/p>\n<p>Mac\u5411\u3051\/Xcode\u5411\u3051\u306e\u60c5\u5831\u306f\u53e4\u3044\u3082\u306e\u3057\u304b\u898b\u5f53\u305f\u3089\u306a\u304b\u3063\u305f\u306e\u3067\uff0c\u81ea\u5206\u7528\u30e1\u30e2\u3082\u517c\u306d\u3066\u307e\u3068\u3081\u3066\u304a\u304f\u3053\u3068\u306b\u3057\u307e\u3057\u305f\uff0e<\/p>\n<p><\/p>\n<p><!--more--><\/p>\n<h2 id=\"Homebrew\u3067\u5fc5\u8981\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u5165\u308c\u308b\">Homebrew\u3067\u5fc5\u8981\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u5165\u308c\u308b<\/h2>\n<p>Homebrew\u3092\u4f7f\u3063\u3066\u5165\u308c\u3066\u3044\u304f\u306e\u3067\uff0cHomebrew\u81ea\u4f53\u304c\u5165\u3063\u3066\u306a\u3044\u65b9\u306f\u307e\u305a\u306f\u305d\u3061\u3089\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304d\u3066\u304f\u3060\u3055\u3044\uff0e<\/p>\n<p>Homebrew\u3092\u4f7f\u3063\u3066OpenCV\u304a\u3088\u3073cmake\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\uff0e<\/p>\n<p>\u30bf\u30fc\u30df\u30ca\u30eb\u3092\u958b\u3044\u3066\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\uff0e<\/p>\n<pre class=\"code\" data-lang=\"\" data-unlink=\"\">brew install opencv\nbrew install -v cmake<\/pre>\n<p><code>\/usr\/local\/Cellar\/<\/code>\u306b\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u306f\u305a\u306a\u306e\u3067\uff0c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u7d42\u308f\u3063\u305f\u3089\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\uff0e<\/p>\n<pre class=\"code\" data-lang=\"\" data-unlink=\"\">ls \/usr\/local\/Cellar\/<\/pre>\n<p>\u305d\u306e\u969b\uff0c\u4ee5\u4e0b\u306e\u3088\u3046\u306b<code>cmake<\/code>\u304a\u3088\u3073<code>opencv<\/code>\u304c\u5165\u3063\u3066\u5165\u308c\u3070\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u6210\u529f\u3067\u3059\uff0e<\/p>\n<p><img decoding=\"async\" class=\"hatena-fotolife\" title=\"f:id:McG:20180410130732p:plain\" src=\"https:\/\/cdn-ak.f.st-hatena.com\/images\/fotolife\/M\/McG\/20180410\/20180410130732.png\" alt=\"f:id:McG:20180410130732p:plain\"><\/p>\n<h2 id=\"\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u308b\">\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u308b<\/h2>\n<p>\u305d\u308c\u3067\u306f\uff0cXCode\u3067\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3059\uff0e<\/p>\n<p>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u9078\u3076\u753b\u9762\u307e\u3067\u304d\u305f\u3089\uff0c<code>Mac OS<\/code>\u3092\u9078\u629e\u3057\uff0c<code>Command Line Tool<\/code>\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\uff0e<\/p>\n<p><img decoding=\"async\" class=\"hatena-fotolife\" title=\"f:id:McG:20180410131017p:plain\" src=\"https:\/\/cdn-ak.f.st-hatena.com\/images\/fotolife\/M\/McG\/20180410\/20180410131017.png\" alt=\"f:id:McG:20180410131017p:plain\"><\/p>\n<p>\u6b21\u304c\u5c11\u3057\u3084\u3084\u3053\u3057\u304f\u306f\u3042\u308b\u3093\u3067\u3059\u304c\uff0c\u4ee5\u4e0b\u306e\u624b\u9806\u3092\u8e0f\u3093\u3067\u307f\u3066\u304f\u3060\u3055\u3044\uff01<\/p>\n<ol>\n<li>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u30af\u30ea\u30c3\u30af<\/li>\n<li>\u30e1\u30cb\u30e5\u30fc\u304b\u3089<code>Build Setting<\/code>\u3092\u9078\u629e<\/li>\n<li><code>All<\/code>\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u5168\u90e8\u306e\u8a2d\u5b9a\u3092\u8868\u793a<\/li>\n<li><code>Header Search Path<\/code>\u3092\u898b\u3064\u3051\u308b<\/li>\n<li>+\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u3066\u30d1\u30b9\u5165\u529b\u753b\u9762\u3078<\/li>\n<li><code>\/usr\/local\/Cellar\/opencv<\/code>\u3092\u8ffd\u52a0<\/li>\n<li><code>recursive<\/code>\u3078\u3068\u5909\u66f4<\/li>\n<\/ol>\n<p><img decoding=\"async\" class=\"hatena-fotolife\" title=\"f:id:McG:20180410131536p:plain\" src=\"https:\/\/cdn-ak.f.st-hatena.com\/images\/fotolife\/M\/McG\/20180410\/20180410131536.png\" alt=\"f:id:McG:20180410131536p:plain\"><\/p>\n<p>\u3053\u3053\u307e\u3067\u304d\u305f\u3089\u3042\u3068\u306f\u4e00\u606f\uff0e<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u6253\u3064\u3068\uff0c\u30d0\u30fc\u30b8\u30e7\u30f3\u540d\u306b\u306a\u3063\u3066\u308b\u30d5\u30a9\u30eb\u30c0\u304c\u51fa\u3066\u304f\u308b\u3068\u601d\u3044\u307e\u3059\uff0e<\/p>\n<pre class=\"code\" data-lang=\"\" data-unlink=\"\">open \/usr\/local\/Cellar\/opencv\/<\/pre>\n<p>\u30d0\u30fc\u30b8\u30e7\u30f3\u540d\u304c\u3064\u3044\u305f\u30d5\u30a9\u30eb\u30c0\u3092\u958b\u3044\u3066\uff0c\u305d\u306e\u4e2d\u306elib\u3068\u3044\u3046\u30d5\u30a9\u30eb\u30c0\u306e\u4e2d\u3092\u898b\u308b\u3068\u62e1\u5f35\u5b50\u304c<code>.dylib<\/code>\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u305f\u304f\u3055\u3093\u3042\u308b\u306f\u305a\uff0e<\/p>\n<p>Xcode\u3067\uff0c\u30e1\u30cb\u30e5\u30fc\u304b\u3089<code>Build Phases<\/code>\u3092\u9078\u3073\uff0c<code>Link Binary With Libraries<\/code>\u3092\u9078\u3093\u3067\uff0c\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u8ffd\u52a0\u3057\u3066\u3044\u304f\u3068\u3044\u3046\u6d41\u308c\u3067\u3059\uff0e<\/p>\n<p>\u3088\u304f\u308f\u304b\u3089\u306a\u304b\u3063\u305f\u3089\uff0c\u3068\u308a\u3042\u3048\u305a\u5168\u90e8\u30e9\u30a4\u30d6\u30e9\u30ea\u7a81\u3063\u8fbc\u3093\u3067\u307f\u3066\u3082\u3044\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\uff0e<\/p>\n<p><img decoding=\"async\" class=\"hatena-fotolife\" title=\"f:id:McG:20180410133144p:plain\" src=\"https:\/\/cdn-ak.f.st-hatena.com\/images\/fotolife\/M\/McG\/20180410\/20180410133144.png\" alt=\"f:id:McG:20180410133144p:plain\"><\/p>\n<h2 id=\"\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u5b9f\u884c\">\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\uff0c\u5b9f\u884c<\/h2>\n<p>\u6e96\u5099\u304c\u3067\u304d\u305f\u3089\uff0c\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\uff0e<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u306f\uff0c\u5186\u3092\u4e00\u3064\u63cf\u753b\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3059\uff0e<\/p>\n<pre class=\"code lang-cpp\" data-lang=\"cpp\" data-unlink=\"\"><span class=\"synPreProc\">#include <\/span><span class=\"synConstant\">&lt;cv.h&gt;<\/span>\n<span class=\"synPreProc\">#include <\/span><span class=\"synConstant\">&lt;highgui.h&gt;<\/span>\n<span class=\"synPreProc\">#include <\/span><span class=\"synConstant\">&lt;opencv2\/opencv.hpp&gt;<\/span>\n<span class=\"synStatement\">using<\/span> <span class=\"synType\">namespace<\/span> cv;\n<span class=\"synType\">int<\/span> main(){\nMat img(<span class=\"synConstant\">256<\/span>,<span class=\"synConstant\">256<\/span>, CV_8UC3, Scalar(<span class=\"synConstant\">100<\/span>, <span class=\"synConstant\">100<\/span>, <span class=\"synConstant\">100<\/span>));\ncircle(img, Point(<span class=\"synConstant\">128<\/span>, <span class=\"synConstant\">128<\/span>), <span class=\"synConstant\">100<\/span>, Scalar(<span class=\"synConstant\">200<\/span>, <span class=\"synConstant\">100<\/span>, <span class=\"synConstant\">100<\/span>), <span class=\"synConstant\">4<\/span>);\nimshow(<span class=\"synConstant\">\"image\"<\/span>,img);\nwaitKey(<span class=\"synConstant\">0<\/span>);\n<span class=\"synStatement\">return<\/span> <span class=\"synConstant\">0<\/span>;\n}\n<\/pre>\n<p>\u3053\u308c\u304c\u5b9f\u884c\u3067\u304d\u308c\u3070\u74b0\u5883\u69cb\u7bc9\u306f\u5b8c\u4e86\u3067\u3059\uff0e\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\uff0e<\/p>\n<p><img decoding=\"async\" class=\"hatena-fotolife\" title=\"f:id:McG:20180410133558p:plain\" src=\"https:\/\/cdn-ak.f.st-hatena.com\/images\/fotolife\/M\/McG\/20180410\/20180410133558.png\" alt=\"f:id:McG:20180410133558p:plain\"><\/p>\n<h2 id=\"\u307e\u3068\u3081\">\u307e\u3068\u3081<\/h2>\n<p>OpenCV\u3068\u3044\u3046\u3068\uff0c\u4eca\u306fPython\u3067\u4f7f\u3046\u3053\u3068\u304c\u591a\u3044\u305b\u3044\u304b\uff0cC++\u306b\u95a2\u3059\u308b\u8a18\u4e8b\u306f\u65e5\u672c\u8a9e\u3060\u3068\u3061\u3087\u3063\u3068\u53e4\u3044\u3082\u306e\u3057\u304b\u898b\u5f53\u305f\u308a\u307e\u305b\u3093\u3067\u3057\u305f\uff0e<\/p>\n<p>\u72b6\u6cc1\u306b\u3088\u3063\u3066\u306fC++\u3092\u4f7f\u308f\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3063\u3066\u3044\u3046\u3053\u3068\u3082\u591a\u304f\u3042\u308b\u306f\u305a\u3067\u3059\uff0e<\/p>\n<p>\u697d\u3057\u3044OpenCV\u30e9\u30a4\u30d5\u3092\u304a\u697d\u3057\u307f\u304f\u3060\u3055\u3044\uff01<\/p>\n<h2 id=\"i-4\">\u3053\u3061\u3089\u306e\u8a18\u4e8b\u3082\u4eba\u6c17\u3067\u3059\uff01<\/h2>\n<ul>\n<li><a href=\"https:\/\/www.yukisako.xyz\/entry\/techacademy-trial\">\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306b\u8208\u5473\u304c\u3042\u308b\u65b9\u5fc5\u898b!!\u7121\u6599\u30671\u9031\u9593\u30d7\u30ed\u306b\u8cea\u554f\u3057\u307e\u304f\u3063\u3066\u307f\u307e\u305b\u3093\u304b\uff1f<\/a><\/li>\n<li><a href=\"https:\/\/www.yukisako.xyz\/entry\/techacademy\">\u30aa\u30ea\u30b8\u30ca\u30eb\u30b5\u30fc\u30d3\u30b9\u958b\u767a\u307e\u3067\u30b5\u30dd\u30fc\u30c8\uff01TechAcademy\u3092\u53d7\u8b1b\u3057\u3066\u307f\u307e\u3057\u305f\uff01<\/a><\/li>\n<li><a href=\"https:\/\/www.yukisako.xyz\/entry\/techcamp_techacademy-unity\">1\u30f6\u6708\u3067\u30b2\u30fc\u30e0\u3092\u30ea\u30ea\u30fc\u30b9\uff1fTechAcademy\u306eUnity\u30b3\u30fc\u30b9\u3092\u53d7\u8b1b\u3057\u3066\u307f\u305f!!<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\uff0c\u5b66\u751f\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u8feb\u4f51\u6a39(@yuki_99_s)\u3067\u3059\uff0e \u4eca\u56de\u306f\uff0cC++\u304a\u3088\u3073OpenCV3\u3092XCode\u4e0a\u3067\u52d5\u304b\u3059\u624b\u9806\u306b\u3064\u3044\u3066\u307e\u3068\u3081\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\uff0e Mac\u5411\u3051\/Xcode\u5411\u3051\u306e\u60c5\u5831\u306f\u53e4\u3044\u3082\u306e\u3057\u304b\u898b\u5f53\u305f\u3089\u306a\u304b &#8230; <\/p>\n","protected":false},"author":1,"featured_media":16758,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":{"0":"post-18115","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-programming","8":"entry"},"_links":{"self":[{"href":"https:\/\/skill-hacks.co.jp\/media\/wp-json\/wp\/v2\/posts\/18115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/skill-hacks.co.jp\/media\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/skill-hacks.co.jp\/media\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/skill-hacks.co.jp\/media\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/skill-hacks.co.jp\/media\/wp-json\/wp\/v2\/comments?post=18115"}],"version-history":[{"count":0,"href":"https:\/\/skill-hacks.co.jp\/media\/wp-json\/wp\/v2\/posts\/18115\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/skill-hacks.co.jp\/media\/wp-json\/wp\/v2\/media\/16758"}],"wp:attachment":[{"href":"https:\/\/skill-hacks.co.jp\/media\/wp-json\/wp\/v2\/media?parent=18115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skill-hacks.co.jp\/media\/wp-json\/wp\/v2\/categories?post=18115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skill-hacks.co.jp\/media\/wp-json\/wp\/v2\/tags?post=18115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}