{"id":135,"date":"2011-09-14T20:42:01","date_gmt":"2011-09-14T12:42:01","guid":{"rendered":"http:\/\/hymike.net\/blog\/?p=135"},"modified":"2011-09-14T20:42:01","modified_gmt":"2011-09-14T12:42:01","slug":"ubuntu%e4%b8%8b%e5%ae%89%e8%a3%85opencv2-0%e3%80%81eclipse%e7%bc%96%e8%af%91%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"https:\/\/blog.hymike.net\/?p=135","title":{"rendered":"ubuntu\u4e0b\u5b89\u88c5OpenCV2.0\u3001eclipse\u7f16\u8bd1\u73af\u5883"},"content":{"rendered":"<p>OpenCV\u5bf9\u4e8ewindows\u7528\u6237\u800c\u8a00\u975e\u5e38\u53cb\u597d\uff0c\u5bf9\u4e8eVisual Studio\u7684\u914d\u7f6e\u4e5f\u5f88\u65b9\u4fbf\u3002\u7136\u800c\uff0c\u5728linux\u4e0b\uff0c\u56e0\u4e3a\u5404\u79cdlib\u6587\u4ef6\u7684\u539f\u56e0\uff0c\u914d\u7f6eOpenCV\u5e76\u4e0d\u662f\u90a3\u4e48\u8f7b\u677e\u7684\u4e00\u4ef6\u4e8b\u3002\u8d81\u7740\u4eca\u5929\u521a\u521a\u914d\u5b8cubuntu\u4e0b\u7684OpenCV2.0\u548ceclipse\u73af\u5883\uff0c\u8bf4\u8bf4\u5177\u4f53\u8fc7\u7a0b\u5427\u3002<br \/>\n\uff08\u53c2\u8003\u6587\u732e\uff1a<br \/>\nhttp:\/\/www.opencv.org.cn\/index.php\/Debian%E4%B8%8B%E5%AE%89%E8%A3%85<br \/>\nhttp:\/\/hi.baidu.com\/wr_dcy\/blog\/item\/b425151e237989dca6866950.html\uff09<br \/>\n1.\u4e0b\u8f7dOpenCV<br \/>\n\u53bbOpenCV\u4e2d\u6587\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5373\u53ef\u3002http:\/\/www.opencv.org.cn\/ \u6ce8\u610flinux\u9009\u62e9unix\u7248\u672c\u7684OpenCV\u5373\u53ef\u3002\u8fd9\u91cc\u6211\u9009\u62e92.0.0\uff0c\u5176\u5b83\u7248\u672c\u7684\u533a\u522b\u4e0d\u662f\u5f88\u5927\u3002<br \/>\n2.\u89e3\u538bOpenCV\u5230\u4e00\u4e2a\u4f60\u65b9\u4fbf\u64cd\u4f5c\u7684\u4f4d\u7f6e\uff08\u6bd4\u5982\/home\/user\/OpenCV\uff09user\u4e3a\u4f60\u7684\u7528\u6237\u540d\u3002ubuntu\u662f\u53ef\u4ee5\u7528\u53f3\u952e\u89e3\u538b\u7684\u3002<br \/>\n3.\u5b89\u88c5\u5404\u7c7b\u8f6f\u4ef6\uff1a\uff08\u6ce8\u610f\uff0c\u9700\u8981\u5b89\u88c5libjpeg\uff0c\u5426\u5219jpeg\u6587\u4ef6\u4e0d\u80fdload\uff09<br \/>\nsudo apt-get update<br \/>\nsudo apt-get install build-essential<br \/>\nsudo apt-get install gawk<br \/>\nsudo apt-get install libjpeg-dev<br \/>\nsudo apt-get install libtiff-dev<br \/>\nsudo apt-get install libavformat-dev<br \/>\nsudo apt-get install libswscale-dev<br \/>\nsudo apt-get install libgtk2.0-dev<br \/>\n4.\u5728OpenCV\u6587\u4ef6\u5939\u4e0bconfigure<br \/>\nuser@master:~OpenCV$ .\/configure<br \/>\n\u7136\u540e<br \/>\nmake<br \/>\nsudo make install<br \/>\n5.\u8fd9\u65f6\u5019\uff0cOpenCV\u7b97\u662f\u5b8c\u6210\u4e86\u3002\u53ef\u4ee5\u81ea\u5df1\u5199\u4e00\u4e2a\u5c0f\u7684\u6d4b\u8bd5\u7a0b\u5e8f\uff0c\u4e5f\u53ef\u4ee5\u53bbOpenCV\u6587\u4ef6\u5939\u91cc\u9762\u7684samplesc\u76ee\u5f55\u4e0b\u9762\u53bb\u8bd5\u8bd5samples \u3002\u4f8b\u5982\uff1a<br \/>\ng++ `pkg-config opencv &#8211;libs &#8211;cflags opencv` drawing.c -o drawing<br \/>\n\u7136\u540e.\/drawing<br \/>\n\u5c31\u53ef\u4ee5\u770b\u5230\u4e00\u4e2a\u793a\u4f8b\u7a0b\u5e8f\u8fd0\u884c\u4e86\u3002<\/p>\n<p>\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<br \/>\n6.\u5b89\u88c5eclipse\u3002<br \/>\n\u53bbeclipse\u5b98\u65b9\u7f51\u7ad9http:\/\/www.eclipse.org\/ \u4e0b\u8f7declipse for C++ linux\u7248\u672c\u7684\u3002<br \/>\n\u89e3\u538b\u3002<br \/>\n\u8fd9\u91cc\u9700\u8981\u4e4b\u524d\u5b89\u88c5\u8fc7jdk\u73af\u5883\u3002http:\/\/developer.51cto.com\/art\/201012\/238581.htm \u6309\u7167\u8fd9\u7bc7\u6587\u7ae0\u91cc\u9762\u5199\u7684\u5c31\u884c\u4e86\u3002\u6ce8\u610f\/etc\/profile\u91cc\u9762\u7684\u4e1c\u897f\u522b\u5199\u9519\uff0c\u5426\u5219\u4e0b\u6b21\u5f00\u673a\u4f1a\u8fdb\u4e0d\u53bb\u56fe\u5f62\u754c\u9762\u7684\u3002<br \/>\n7.\u8fd0\u884ceclipse\u3002<br \/>\n8.\u65b0\u5efa\u4e00\u4e2a\u9879\u76ee\uff0c\u91cc\u9762\u65b0\u5efa\u4e00\u4e2a.c\u6587\u4ef6\uff0c\u7136\u540e\u5199\u4e0a\u4e0b\u8ff0\u4ee3\u7801\uff1a<br \/>\n<code lang=\"c++\"><br \/>\n#ifdef _CH_<br \/>\n#pragma package<br \/>\n#endif<br \/>\n#define CV_NO_BACKWARD_COMPATIBILITY<\/p>\n<p>#ifndef _EiC<br \/>\n#include \"cv.h\"<br \/>\n#include \"highgui.h\"<br \/>\n#endif<br \/>\n#include <stdio.h><br \/>\n#include <stdlib.h><\/p>\n<p>int main( int argc, char** argv )<br \/>\n{<br \/>\n\tIplImage* img=cvLoadImage(\"baboon.jpg\",1);<br \/>\n\tcvNamedWindow(\"haha\",1);<br \/>\n\tcvShowImage(\"haha\",img);<br \/>\n\tcvWaitKey(0);<br \/>\n\tint params[3];<br \/>\n\tparams[0] = CV_IMWRITE_JPEG_QUALITY;<br \/>\n\tparams[1] = 85;\/\/\u8bbe\u7f6es\u538b\u7f29\u5ea6<br \/>\n\tparams[2] = 0;<\/p>\n<p>\tcvSaveImage(\"t.jpg\",img,params);<br \/>\n\treturn 0;<br \/>\n}<br \/>\n<\/code><br \/>\n\u8fd9\u4e2a\u5c0f\u7a0b\u5e8f\u4f1a\u8bfb\u53d6baboon.jpg\uff08\u5728samplesc\u6587\u4ef6\u5939\u4e0b\u9762\u6709\uff09\uff0c\u663e\u793a\uff0c\u7136\u540e\u5728\u4f60\u6309\u952e\u4e4b\u540e\u4fdd\u5b58\u8fd9\u4e2a\u56fe\u5230t.jpg\u3002\u5f53\u7136\uff0c\u73b0\u5728\u80af\u5b9a\u7f16\u8bd1\u4e0d\u8fc7\u54af\u3002\u73b0\u5728\u8981\u8bbe\u7f6e\u5404\u79cd\u8def\u5f84\uff1a<br \/>\neclipse\u4e0b\uff1a<br \/>\nproject-properties- c\/c++ general-path symbols<br \/>\n<strong>include\u4e2d\u95f4\u6dfb\u52a0\uff1a<\/strong><br \/>\n\/home\/user\/OpenCV\/include\/opencv<br \/>\n\u6ce8\u610f\u9009\u4e2dadd to all configurations all languages<br \/>\n<strong>libraries\u6dfb\u52a0\uff1a<\/strong><br \/>\ncv<br \/>\ncxcore<br \/>\nhighgui<br \/>\n<strong>library path \u6dfb\u52a0\uff1a<\/strong><br \/>\n\/usr\/local\/lib<br \/>\n\u7136\u540e\u786e\u5b9a\u3002\u8fd9\u6837\u91cd\u65b0\u7f16\u8bd1\u8fd9\u4e2a\u4ee3\u7801\u5c31\u53ef\u4ee5\u8fd0\u884c\u4e86\u3002<\/p>\n<p>\u540e\u9762\u4e48\uff0c\u5c31\u50cf\u5728windows\u4e0b\u90a3\u6837\u4f7f\u7528OpenCV\u5427\uff5e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>OpenCV\u5bf9\u4e8ewindows\u7528\u6237\u800c\u8a00\u975e\u5e38\u53cb\u597d\uff0c\u5bf9\u4e8eVisual Studio\u7684\u914d\u7f6e\u4e5f\u5f88\u65b9\u4fbf\u3002\u7136\u800c\uff0c\u5728linu &hellip; <a href=\"https:\/\/blog.hymike.net\/?p=135\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cubuntu\u4e0b\u5b89\u88c5OpenCV2.0\u3001eclipse\u7f16\u8bd1\u73af\u5883\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.hymike.net\/index.php?rest_route=\/wp\/v2\/posts\/135"}],"collection":[{"href":"https:\/\/blog.hymike.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hymike.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hymike.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hymike.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=135"}],"version-history":[{"count":0,"href":"https:\/\/blog.hymike.net\/index.php?rest_route=\/wp\/v2\/posts\/135\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.hymike.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hymike.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hymike.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}