{"id":49604,"date":"2024-12-03T10:08:28","date_gmt":"2024-12-03T02:08:28","guid":{"rendered":"https:\/\/fwq.ai\/blog\/49604\/"},"modified":"2024-12-03T10:08:28","modified_gmt":"2024-12-03T02:08:28","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8-left%e3%80%81top%e3%80%81right-%e5%92%8c-bottom-%e5%9d%90%e6%a0%87%e5%9c%a8%e7%9f%a9%e5%bd%a2%e5%86%85%e7%bb%98%e5%88%b6%e5%9c%86%e5%9c%88%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/49604\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528 left\u3001top\u3001right \u548c bottom \u5750\u6807\u5728\u77e9\u5f62\u5185\u7ed8\u5236\u5706\u5708\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u4f7f\u7528 left\u3001top\u3001right \u548c bottom \u5750\u6807\u5728\u77e9\u5f62\u5185\u7ed8\u5236\u5706\u5708\uff1f<\/h1>\n<p>\u4e00\u5206\u8015\u8018\uff0c\u4e00\u5206\u6536\u83b7\uff01\u65e2\u7136\u6253\u5f00\u4e86\u8fd9\u7bc7\u6587\u7ae0\uff0c\u5c31\u575a\u6301\u770b\u4e0b\u53bb\u5427\uff01\u6587\u4e2d\u5185\u5bb9\u5305\u542b<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\u70b9&#8230;\u5e0c\u671b\u4f60\u80fd\u5728\u9605\u8bfb\u672c\u6587\u540e\uff0c\u80fd\u771f\u771f\u5b9e\u5b9e\u5b66\u5230\u77e5\u8bc6\u6216\u8005\u5e2e\u4f60\u89e3\u51b3\u5fc3\u4e2d\u7684\u7591\u60d1\uff0c\u4e5f\u6b22\u8fce\u5927\u4f6c\u6216\u8005\u65b0\u4eba\u670b\u53cb\u4eec\u591a\u7559\u8a00\u8bc4\u8bba\uff0c\u591a\u7ed9\u5efa\u8bae\uff01\u8c22\u8c22\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241029\/173016651867203ef6436fa.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528 left\u3001top\u3001right \u548c bottom \u5750\u6807\u5728\u77e9\u5f62\u5185\u7ed8\u5236\u5706\u5708\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528 left\u3001top\u3001right \u548c bottom \u5750\u6807\u5728\u77e9\u5f62\u5185\u7ed8\u5236\u5706\u5708\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u4f7f\u7528 left\u3001top\u3001right \u548c bottom \u5750\u6807\u8868\u793a\u7684\u77e9\u5f62\u5185\u7ed8\u5236\u5706\u5708<\/strong><\/p>\n<p>\u5982\u4f55\u4f7f\u7528 left\u3001top\u3001right \u548c bottom \u5750\u6807\u6765\u8868\u793a\u77e9\u5f62\uff0c\u5e76\u4f7f\u7528 opencv \u7684 cv2.circle() \u51fd\u6570\u5728\u8fd9\u4e2a\u77e9\u5f62\u5185\u7ed8\u5236\u5706\u5708\u5462\uff1f<\/p>\n<p>\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<p>\u9996\u5148\uff0c\u5bfc\u5165\u5fc5\u8981\u7684\u5e93\uff1a<\/p>\n<pre>import cv2\nimport numpy as np<\/pre>\n<p>\u63a5\u4e0b\u6765\uff0c\u521b\u5efa\u4e00\u4e2a\u586b\u5145\u767d\u8272\uff08255\uff09\u7684\u9ed1\u8272\u56fe\u50cf\uff1a<\/p>\n<pre>img = np.ones((1000, 1000), np.uint8) * 255<\/pre>\n<p>\u63a5\u7740\uff0c\u4f7f\u7528 rectangle() \u51fd\u6570\u5728\u56fe\u50cf\u4e0a\u7ed8\u5236\u4e00\u4e2a\u77e9\u5f62\uff1a<\/p>\n<pre>left, top, right, bottom = 530, 836, 685, 885\ncv2.rectangle(img, (left, top), (right, bottom), 0)<\/pre>\n<p>\u6700\u540e\uff0c\u4f7f\u7528\u4e24\u4e2a\u5d4c\u5957\u7684 for \u5faa\u73af\u904d\u5386\u77e9\u5f62\u5185\u7684\u6bcf\u4e2a\u50cf\u7d20\u70b9\uff0c\u5e76\u4f7f\u7528 circle() \u51fd\u6570\u5728\u8fd9\u4e9b\u50cf\u7d20\u70b9\u4e0a\u7ed8\u5236\u5706\u5708\uff1a<\/p>\n<pre>for y in range(top * 2, bottom * 2 + 1, bottom - top):\n    for x in range(left * 2, right * 2 + 1, right - left):\n        cv2.circle(img, (x, y), 8, 0, cv2.filled, cv2.line_aa, 1)<\/pre>\n<p>\u5c06\u7ed3\u679c\u663e\u793a\u5728\u56fe\u50cf\u7a97\u53e3\u4e2d\uff1a<\/p>\n<pre>cv2.imshow('img', img)\ncv2.waitKey()<\/pre>\n<p>\u6700\u7ec8\uff0c\u4f60\u5c06\u770b\u5230\u4e00\u4e2a\u5e26\u6709 nine\u4e2a\u9ed1\u8272\u5706\u5708\u7684\u767d\u8272\u77e9\u5f62\u3002\u6bcf\u4e2a\u5706\u5708\u90fd\u4f4d\u4e8e\u77e9\u5f62\u5185\u7684\u4e5d\u4e2a\u7279\u5b9a\u70b9\uff1a\u5de6\u4e0a\u3001\u4e0a\u4e2d\u3001\u53f3\u4e0a\u3001\u5de6\u4e2d\u3001\u4e2d\u5fc3\u3001\u53f3\u4e2d\u3001\u5de6\u4e0b\u3001\u4e0b\u4e2d\u548c\u53f3\u4e0b\u3002<\/p>\n<p>\u597d\u4e86\uff0c\u672c\u6587\u5230\u6b64\u7ed3\u675f\uff0c\u5e26\u5927\u5bb6\u4e86\u89e3\u4e86\u300a\u5982\u4f55\u4f7f\u7528 left\u3001top\u3001right \u548c bottom \u5750\u6807\u5728\u77e9\u5f62\u5185\u7ed8\u5236\u5706\u5708\uff1f\u300b\uff0c\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff01\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff0c\u7ed9\u5927\u5bb6\u5206\u4eab\u66f4\u591a\u6587\u7ae0\u77e5\u8bc6\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4f7f\u7528 left\u3001top\u3001right \u548c bottom \u5750\u6807\u5728\u77e9\u5f62\u5185\u7ed8\u5236\u5706\u5708\uff1f \u4e00\u5206\u8015\u8018\uff0c\u4e00\u5206\u6536\u83b7\uff01\u65e2\u7136\u6253\u5f00\u4e86\u8fd9\u7bc7\u6587\u7ae0\uff0c\u5c31\u575a\u6301\u770b\u4e0b\u53bb\u5427\uff01\u6587\u4e2d\u5185\u5bb9\u5305\u542b\u7b49\u7b49\u77e5\u8bc6\u70b9&#8230;\u5e0c\u671b\u4f60\u80fd\u5728\u9605\u8bfb\u672c\u6587\u540e\uff0c\u80fd\u771f\u771f\u5b9e\u5b9e\u5b66\u5230\u77e5\u8bc6\u6216\u8005\u5e2e\u4f60\u89e3\u51b3\u5fc3\u4e2d\u7684\u7591\u60d1\uff0c\u4e5f\u6b22\u8fce\u5927\u4f6c\u6216\u8005\u65b0\u4eba\u670b\u53cb\u4eec\u591a\u7559\u8a00\u8bc4\u8bba\uff0c\u591a\u7ed9\u5efa\u8bae\uff01\u8c22\u8c22\uff01 \u4f7f\u7528 left\u3001top\u3001right \u548c bottom \u5750\u6807\u8868\u793a\u7684\u77e9\u5f62\u5185\u7ed8\u5236\u5706\u5708 \u5982\u4f55\u4f7f\u7528 left\u3001top\u3001right \u548c bottom \u5750\u6807\u6765\u8868\u793a\u77e9\u5f62\uff0c\u5e76\u4f7f\u7528 opencv \u7684 cv2.circle() \u51fd\u6570\u5728\u8fd9\u4e2a\u77e9\u5f62\u5185\u7ed8\u5236\u5706\u5708\u5462\uff1f \u89e3\u51b3\u65b9\u6848\uff1a \u9996\u5148\uff0c\u5bfc\u5165\u5fc5\u8981\u7684\u5e93\uff1a import cv2 import numpy as np \u63a5\u4e0b\u6765\uff0c\u521b\u5efa\u4e00\u4e2a\u586b\u5145\u767d\u8272\uff08255\uff09\u7684\u9ed1\u8272\u56fe\u50cf\uff1a img = np.ones((1000, 1000), np.uint8) * 255 \u63a5\u7740\uff0c\u4f7f\u7528 rectangle() \u51fd\u6570\u5728\u56fe\u50cf\u4e0a\u7ed8\u5236\u4e00\u4e2a\u77e9\u5f62\uff1a left, top, right, bottom = 530, 836, 685, 885 cv2.rectangle(img, (left, top), (right, bottom), 0) \u6700\u540e\uff0c\u4f7f\u7528\u4e24\u4e2a\u5d4c\u5957\u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-49604","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/49604","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=49604"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/49604\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=49604"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=49604"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=49604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}