{"id":266498,"date":"2023-03-06T22:09:38","date_gmt":"2023-03-06T14:09:38","guid":{"rendered":"https:\/\/gulass.cn\/lxtxzkobbdff.html"},"modified":"2023-03-06T22:09:38","modified_gmt":"2023-03-06T14:09:38","slug":"lxtxzkobbdff","status":"publish","type":"post","link":"https:\/\/gulass.cn\/lxtxzkobbdff.html","title":{"rendered":"Linux\u7cfb\u7edf\u4e0b\u67e5\u770bOpenCV\u7248\u672c\u7684\u65b9\u6cd5\uff0c\u8f7b\u677e\u638c\u63e1\uff01"},"content":{"rendered":"

OpenCV\u662f\u4e00\u6b3e\u5e38\u7528\u7684\u8ba1\u7b97\u673a\u89c6\u89c9\u5f00\u6e90\u5e93\uff0c\u5176\u7248\u672c\u66f4\u65b0\u8f83\u5feb\u3002\u5728\u4f7f\u7528OpenCV\u65f6linux\u4e0b\u67e5\u770bopencv\u7248\u672c<\/strong>linux\uff0c\u4e86\u89e3\u5f53\u524d\u7cfb\u7edf<\/a>\u4e2d\u6240\u5b89\u88c5\u7684OpenCV\u7248\u672c\u663e\u5f97\u5341\u5206\u5fc5\u8981\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728Linux<\/a>\u7cfb\u7edf\u4e0b\u67e5\u770bOpenCV\u7248\u672c\u3002<\/p>\n

1.\u67e5\u770bOpenCV\u5b89\u88c5\u8def\u5f84<\/p>\n

\u5728\u547d\u4ee4<\/a>\u884c\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

```<\/p>\n

pkg-config --cflags opencv<\/p>\n

```<\/p>\n

\u8be5\u547d\u4ee4\u4f1a\u8f93\u51fa\u5f53\u524d\u7cfb\u7edf\u4e2dOpenCV\u6240\u5728\u7684\u5b89\u88c5\u8def\u5f84\u3002\u4f8b\u5982\uff0c\u8f93\u51fa\u7ed3\u679c\u4e3a\uff1a<\/p>\n

```<\/p>\n

-I\/usr\/local\/include\/opencv -I\/usr\/local\/include<\/p>\n

```<\/p>\n

\u5176\u4e2d\uff0c\u201c\/usr\/local\/include\/opencv\u201d\u5373\u4e3aOpenCV\u6240\u5728\u7684\u8def\u5f84\u3002<\/p>\n

2.\u67e5\u770bOpenCV\u7248\u672c\u53f7<\/p>\n

\u8fdb\u5165\u5230OpenCV\u6240\u5728\u7684\u8def\u5f84\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

```<\/p>\n

cat \/usr\/local\/include\/opencv2\/core\/version.hpp | grep 'VERSION_'<\/p>\n

```<\/p>\n

\u8be5\u547d\u4ee4\u4f1a\u8f93\u51fa\u5f53\u524d\u7cfb\u7edf\u4e2d\u5b89\u88c5\u7684OpenCV\u7248\u672c\u53f7\u3002\u4f8b\u5982linux\u4e0b\u67e5\u770bopencv\u7248\u672c<\/strong>ubuntu linux\uff0c\u8f93\u51fa\u7ed3\u679c\u4e3a\uff1a<\/p>\n

```<\/p>\n

#define CV_VERSION_MAJOR 4<\/p>\n

linux\u4e0b\u67e5\u770b\u7248\u672c_linux \u67e5\u770blinux\u7248\u672c_linux\u4e0b\u67e5\u770bopencv\u7248\u672c<\/p>\n

#define CV_VERSION_MINOR 5<\/p>\n

#define CV_VERSION_REVISION 3<\/p>\n

#define CV_VERSION_STATUS \"\"<\/p>\n

```<\/p>\n

\u5219\u8bf4\u660e\u5f53\u524d\u7cfb\u7edf\u4e2d\u5b89\u88c5\u7684OpenCV\u7248\u672c\u4e3a4.5.3\u3002<\/p>\n

\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u5982\u679c\u662f\u901a\u8fc7\u6e90\u7801\u7f16\u8bd1\u65b9\u5f0f\u5b89\u88c5\u7684OpenCV\uff0c\u5176\u5b89\u88c5\u8def\u5f84\u548c\u7248\u672c\u53f7\u53ef\u80fd\u4f1a\u6709\u6240\u4e0d\u540c\u3002<\/p>\n

linux\u4e0b\u67e5\u770b\u7248\u672c_linux \u67e5\u770blinux\u7248\u672c_linux\u4e0b\u67e5\u770bopencv\u7248\u672c<\/p>\n

3.\u4f7f\u7528\u7a0b\u5e8f\u83b7\u53d6OpenCV\u7248\u672c\u4fe1\u606f<\/p>\n

\u9664\u4e86\u4f7f\u7528\u547d\u4ee4\u884c\u67e5\u770b\u5916\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u901a\u8fc7\u7f16\u5199C++\u7a0b\u5e8f\u6765\u83b7\u53d6\u5f53\u524d\u7cfb\u7edf\u4e2d\u5b89\u88c5\u7684OpenCV\u7248\u672c\u4fe1\u606f\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\u7a0b\u5e8f\uff1a<\/p>\n

```cpp<\/p>\n

#include <\/p>\n

#include <\/p>\n

int main()<\/p>\n

{<\/p>\n

std::cout <<"OpenCV version :"<< CV_VERSION_MAJOR <<"."<< CV_VERSION_MINOR <<"."<< CV_VERSION_REVISION << std::endl;<\/p>\n

return 0;<\/p>\n

}<\/p>\n

```<\/p>\n

\u8fd0\u884c\u8be5\u7a0b\u5e8f\u5373\u53ef\u8f93\u51fa\u5f53\u524d\u7cfb\u7edf\u4e2d\u5b89\u88c5\u7684OpenCV\u7248\u672c\u53f7\u3002<\/p>\n

\u603b\u7ed3<\/p>\n

\u672c\u6587\u4ecb\u7ecd\u4e86\u4e09\u79cd\u67e5\u770bLinux\u7cfb\u7edf\u4e0b\u5b89\u88c5\u7684OpenCV\u7248\u672c\u4fe1\u606f\u7684\u65b9\u6cd5\uff1a\u901a\u8fc7\u547d\u4ee4\u884c\u3001\u901a\u8fc7\u6e90\u7801\u8def\u5f84\u4ee5\u53ca\u901a\u8fc7C++\u7a0b\u5e8f\u3002\u638c\u63e1\u8fd9\u4e9b\u65b9\u6cd5\u80fd\u591f\u66f4\u597d\u5730\u7ba1\u7406\u548c\u4f7f\u7528OpenCV\u5e93\uff0c\u63d0\u9ad8\u8ba1\u7b97\u673a\u89c6\u89c9\u5f00\u53d1\u6548\u7387\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

OpenCV\u662f\u4e00\u6b3e\u5e38\u7528\u7684\u8ba1\u7b97\u673a\u89c6\u89c9\u5f00\u6e90\u5e93\uff0c\u5176\u7248\u672c\u66f4\u65b0\u8f83\u5feb\u3002\u5728\u4f7f\u7528OpenCV\u65f6\uff0c\u4e86\u89e3\u5f53\u524d\u7cfb\u7edf\u4e2d\u6240\u5b89\u88c5\u7684OpenCV\u7248\u672c\u663e\u5f97\u5341\u5206\u5fc5\u8981\u3002\u8be5\u547d\u4ee4\u4f1a\u8f93\u51fa\u5f53\u524d\u7cfb\u7edf\u4e2d\u5b89\u88c5\u7684OpenCV\u7248\u672c\u53f7\u3002\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u5982\u679c\u662f\u901a\u8fc7\u6e90\u7801\u7f16\u8bd1\u65b9\u5f0f\u5b89\u88c5\u7684OpenCV\uff0c\u5176\u5b89\u88c5\u8def\u5f84\u548c\u7248\u672c\u53f7\u53ef\u80fd\u4f1a\u6709\u6240\u4e0d\u540c\u3002\u4f7f\u7528\u7a0b\u5e8f\u83b7\u53d6OpenCV\u7248\u672c\u4fe1\u606f\u9664\u4e86\u4f7f\u7528\u547d\u4ee4\u884c\u67e5\u770b\u5916\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u901a\u8fc7\u7f16\u5199C++\u7a0b\u5e8f\u6765\u83b7\u53d6\u5f53\u524d\u7cfb\u7edf\u4e2d\u5b89\u88c5\u7684OpenCV\u7248\u672c\u4fe1\u606f\u3002<\/p>\n","protected":false},"author":1,"featured_media":266499,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-266498","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/266498","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=266498"}],"version-history":[{"count":0,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/266498\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/266499"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=266498"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=266498"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=266498"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}