{"id":176,"date":"2020-01-15T19:35:18","date_gmt":"2020-01-15T11:35:18","guid":{"rendered":"http:\/\/blog.cyasylum.top\/?p=176"},"modified":"2020-05-23T16:14:13","modified_gmt":"2020-05-23T08:14:13","slug":"opencv-4-2-0%e5%ae%89%e8%a3%85%e5%bc%95%e5%af%bc","status":"publish","type":"post","link":"http:\/\/blog.cyasylum.top\/index.php\/2020\/01\/15\/opencv-4-2-0%e5%ae%89%e8%a3%85%e5%bc%95%e5%af%bc\/","title":{"rendered":"OpenCV 4.2.0\u5b89\u88c5\u5f15\u5bfc"},"content":{"rendered":"<h1>OpenCV 4.2.0\u5b89\u88c5\u5f15\u5bfc<\/h1>\n<h2>\u672c\u4f53\u5e93\u5b89\u88c5<\/h2>\n<p><div class=\"has-toc have-toc\"><\/div><\/p>\n<p>\u62f7\u8d1d\u6216\u4ece<a href=\"https:\/\/opencv.org\/releases.html\" target=\"_blank\"  rel=\"nofollow\" >OpenCV\u5b98\u7f51<\/a>\u83b7\u53d6OpenCV\u81ea\u89e3\u538b\u7a0b\u5e8fopencv-4.2.0-vc14_vc15.exe<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/img.cyasylum.top\/2020\/01\/15\/e786195e55a60.png\" alt=\"image-20200112182612362.png\" \/><\/p>\n<p>\u4e0b\u8f7d\/\u62f7\u8d1d\u5b8c\u6210\u540e\uff0c\u5c06OpenCV\u5e93\u89e3\u538b\u5230\u7535\u8111\u7684\u4efb\u610f\u4f4d\u7f6e<\/p>\n<p>\u8fd9\u91cc\u63a8\u8350\u517b\u6210\u6574\u7406\u8fd0\u884c\u5e93\u6536\u85cf\u7684\u4e60\u60ef\uff0c\u5373\u5c06\u591a\u6570\u8fd0\u884c\u5e93\u6216\u8005coding\u76f8\u5173\u7684\u6587\u4ef6\u653e\u5728\u76f8\u540c\u7684\u6587\u4ef6\u5939\u5185<\/p>\n<p>\u8fd9\u91cc\u6211\u5c06OpenCV\u89e3\u538b\u5728\u4e86<em>D:\\CODESLibrary\\opencv-4.2.0<\/em>\u76ee\u5f55\uff0c\u89e3\u538b\u9519\u4e86\u4f4d\u7f6e\u4e5f\u53ef\u4ee5\u81ea\u884c\u526a\u5207\u8c03\u6574<img decoding=\"async\" src=\"http:\/\/img.cyasylum.top\/2020\/01\/15\/c7b8fedb61fc9.png\" alt=\"image-20200112183242218.png\" \/><\/p>\n<h2>\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/h2>\n<p>\u5728Windows\u641c\u7d22\u680f\u4e0a\u67e5\u627e\u73af\u5883\u53d8\u91cf\uff0c<img decoding=\"async\" src=\"http:\/\/img.cyasylum.top\/2020\/01\/15\/1f508bcdb8fc3.png\" alt=\"image-20200112183545909.png\" \/><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/img.cyasylum.top\/2020\/01\/15\/02a30aad42fb0.png\" alt=\"image-20200112183652791.png\" \/><\/p>\n<p>\u627e\u5230\u7cfb\u7edf\u53d8\u91cf\u4e2d\u7684path\uff0c\u5728\u5176\u4e2d\u65b0\u5efa\u73af\u5883\u53d8\u91cf<em>${YourOpenCVFloder}\\build\\x64\\vc15\\bin<\/em>\uff0c\u4ee5\u6211\u7684\u7535\u8111\u4e3a\u4f8b\uff0c\u65b0\u5efa\u4e86\u73af\u5883\u53d8\u91cf<em>D:\\CODESLibrary\\opencv-4.2.0\\build\\x64\\vc15\\bin<\/em><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/img.cyasylum.top\/2020\/01\/15\/f2b71278a50e2.png\" alt=\"image-20200112184152117.png\" \/><\/p>\n<p>\u7136\u540e\u65b0\u589e\u7528\u6237\u53d8\u91cf\uff08\u867d\u7136\u6211\u4e0d\u600e\u4e48\u786e\u5b9a\u8fd9\u4e00\u6b65\u6709\u5565\u7528\uff09\uff0c\u9053\u7406\u540c\u4e0a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/img.cyasylum.top\/2020\/01\/15\/2e46cde9bf388.png\" alt=\"image-20200112184233687.png\" \/><\/p>\n<p>\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u662f\u4e3a\u4e86\u5c06opencv\u7684\u8fd0\u884c\u5e93\u5305\u542b\u5728\u7cfb\u7edf\u8def\u5f84\u4e2d\uff0c\u65b9\u4fbf\u7cfb\u7edf\u6267\u884c\u65f6\u7684\u67e5\u627e<\/p>\n<h2>Visual Studio 2019\u5b89\u88c5<\/h2>\n<p>\u4eceVS\u5b98\u7f51\u4e0b\u8f7d\u6216\u62f7\u8d1dVisual Studio 2019 Community\u7684\u5b89\u88c5\u6587\u4ef6\uff08\u56e0\u4e3a\u5176\u5b83\u7248\u672c\u9700\u8981\u94b1\uff09\uff0c\u5b89\u88c5Visual Studio Installer\uff0c\u5728\u5b89\u88c5\u65f6\u586b\u9009<strong>\u4f7f\u7528C++\u7684\u684c\u9762\u5f00\u53d1<\/strong>\u9009\u9879<img decoding=\"async\" src=\"http:\/\/img.cyasylum.top\/2020\/01\/15\/d419aa97ab5c7.png\" alt=\"image-20200112184839271.png\" \/><\/p>\n<h2>VS\u5de5\u7a0b\u521b\u5efa\u53ca\u94fe\u63a5\u5668\u914d\u7f6e<\/h2>\n<p>\u4ee5visual studio\u4e2d\u7684\u7a7a\u9879\u76ee\u6a21\u677f\u521b\u5efa\u5de5\u7a0b<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/img.cyasylum.top\/2020\/01\/15\/106b938df2dc6.png\" alt=\"image-20200112200615815.png\" \/><\/p>\n<p>\u521b\u5efa\u9879\u76ee<img decoding=\"async\" src=\"http:\/\/img.cyasylum.top\/2020\/01\/15\/d96f8c3b60d37.png\" alt=\"image-20200112201512149.png\" \/><\/p>\n<p>\u6253\u5f00\u9879\u76ee\u4e2d\u7684\u5c5e\u6027\u7ba1\u7406\u5668<img decoding=\"async\" src=\"http:\/\/img.cyasylum.top\/2020\/01\/15\/5130a002899e2.png\" alt=\"image-20200112201928310.png\" \/><\/p>\n<p>\u5e76\u5411<strong>x64 debug<\/strong>\u7684\u914d\u7f6e\u4e2d\u52a0\u5165\u73b0\u6709\u5c5e\u6027\u8868<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/img.cyasylum.top\/2020\/01\/15\/049cd6bc8e2f8.png\" alt=\"image-20200112202205822.png\" \/><\/p>\n<p>\u8fd9\u91cc\u7ed9\u51fa\u6211\u63d0\u4f9b\u7684props\u914d\u7f6e\u6587\u4ef6\u6a21\u677f<\/p>\n<pre><code class=\"language-xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;Project ToolsVersion=\"4.0\" xmlns=\"http:\/\/schemas.microsoft.com\/developer\/msbuild\/2003\"&gt;\n  &lt;ImportGroup Label=\"PropertySheets\" \/&gt;\n  &lt;PropertyGroup Label=\"UserMacros\" \/&gt;\n  &lt;PropertyGroup&gt;\n    &lt;_PropertySheetDisplayName&gt;OpenCV&lt;\/_PropertySheetDisplayName&gt;\n    &lt;IncludePath&gt;${YourOpenCVFloder}\\build\\include\\opencv2;${YourOpenCVFloder}\\build\\include;$(IncludePath)&lt;\/IncludePath&gt;\n    &lt;LibraryPath&gt;${YourOpenCVFloder}\\build\\x64\\vc15\\lib;$(LibraryPath)&lt;\/LibraryPath&gt;\n  &lt;\/PropertyGroup&gt;\n  &lt;ItemDefinitionGroup&gt;\n    &lt;Link&gt;\n      &lt;AdditionalDependencies&gt;opencv_world420d.lib&lt;\/AdditionalDependencies&gt;\n    &lt;\/Link&gt;\n  &lt;\/ItemDefinitionGroup&gt;\n  &lt;ItemGroup \/&gt;\n&lt;\/Project&gt;<\/code><\/pre>\n<p>\u628a\u8fd9\u4e32\u4ee3\u7801\u4e2d\u7684${YourOpenCVFloder}\u6807\u8bc6\u6539\u4e3a\u81ea\u5df1\u7684\u5730\u5740\uff0c\u5e76\u901a\u8fc7\u8bb0\u4e8b\u672c\u4fdd\u5b58\u4e3a\u540d\u4e3aOpenCV.props\u7684vs\u914d\u7f6e\u6587\u4ef6\uff0c\u800c\u540e\u6dfb\u52a0\u8fdb\u5c5e\u6027\u7ba1\u7406\u5668\u5c31ok\u4e86\u221a<\/p>\n<p>\u5982\u679c\u5c1d\u8bd5\u4e0d\u6210\u529f\u53ef\u4ee5\u5c06opencv_world420d.lib\u4e00\u680f\u6539\u6210\u7edd\u5bf9\u5730\u5740\uff0c${YourOpenCVFloder}\\build\\x64\\vc15\\lib\\opencv_world420d.lib<\/p>\n<h2>\u5f00\u59cb\u81ea\u5df1\u7684\u9879\u76ee<\/h2>\n<p>\u63a5\u4e0b\u6765\uff0c\u53ea\u8981\u5728\u89e3\u51b3\u65b9\u6848\u7ba1\u7406\u5668\u680f\u4e2d\u7684\u6e90\u6587\u4ef6\u4e2d\uff0c\u65b0\u5efa\u6dfb\u52a0\u81ea\u5df1\u7684cpp\u4ee3\u7801\uff0c\u5c31\u53ef\u4ee5\u5f00\u59cb\u4f60\u7684\u9879\u76ee\u5566<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/img.cyasylum.top\/2020\/01\/15\/a142c231bf379.png\" alt=\"image-20200112214142520.png\" \/><\/p>\n<p>\u5176\u4e2d\u9700\u8981\u6ce8\u610f\u51e0\u70b9<\/p>\n<ol>\n<li>\u6ce8\u610f\u5c06\u7f16\u8bd1\u8fd0\u884c\u680f\u8c03\u6574\u4e3a\u4ee5\u4e0b\u60c5\u51b5<img decoding=\"async\" src=\"http:\/\/img.cyasylum.top\/2020\/01\/15\/c1e1f76ae9478.png\" alt=\"image-20200112214241471.png\" \/><\/li>\n<li>\u4e00\u4e2a\u5de5\u7a0b\u5185\u4e0d\u80fd\u542b\u6709\u591a\u4e2amain\u51fd\u6570\uff0c\u5728\u7ec3\u4e60\u4e2d\u53ef\u4ee5\u4f7f\u7528main\u51fd\u6570\u5bf9\u5f53\u524d\u7ec3\u4e60\u5185\u5bb9\u8fdb\u884c\u8c03\u7528\uff0c\u8fd9\u6837\u5c31\u907f\u514d\u4e86\u65b0\u5efa\u591a\u4e2a\u9879\u76ee\u7684\u9ebb\u70e6<\/li>\n<\/ol>\n<p>\u7ed9\u51fa\u793a\u4f8b\u4ee3\u7801\uff0c\u603b\u4e4b\u914d\u8d77\u6765\u8bd5\u8bd5\u5427\u221a<\/p>\n<pre><code class=\"language-c++\">#include &lt;opencv2\/opencv.hpp&gt;\n#include &lt;iostream&gt;\n\nusing namespace cv;\nusing namespace std;\n\nint show_my_wife(const string &amp;my_wife_path ) {\n    Mat img = imread(my_wife_path);\n    namedWindow(\"my_wife\", WINDOW_NORMAL);\n    imshow(\"my_wife\", img);\n    waitKey();\n    return 0;\n}\n\nint main() {\n    \/\/\u6ce8\u610f\u5c061.jpg\u6362\u6210\u81ea\u5df1\u56fe\u7247\u7684\u76ee\u5f55\uff0c\u65e0\u524d\u7f00\u9ed8\u8ba4\u662f\u8bfb\u53d6\u6839\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\n    show_my_wife(\"1.jpg\");\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5bd2\u5047\u6559\u5b66\u5f1f\u5b66\u59b9\u4eecopencv\u65f6\u5199\u7684\u5b89\u88c5\u6307\u5bfc\u3002\u3002\u9002\u7528\u4e8eopencv3.4\u4ee5\u4e0a\u7248\u672c<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"templates\/template-full-width.php","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[15],"tags":[28,29],"class_list":["post-176","post","type-post","status-publish","format-standard","hentry","category-15","tag-opencv","tag-29"],"_links":{"self":[{"href":"http:\/\/blog.cyasylum.top\/index.php\/wp-json\/wp\/v2\/posts\/176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.cyasylum.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.cyasylum.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.cyasylum.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.cyasylum.top\/index.php\/wp-json\/wp\/v2\/comments?post=176"}],"version-history":[{"count":2,"href":"http:\/\/blog.cyasylum.top\/index.php\/wp-json\/wp\/v2\/posts\/176\/revisions"}],"predecessor-version":[{"id":213,"href":"http:\/\/blog.cyasylum.top\/index.php\/wp-json\/wp\/v2\/posts\/176\/revisions\/213"}],"wp:attachment":[{"href":"http:\/\/blog.cyasylum.top\/index.php\/wp-json\/wp\/v2\/media?parent=176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.cyasylum.top\/index.php\/wp-json\/wp\/v2\/categories?post=176"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.cyasylum.top\/index.php\/wp-json\/wp\/v2\/tags?post=176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}