{"id":1005,"date":"2013-11-07T19:18:03","date_gmt":"2013-11-07T11:18:03","guid":{"rendered":"http:\/\/www.youthtribe.com\/?p=1005"},"modified":"2014-05-24T11:58:42","modified_gmt":"2014-05-24T03:58:42","slug":"opencv%e5%ae%9e%e7%8e%b0%e5%9b%be%e7%89%87%e5%8f%a0%e5%8a%a0%e9%80%8f%e6%98%8e%e5%ba%a6-%e5%b0%bd%e7%ae%a1opencv%e4%b8%8d%e6%94%af%e6%8c%81%e9%98%bf%e5%b0%94%e6%b3%95%e9%80%9a%e9%81%93","status":"publish","type":"post","link":"http:\/\/www.youthtribe.com\/archives\/1005","title":{"rendered":"opencv\u5b9e\u73b0\u56fe\u7247\u53e0\u52a0\u900f\u660e\u5ea6-\u5c3d\u7ba1opencv\u4e0d\u652f\u6301\u963f\u5c14\u6cd5\u901a\u9053"},"content":{"rendered":"

\u56e0\u4e3aopencv\u4e0d\u652f\u6301\u963f\u5c14\u6cd5\u901a\u9053(\u4e5f\u6709\u7684\u8bf4\u6700\u65b0\u7248\u672c\u7684\u5176\u5b9e\u662f\u652f\u6301\u4e86\u7684,\u5728\u6b64\u6211\u4e0d\u505a\u80af\u5b9a),\u4f46\u8981\u662f\u4e24\u5f20\u56fe\u7247\u53bb\u53e0\u52a0\u7684\u8bdd,\u5176\u5b9e\u8fd8\u662f\u53ef\u4ee5\u7b80\u5355\u5b9e\u73b0\u900f\u660e\u53e0\u52a0\u7684\uff0c\u8fd9\u4e5f\u662f\u5236\u4f5c\u6c34\u5370\u56fe\u7247\u7684\u65b9\u6cd5\u3002
\n\u6bd4\u5982,\u6211\u4eec\u628a\u56fe\u7247B\u53e0\u52a0\u5230\u56fe\u7247A\u4e0a.\u900f\u660e\u7684\u5b9e\u9645\u6548\u679c\u5c31\u662f\u65e2\u80fd\u770b\u5230A\u7684\u5185\u5bb9,\u53c8\u80fd\u770b\u5230B\u7684\u5185\u5bb9.<\/p>\n

\u7ec8\u503c = Va*(1-rank\/10)+Vb*(rank\/10)<\/p>\n

\/\/\/\u4e0b\u8fb9\u662f\u5173\u952e\u4ee3\u7801\uff0c\u6709\u6ce8\u91ca<\/p>\n

\/\/\u5148\u8bf4\u4e00\u4e0b\uff0cpimg\u662f\u5927\u56fe(\u4e5f\u53ef\u4ee5\u7406\u89e3\u4e3a\u80cc\u666f\u56fe)\uff0cwatermarkpic\u662f\u6c34\u5370\u56fe\u7247\uff08\u4f60\u7684\u6c34\u5370logo\uff0c\u6216\u8005\u6587\u5b57\uff09\uff0c\u662fIplImage\u683c\u5f0f\u6307\u9488
\n\/\/\u6ce8\u610f\u6570\u7ec4\u7684\u8d8a\u754c\u95ee\u9898\uff0c\u6c34\u5370\u56fe\u7247\u8981\u6bd4pimg\u7684\u5c0f\u624d\u884c\u7684\u3002\u5982\u679c\u5927\u4e86\uff0c\u5c31\u7f29\u5c0f\u4e00\u4e0b\u5c31\u53ef\u4ee5\u4e86<\/p>\n

\r\n\r\n\t\t\/\/\u628a\u6c34\u5370\u56fe\u7247\u7684\u50cf\u7d20\u503c\u5199\u5230pImg\u7684ROI\u4e2d\r\n\t\tCvScalar scalar1,scalar2,scalar3;\r\n\t\t\/\/\u900f\u660e\u5ea6\u53c2\u6570\r\n\t\tdouble dbAlpha;\r\n                \/\/1-10,0\u4e3a\u4e0d\u900f\u660e,10\u4e3a\u900f\u660e(\u4e5f\u5c31\u662f\u4e0d\u663e\u793a\u6c34\u5370\u56fe\u7247),\u6240\u4ee5\u5b9e\u9645\u503c\u4e3a1-9\r\n\t\tdbAlpha = 2;\r\n\t\tfor (int i=0;iheight;i++)\r\n\t\t{\r\n\t\t\tfor (int j=0;jwidth;j++)\r\n\t\t\t{\r\n\t\t\t\t\/\/\u5f97\u5230\u6c34\u5370\u56fe\u7247\u5bf9\u5e94\u7684\u503c\r\n\t\t\t\t\/\/\u8fd9\u5176\u5b9e\u4e5f\u53ef\u4ee5\u8bbe\u7f6e\u4e00\u4e0b\u900f\u660e\u5ea6\u7684 hyaline\r\n\t\t\t\t\/\/scalar=cvGet2D(watermarkpic,i,j);\/\/\u8fd9\u884c\u662f\u5b8c\u5168\u4e0d\u900f\u660e\u7684\u8bed\u53e5\r\n\t\t\t\tscalar1 = cvGet2D(watermarkpic,i,j);\/\/\u6c34\u5370\u56fe\u7247\u50cf\u7d20\u503c\r\n\t\t\t\tscalar2 = cvGet2D(pImg,i,j);\/\/pimg\u50cf\u7d20\u503c\r\n\t\t\t\tfor (int k =0;k<4;k++)\r\n\t\t\t\t{\r\n                                        \/\/\u5f00\u59cb\u8d4b\u503c\uff0c\u4e5f\u5c31\u662f\u5408\u6210\u540e\u56fe\u7247\u5bf9\u5e94\u7684\u50cf\u7d20\u503c\r\n\t\t\t\t\tscalar3.val[k] = scalar1.val[k]*(1-dbAlpha)+scalar2.val[k]*dbAlpha;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tcvSet2D(pImg,i,j,scalar3);\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n<\/pre>\n

\u4e0b\u8fb9\u96443\u5f20\u6548\u679c\u56fe:<\/p>\n

\"\"<\/a>
opencv\u53e0\u52a0\u900f\u660e\u6548\u679c\u56fe<\/figcaption><\/figure>\n

\"opencv\u53e0\u52a0\u900f\u660e\u6548\u679c\u56fe\"<\/a><\/p>\n

\"\"<\/a>
opencv\u53e0\u52a0\u900f\u660e\u6548\u679c\u56fe<\/figcaption><\/figure>\n

\u6700\u540e,\u611f\u8c22\u7f8e\u5973\u8303\u51b0\u51b0\u5c0f\u59d0\u7684\u53cb\u60c5\u5ba2\u4e32.
\nps:\u56fe\u7247\u6765\u81ea\u622a\u5c4f\u8f6f\u4ef6\uff0c\u5c31\u6709\u6dfb\u52a0\u900f\u660e\u6c34\u5370\u7684\u6548\u679c\u54e6\uff0c\u53ef\u81ea\u5b9a\u4e49\u6c34\u5370\u4f4d\u7f6e\u54c8\uff1a
http:\/\/www.youthtribe.com\/snapshot\/<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"

\u56e0\u4e3aopencv\u4e0d\u652f\u6301\u963f\u5c14\u6cd5\u901a\u9053(\u4e5f\u6709\u7684\u8bf4\u6700\u65b0\u7248\u672c\u7684\u5176\u5b9e\u662f\u652f\u6301\u4e86\u7684,\u5728\u6b64\u6211\u4e0d\u505a\u80af\u5b9a),\u4f46\u8981\u662f\u4e24\u5f20\u56fe\u7247\u53bb\u53e0\u52a0\u7684\u8bdd,\u5176\u5b9e\u8fd8\u662f\u53ef\u4ee5\u7b80\u5355\u5b9e\u73b0\u900f\u660e\u53e0\u52a0\u7684\uff0c\u8fd9\u4e5f\u662f\u5236\u4f5c\u6c34\u5370\u56fe\u7247\u7684\u65b9\u6cd5\u3002 \u6bd4\u5982,\u6211\u4eec\u628a\u56fe\u7247B\u53e0\u52a0\u5230\u56fe\u7247A\u4e0a.\u900f\u660e\u7684\u5b9e\u9645\u6548\u679c\u5c31\u662f\u65e2\u80fd\u770b\u5230A\u7684\u5185\u5bb9,\u53c8\u80fd\u770b\u5230B\u7684\u5185\u5bb9. \u7ec8\u503c = Va*(1-rank\/10)+Vb*(rank\/10) \/\/\/\u4e0b\u8fb9\u662f\u5173\u952e\u4ee3\u7801\uff0c\u6709\u6ce8\u91ca \/\/\u5148\u8bf4\u4e00\u4e0b\uff0cpimg\u662f\u5927\u56fe(\u4e5f\u53ef\u4ee5\u7406\u89e3\u4e3a\u80cc\u666f\u56fe)\uff0cwatermarkpic\u662f\u6c34\u5370\u56fe\u7247\uff08\u4f60\u7684\u6c34\u5370logo\uff0c\u6216\u8005\u6587\u5b57\uff09\uff0c\u662fIplImage\u683c\u5f0f\u6307\u9488 \/\/\u6ce8\u610f\u6570\u7ec4\u7684\u8d8a\u754c\u95ee\u9898\uff0c\u6c34\u5370\u56fe\u7247\u8981\u6bd4pimg\u7684\u5c0f\u624d\u884c\u7684\u3002\u5982\u679c\u5927\u4e86\uff0c\u5c31\u7f29\u5c0f\u4e00\u4e0b\u5c31\u53ef\u4ee5\u4e86 \/\/\u628a\u6c34\u5370<\/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,166,180,168,167],"_links":{"self":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/1005"}],"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=1005"}],"version-history":[{"count":20,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/1005\/revisions"}],"predecessor-version":[{"id":1007,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/1005\/revisions\/1007"}],"wp:attachment":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/media?parent=1005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/categories?post=1005"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/tags?post=1005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}