{"id":925,"date":"2013-07-14T13:59:51","date_gmt":"2013-07-14T05:59:51","guid":{"rendered":"http:\/\/www.youthtribe.com\/?p=925"},"modified":"2014-03-13T18:20:01","modified_gmt":"2014-03-13T10:20:01","slug":"opencv-%e8%86%a8%e8%83%80%e7%ae%97%e6%b3%95cvdilate","status":"publish","type":"post","link":"http:\/\/www.youthtribe.com\/archives\/925","title":{"rendered":"opencv-\u81a8\u80c0\u7b97\u6cd5cvDilate"},"content":{"rendered":"
\u5148\u4e0a\u5b9a\u4e49\uff1a<\/p>\n
\nDilate<\/h3>\n
\u4f7f\u7528\u4efb\u610f\u7ed3\u6784\u5143\u7d20\u81a8\u80c0\u56fe\u50cf<\/p>\n
void cvDilate( const CvArr* src, CvArr* dst, IplConvKernel* element=NULL, int iterations=1 );<\/pre>\n\n
- src<\/dt>\n
- \u8f93\u5165\u56fe\u50cf.<\/dd>\n
- dst<\/dt>\n
- \u8f93\u51fa\u56fe\u50cf.<\/dd>\n
- element<\/dt>\n
- \u7528\u4e8e\u81a8\u80c0\u7684\u7ed3\u6784\u5143\u7d20\u3002\u82e5\u4e3a NULL, \u5219\u4f7f\u7528 3\u00d73 \u957f\u65b9\u5f62\u7684\u7ed3\u6784\u5143\u7d20<\/dd>\n
- iterations<\/dt>\n
- \u81a8\u80c0\u7684\u6b21\u6570<\/dd>\n<\/dl>\n
\u51fd\u6570 cvDilate \u5bf9\u8f93\u5165\u56fe\u50cf\u4f7f\u7528\u6307\u5b9a\u7684\u7ed3\u6784\u5143\u8fdb\u884c\u81a8\u80c0\uff0c\u8be5\u7ed3\u6784\u51b3\u5b9a\u6bcf\u4e2a\u5177\u6709\u6700\u5c0f\u503c\u8c61\u7d20\u70b9\u7684\u90bb\u57df\u5f62\u72b6\uff1a<\/p>\n
dst=dilate(src,element): dst(x,y)=max((x',y') in element))src(x+x',y+y')<\/pre>\n\u51fd\u6570\u652f\u6301\uff08in-place\uff09\u6a21\u5f0f\u3002\u81a8\u80c0\u53ef\u4ee5\u91cd\u590d\u8fdb\u884c (iterations) \u6b21. \u5bf9\u5f69\u8272\u56fe\u50cf\uff0c\u6bcf\u4e2a\u5f69\u8272\u901a\u9053\u5355\u72ec\u5904\u7406\u3002<\/p><\/blockquote>\n
<\/p>\n
\u4e0b\u8fb9\u662f\u7a0b\u5e8f\uff1a<\/p>\n
\/\/ opencv_template.cpp : \u5b9a\u4e49\u63a7\u5236\u53f0\u5e94\u7528\u7a0b\u5e8f\u7684\u5165\u53e3\u70b9\u3002 \/\/\r\n#include \"stdafx.h\"\r\n#include \"opencv2\/opencv.hpp\"; \r\n#include \"opencv\/cv.h\";\r\n\r\nusing namespace std; \r\nusing namespace cv;\r\n\r\nint _tmain(int argc, _TCHAR* argv[]) { \u00a0\r\n\/\/cout\"\"\"iam a boy\"\"\"endl; \u00a0\r\nIplImage *img; \u00a0img=cvLoadImage(\"test.jpg\",1); \u00a0\r\nIplImage *newimg; \u00a0\r\nnewimg = cvCloneImage(img);\r\n\r\n\/\/\u5f00\u59cb\u81a8\u80c0 \u00a0\r\ncvDilate(img,newimg,NULL,3); \u00a0\r\n\/\/\u5f00\u59cb\u8150\u8680 \u00a0\r\n\/\/cvErode(img,newimg,NULL,3);\r\n\r\n\/\/\u5f00\u59cb\u663e\u793a\u56fe\u7247 \u00a0\r\ncvNamedWindow(\"DilateBefore\",CV_WINDOW_AUTOSIZE); \u00a0\r\ncvNamedWindow(\"DilateAfter\",CV_WINDOW_AUTOSIZE); \u00a0\r\ncvShowImage(\"DilateBefore\",img); \u00a0\r\ncvSaveImage(\"new.jpg\",newimg); \u00a0\r\ncvShowImage(\"DilateAfter\",newimg); \u00a0\r\ncvWaitKey(0); \u00a0\r\n\/\/system(\"pause\"); \u00a0\r\nreturn 0; \r\n}<\/pre>\n<\/p>\n
<\/p>\n","protected":false},"excerpt":{"rendered":"
\u5148\u4e0a\u5b9a\u4e49\uff1a Dilate \u4f7f\u7528\u4efb\u610f\u7ed3\u6784\u5143\u7d20\u81a8\u80c0\u56fe\u50cf void cvDilate( const CvArr* src, CvArr* dst, IplConvKernel* element=NULL, int iterations=1 ); src \u8f93\u5165\u56fe\u50cf. dst \u8f93\u51fa\u56fe\u50cf. element \u7528\u4e8e\u81a8\u80c0\u7684\u7ed3\u6784\u5143\u7d20\u3002\u82e5\u4e3a NULL, \u5219\u4f7f\u7528 3\u00d73 \u957f\u65b9\u5f62\u7684\u7ed3\u6784\u5143\u7d20 iterations \u81a8\u80c0\u7684\u6b21\u6570 \u51fd\u6570 cvDilate \u5bf9\u8f93\u5165\u56fe\u50cf\u4f7f\u7528\u6307\u5b9a\u7684\u7ed3\u6784\u5143\u8fdb\u884c\u81a8\u80c0\uff0c\u8be5\u7ed3\u6784\u51b3\u5b9a\u6bcf\u4e2a\u5177\u6709\u6700\u5c0f\u503c\u8c61\u7d20\u70b9\u7684\u90bb\u57df\u5f62\u72b6\uff1a dst=dilate(src,element): dst(x,y)=max((x’,y’) i<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,150],"tags":[139,144],"_links":{"self":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/925"}],"collection":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/comments?post=925"}],"version-history":[{"count":3,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/925\/revisions"}],"predecessor-version":[{"id":927,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/925\/revisions\/927"}],"wp:attachment":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/media?parent=925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/categories?post=925"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/tags?post=925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}