<br />
<b>Notice</b>:  函数 _load_textdomain_just_in_time 的调用方法<strong>不正确</strong>。 <code>twentyseventeen</code> 域的翻译加载触发过早。这通常表示插件或主题中的某些代码运行过早。翻译应在 <code>init</code> 操作或之后加载。 请查阅<a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">调试 WordPress</a>来获取更多信息。 （这个消息是在 6.7.0 版本添加的。） in <b>/var/www/html/wp/wp-includes/functions.php</b> on line <b>6131</b><br />
{"id":221,"date":"2021-10-21T20:57:14","date_gmt":"2021-10-21T12:57:14","guid":{"rendered":"http:\/\/quziming.top\/?p=221"},"modified":"2022-08-27T17:29:49","modified_gmt":"2022-08-27T09:29:49","slug":"opencv%e5%a4%9a%e5%b9%85%e5%9b%be%e5%83%8f%e5%90%88%e5%b9%b6%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/www.quziming.top\/?p=221","title":{"rendered":"OPENCV\u591a\u5e45\u56fe\u50cf\u62fc\u5408\u51fd\u6570"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">\u5b9e\u73b0\u6548\u679c\uff1a<\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/tva1.sinaimg.cn\/large\/008i3skNly1gvn0ljsgabj61do0n2dhu02.jpg\" alt=\"iShot2021-10-21 16.31.21\"\/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">python\u5b9e\u73b0\uff1a<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import cv2\nimport numpy as np\n\ndef stackImages(scale,imgArray):\n    rows = len(imgArray)\n    cols = len(imgArray[0])\n    rowsAvailable = isinstance(imgArray[0], list)\n    width = imgArray[0][0].shape[1]\n    height = imgArray[0][0].shape[0]\n    if rowsAvailable:\n        for x in range ( 0, rows):\n            for y in range(0, cols):\n                if imgArray[x][y].shape[:2] == imgArray[0][0].shape [:2]:\n                    imgArray[x][y] = cv2.resize(imgArray[x][y], (0, 0), None, scale, scale)\n                else:\n                    imgArray[x][y] = cv2.resize(imgArray[x][y], (imgArray[0][0].shape[1], imgArray[0][0].shape[0]), None, scale, scale)\n                if len(imgArray[x][y].shape) == 2: imgArray[x][y]= cv2.cvtColor( imgArray[x][y], cv2.COLOR_GRAY2BGR)\n        imageBlank = np.zeros((height, width, 3), np.uint8)\n        hor = [imageBlank]*rows\n        hor_con = [imageBlank]*rows\n        for x in range(0, rows):\n            hor[x] = np.hstack(imgArray[x])\n        ver = np.vstack(hor)\n    else:\n        for x in range(0, rows):\n            if imgArray[x].shape[:2] == imgArray[0].shape[:2]:\n                imgArray[x] = cv2.resize(imgArray[x], (0, 0), None, scale, scale)\n            else:\n                imgArray[x] = cv2.resize(imgArray[x], (imgArray[0].shape[1], imgArray[0].shape[0]), None,scale, scale)\n            if len(imgArray[x].shape) == 2: imgArray[x] = cv2.cvtColor(imgArray[x], cv2.COLOR_GRAY2BGR)\n        hor= np.hstack(imgArray)\n        ver = hor\n    return ver\n  \n  \nimg = cv2.imread(\"image.jpg\")\nimgBlur = cv2.GaussianBlur(img, (7, 7), 1)#\u9ad8\u65af\u6a21\u7cca\u5904\u7406\nimgGray = cv2.cvtColor(imgBlur, cv2.COLOR_BGR2GRAY)#\u8f6c\u6362\u6210\u7070\u5ea6\u56fe\nimgStack = stackImages(0.4,([img, imgBlur, imgGray],\n                            [imgGray, img, imgBlur]))\ncv2.imshow(\"Result\", imgStack)<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">C++\u5b9e\u73b0<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#include &lt;vector>\n#include \"opencv2\/opencv.hpp\"\n#include &lt;iostream>\n#include &lt;cstring>\n#include &lt;cmath>\n\nusing namespace std;\n\ncv::Mat StackImage(float scale, std::vector&lt; std::vector&lt;cv::Mat> > images){\n    int rows = images.size();\/\/\u83b7\u53d6\u884c\u6570\n    int cols = images[0].size();\/\/\u83b7\u53d6\u5217\u6570\n\n    if (images[0][0].empty()){\n        cout&lt;&lt;\"image not found\"&lt;&lt;endl;\n        cv::Mat blankImage = cv::Mat::zeros(cv::Size(1, 1), CV_8UC3);;\n        return blankImage;\n    }\n\n    int width=images[0][0].cols, height=images[0][0].rows;  \/\/\u83b7\u53d6\u7b2c\u4e00\u5f20\u56fe\u50cf\u9ad8\u5ea6\u548c\u5bbd\u5ea6\uff0c\u5269\u4f59\u56fe\u50cf\u4ee5\u6b64\u4e3a\u57fa\u51c6\n    int targetWidth=round(width*scale), targetHeight=round(height*scale);   \/\/\u83b7\u53d6\u5355\u5f20\u56fe\u50cf\u7f29\u653e\u540e\u7684\u5bbd\u5ea6\u548c\u9ad8\u5ea6\n    int resultWidth=targetWidth*cols, resultHeight=targetHeight*rows;   \/\/\u8ba1\u7b97\u76ee\u6807\u62fc\u56fe\u7684\u9ad8\u5ea6\u548c\u5bbd\u5ea6\n    int targetType = CV_8UC3;\n\n    cv::Mat result = cv::Mat::zeros(cv::Size(resultWidth, resultHeight), CV_8UC3);\n    \n    for (int i=0; i&lt;rows; ++i){\n        for (int j=0;j&lt;cols; ++j){\n            \n            if (images[i][j].empty()){\n                continue;\n            }\n\n            cv::Mat dstImage;\n            int imgWidth=images[0][0].cols, imgHeight=images[0][0].rows;\n            cv::resize(images[i][j], dstImage, cv::Size(targetWidth, targetHeight));\n            cout&lt;&lt;dstImage.type()&lt;&lt;endl;\n            switch(dstImage.type()){\n                case 0:cv::cvtColor(dstImage, dstImage, CV_GRAY2BGR); break;\n                case 4:cv::cvtColor(dstImage, dstImage, CV_BGRA2BGR); break;\n            }\n            \/\/dstImage.convertTo(dstImage, CV_8UC3);\n\n            CvRect rect = cvRect( targetWidth*j, targetHeight*i, targetWidth, targetHeight);\n            cv::Mat dstMat = result(rect);\n            dstImage.colRange(0, dstImage.cols).copyTo(dstMat);\n        }\n    }\n    \n    return result;\n}\n\n\nint main(){\n    cv::Mat img=cv::imread(\"image.png\");\n    \n    \/*C++11\u6807\u51c6\u53ef\u4ee5\u8fd9\u4e48\u5199*\/\n    vector&lt;vector&lt;cv::Mat> > images { \n        {img, img, img} ,\n        {img, img, img} \n    };\n    \/*\u5907\u7528\u65b9\u6cd5*\/\n    \/\/vector&lt;vector&lt;cv::Mat> > images(1, vector&lt;cv::Mat>(3));\n    \/\/images[0][0]=img;\n    \/\/images[0][1]=img;\n    \/\/images[0][2]=img;\n\n    cv::Mat imgStack = StackImage(0.6f, images);\n    cv::imshow(\"result\", imgStack);\n    cv::waitKey();\n    cv::destroyAllWindows();\n    return 0;\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5b9e\u73b0\u6548\u679c\uff1a python\u5b9e\u73b0\uff1a C++\u5b9e\u73b0<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[26,27],"class_list":["post-221","post","type-post","status-publish","format-standard","hentry","category-opencv","tag-opencv","tag-27"],"_links":{"self":[{"href":"https:\/\/www.quziming.top\/index.php?rest_route=\/wp\/v2\/posts\/221","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.quziming.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quziming.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quziming.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quziming.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=221"}],"version-history":[{"count":8,"href":"https:\/\/www.quziming.top\/index.php?rest_route=\/wp\/v2\/posts\/221\/revisions"}],"predecessor-version":[{"id":236,"href":"https:\/\/www.quziming.top\/index.php?rest_route=\/wp\/v2\/posts\/221\/revisions\/236"}],"wp:attachment":[{"href":"https:\/\/www.quziming.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quziming.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=221"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quziming.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}