{"id":9094,"date":"2016-11-14T01:19:55","date_gmt":"2016-11-14T06:19:55","guid":{"rendered":"httpss:\/\/www.powenko.com\/wordpress\/?p=9094"},"modified":"2016-11-14T01:53:43","modified_gmt":"2016-11-14T06:53:43","slug":"09-%e5%9c%96%e7%89%87%e5%a4%a7%e5%b0%8f%e4%bf%ae%e6%94%b9","status":"publish","type":"post","link":"https:\/\/www.powenko.com\/wordpress\/?p=9094","title":{"rendered":"06 \u5716\u7247\u5927\u5c0f\u4fee\u6539"},"content":{"rendered":"<p><a href=\"httpss:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2016\/11\/Screen-Shot-2016-11-14-at-2.07.20-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9095\" src=\"httpss:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2016\/11\/Screen-Shot-2016-11-14-at-2.07.20-PM.png\" alt=\"screen-shot-2016-11-14-at-2-07-20-pm\" width=\"543\" height=\"523\" srcset=\"https:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2016\/11\/Screen-Shot-2016-11-14-at-2.07.20-PM.png 543w, https:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2016\/11\/Screen-Shot-2016-11-14-at-2.07.20-PM-300x289.png 300w, https:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2016\/11\/Screen-Shot-2016-11-14-at-2.07.20-PM-316x304.png 316w, https:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2016\/11\/Screen-Shot-2016-11-14-at-2.07.20-PM-120x116.png 120w, https:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2016\/11\/Screen-Shot-2016-11-14-at-2.07.20-PM-210x202.png 210w, https:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2016\/11\/Screen-Shot-2016-11-14-at-2.07.20-PM-496x478.png 496w, https:\/\/www.powenko.com\/wordpress\/wp-content\/uploads\/2016\/11\/Screen-Shot-2016-11-14-at-2.07.20-PM-140x135.png 140w\" sizes=\"(max-width: 543px) 100vw, 543px\" \/><\/a><br \/>\n<code><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n#include &lt;iostream&gt;\r\n#include &lt;opencv2\/core\/core.hpp&gt; \r\n#include &lt;opencv2\/highgui\/highgui.hpp&gt;\r\n#include &lt;opencv\/highgui.h&gt;\r\n#include &lt;opencv\/cv.h&gt;\r\n\r\n\r\nusing namespace cv ;\r\nusing namespace std ;\r\n\r\n\r\ncv::Mat matControl_3( cv::Mat srcMat )\r\n{\r\n    \/\/\u8907\u88fd\u548c\u6539\u8b8a\u6bcf\u4e00\u500bpixel\u7684\u984f\u8272\r\n    cv::Mat dstMat( srcMat.rows, srcMat.cols, srcMat.type() );\r\n    int nChannels = srcMat.channels();\r\n    int nRows = srcMat.rows;\r\n    int nCols = srcMat.cols * nChannels;\r\n    int nStep = srcMat.step;\r\n    \r\n    uchar* srcData= srcMat.data;\r\n    uchar* dstData = dstMat.data;\r\n    for( int j = 0; j &lt; nRows; j++ ){\r\n        for( int i = 0; i &lt; nCols; i++ ) {\r\n            if(i%3==2){ \/\/0\u85cd 1\u7da0 2\u7d05\r\n                int t1=*(srcData+i);\r\n                t1=t1*3;\r\n                if(t1&gt;255) t1=255;\r\n                *(dstData+i) =t1 ;\r\n            }else{\r\n                *(dstData+i) = *(srcData+i);\r\n            }\r\n        }\r\n        srcData += nStep;\r\n        dstData += nStep;\r\n    }\r\n    \r\n    return dstMat;\r\n}\r\n\r\n\r\nint main() {\r\n    cv::Mat image = cv::imread(&quot;\/Users\/powenko\/Desktop\/1.png&quot;);\r\n    if(image.data!=NULL){\r\n        cv::namedWindow(&quot;Image&quot;) ;\r\n        cv::imshow(&quot;Image&quot;, image) ;\r\n        \r\n        Mat image2=matControl_3(image);\r\n        \r\n        cv::imshow(&quot;mat&quot;, image2) ;\r\n        cv::waitKey() ;\r\n    }\r\n    return 0;\r\n}\r\n\r\n<\/pre>\n<p><code><br \/>\n<\/code><br \/>\nC++ API<\/p>\n<p>void resize(InputArray src, OutputArray dst, Size dsize, double fx=0, double fy=0, int interpolation=INTER_LINEAR )<\/p>\n<p>C API<\/p>\n<p>void cvResize(const CvArr* src, CvArr* dst, int interpolation=CV_INTER_LINEAR )<\/p>\n<p>src \u4f86\u6e90\u5f71\u50cf(input image)<br \/>\ndst \u76ee\u6a19\u5f71\u50cf(output image)<br \/>\ninterpolation\u4fee\u6539\u3001\u63d2\u88dc\u7684\u65b9\u6cd5<br \/>\nINTER_NEAREST \u81e8\u8fd1\u5143\u7d20\u63d2\u503c\u6cd5<br \/>\nINTER_LINEAR \u96d9\u7dda\u6027\u5dee\u503c\u6cd5(\u9ed8\u8a8d)<br \/>\nINTER_CUBIC \u7acb\u65b9\u5dee\u503c\u6cd5<br \/>\nINTER_AREA \u50cf\u7d20\u95dc\u4fc2\u91cd\u63a1\u6a23\u6cd5(\u53ef\u907f\u514d\u6ce2\u7d0b)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>#include &lt;iostream&gt; #include &lt;opencv2\/core\/cor [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":9095,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[247],"tags":[],"class_list":["post-9094","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ch01---ios--opencv"],"_links":{"self":[{"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/9094"}],"collection":[{"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9094"}],"version-history":[{"count":5,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/9094\/revisions"}],"predecessor-version":[{"id":9110,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/9094\/revisions\/9110"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/media\/9095"}],"wp:attachment":[{"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}