{"id":3086,"date":"2021-06-17T22:51:16","date_gmt":"2021-06-17T13:51:16","guid":{"rendered":"https:\/\/www.dogrow.net\/python\/?p=3086"},"modified":"2021-06-17T23:38:30","modified_gmt":"2021-06-17T14:38:30","slug":"blog115","status":"publish","type":"post","link":"https:\/\/www.dogrow.net\/python\/blog115\/","title":{"rendered":"(115) matplotlib\u3067\u4f5c\u3063\u305f\u753b\u50cf\u3092\u30d5\u30a1\u30a4\u30eb\u51fa\u529b\u3059\u308b\u3002"},"content":{"rendered":"<h1 class=\"my_h\">1. \u3084\u308a\u305f\u3044\u3053\u3068<\/h1>\n<p><span class=\"my_fc_deeppinkBBig\">matplotlib\u3067\u4f5c\u3063\u305f\u753b\u50cf\u3092\u3001<br \/>\n\u30fb\u30e9\u30b9\u30bf\u753b\u50cf\u30d5\u30a1\u30a4\u30eb (PNG, JPEG)<br \/>\n\u30fb\u30d9\u30af\u30bf\u753b\u50cf\u30d5\u30a1\u30a4\u30eb (SVG)<br \/>\n\u3067\u51fa\u529b\u3057\u305f\u3044\u3002<\/span><\/p>\n<h1 class=\"my_h\">2. \u3084\u3063\u3066\u307f\u308b<\/h1>\n<p>\u3053\u3053\u3067\u306f\u3001<a href=\"https:\/\/www.dogrow.net\/python\/blog99\/\" target=\"_blank\" rel=\"noopener\">(99) OpenCV #4 : \u30ac\u30f3\u30de\u88dc\u6b63\u3067\u753b\u50cf\u3092\u898b\u3084\u3059\u304f\u8abf\u6574<\/a> \u3067\u8868\u793a\u3057\u3066\u3044\u308b\u30b0\u30e9\u30d5\u3092 PNG, JPEG, SVG\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u51fa\u529b\u3057\u3066\u307f\u308b\u3002<\/p>\n<h3 class=\"my_h\">(1) \u30b0\u30e9\u30d5\u3092PNG\u753b\u50cf\u3068\u3057\u3066\u66f8\u304d\u51fa\u3059\u3002<\/h3>\n<p>\u30b0\u30e9\u30d5\u3092\u4f5c\u6210\uff06PNG\u30d5\u30a1\u30a4\u30eb\u51fa\u529b\u3059\u308b\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3002<br \/>\n1\u884c\u76ee~14\u884c\u76ee : \u30b0\u30e9\u30d5\u3092\u4f5c\u6210<br \/>\n15\u884c\u76ee : \u30b0\u30e9\u30d5\u3092 PNG\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u51fa\u529b<\/p>\n<pre class=\"brush: python; highlight: [15]; title: ; notranslate\" title=\"\">\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\n \r\nary_gamma = np.array(&#x5B;0.1, 0.2, 0.4, 0.67, 1, 1.5, 2.5, 5, 10, 25])\r\n \r\nfor var_gamma in ary_gamma:\r\n    var_px = np.empty(256, np.uint8)\r\n    for i in range(256):\r\n        var_px&#x5B;i] = np.clip(pow(i \/ 255.0, var_gamma) * 255.0, 0, 255)\r\n    plt.plot(var_px, label=str(var_gamma))\r\n \r\nplt.legend()\r\nplt.xlabel(&quot;INPUT&quot;)\r\nplt.ylabel(&quot;OUTPUT&quot;)\r\nplt.savefig('gamma.png')\r\n<\/pre>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u753b\u50cf\u304c\u51fa\u529b\u3055\u308c\u305f\u3002<br \/>\n<span class=\"my_fc_blueB\">gamma.png<\/span><br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/python\/wp-content\/uploads\/2021\/06\/gamma.png\" alt=\"\" class=\"my_add_bs1\" \/><\/p>\n<h3 class=\"my_h\">(2) \u30b0\u30e9\u30d5\u3092JPEG\u753b\u50cf\u3068\u3057\u3066\u66f8\u304d\u51fa\u3059\u3002<\/h3>\n<p>\u51fa\u529b\u90e8\u5206\u3092 PNG\u6307\u5b9a\u304b\u3089 JPEG\u6307\u5b9a\u306b\u5909\u3048\u3066\u307f\u308b\u3002<\/p>\n<pre class=\"brush: python; first-line: 15; highlight: [15]; title: ; notranslate\" title=\"\">\r\nplt.savefig('gamma.jpg')\r\n<\/pre>\n<p>\u3042\u308c\uff1f<br \/>\n<span class=\"my_fc_crimsonBBig\">\u7dda\u304c\u8868\u793a\u3055\u308c\u306a\u3044&#8230;<\/span><br \/>\n<span class=\"my_fc_blueB\">gamma.jpg<\/span><br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/python\/wp-content\/uploads\/2021\/06\/gamma.jpg\" alt=\"\" class=\"my_add_bs1\" \/><\/p>\n<p>\u62e1\u5f35\u5b50\u306e\u6307\u5b9a\u3092 jpg \u304b\u3089 jpeg \u306b\u5909\u66f4\u3057\u305f\u3089\u3001<span class=\"my_fc_deeppinkBBig\">\u6b63\u5e38\u306b\u7dda\u304c\u8868\u793a\u3055\u308c\u305f\u3002<\/span><\/p>\n<pre class=\"brush: python; first-line: 15; highlight: [15]; title: ; notranslate\" title=\"\">\r\nplt.savefig('gamma.jpeg')\r\n<\/pre>\n<p><span class=\"my_fc_blueB\">gamma.jpeg<\/span><br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/python\/wp-content\/uploads\/2021\/06\/gamma.jpeg\" alt=\"\" class=\"my_add_bs1\" \/><\/p>\n<h3 class=\"my_h\">(3) \u30b0\u30e9\u30d5\u3092SVG\u753b\u50cf\u3068\u3057\u3066\u66f8\u304d\u51fa\u3059\u3002<\/h3>\n<p>PNG\u3084 JPEG\u306a\u3069\u306e\u30e9\u30b9\u30bf\u753b\u50cf\u3060\u3051\u3067\u306a\u304f\u3001\u30d9\u30af\u30bf\u753b\u50cf\u3067\u3082\u51fa\u529b\u3067\u304d\u308b\u3002<\/p>\n<pre class=\"brush: python; first-line: 15; highlight: [15]; title: ; notranslate\" title=\"\">\r\nplt.savefig('gamma.svg')\r\n<\/pre>\n<p><span class=\"my_fc_blueB\">gamma.svg<\/span><br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/python\/sample\/0115\/gamma.svg\" alt=\"\" class=\"my_add_bs1\" \/><\/p>\n<p>\u516c\u5f0f\u30b5\u30a4\u30c8\u306b\u3088\u308b <span class=\"my_fc_deeppinkB\">savefig<\/span> \u306e\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u306f\u3053\u3061\u3089\u3002<br \/>\n<a href=\"https:\/\/matplotlib.org\/stable\/api\/_as_gen\/matplotlib.pyplot.savefig.html?highlight=savefig#matplotlib.pyplot.savefig\" target=\"_blank\" rel=\"noopener\">matplotlib.pyplot.savefig<\/a><\/p>\n<h1 class=\"my_h\">3. \u53c2\u8003\u60c5\u5831<\/h1>\n<p>matplotlib\u306e\u516c\u5f0f\u30b5\u30a4\u30c8\u306f\u3053\u3061\u3089\u3067\u3059\u3002<br \/>\n<a href=\"https:\/\/matplotlib.org\/\" target=\"_blank\" rel=\"noopener\">https:\/\/matplotlib.org\/<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/python\/wp-content\/uploads\/2021\/06\/i001-1.jpg\" alt=\"\" class=\"my_add_bs1\" \/><\/a><\/p>\n<hr class=\"my_hr_bottom\">\n","protected":false},"excerpt":{"rendered":"<p>1. \u3084\u308a\u305f\u3044\u3053\u3068 matplotlib\u3067\u4f5c\u3063\u305f\u753b\u50cf\u3092\u3001 \u30fb\u30e9\u30b9\u30bf\u753b\u50cf\u30d5\u30a1\u30a4\u30eb (PNG, JPEG) \u30fb\u30d9\u30af\u30bf\u753b\u50cf\u30d5\u30a1\u30a4\u30eb (SVG) \u3067\u51fa\u529b\u3057\u305f\u3044\u3002 2. \u3084\u3063\u3066\u307f\u308b \u3053\u3053\u3067\u306f\u3001(99) OpenCV #4 : \u30ac\u30f3\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.dogrow.net\/python\/blog115\/\">\u7d9a\u304d\u3092\u8aad\u3080 &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-3086","post","type-post","status-publish","format-standard","hentry","category-matplotlib"],"views":9713,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/posts\/3086","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/comments?post=3086"}],"version-history":[{"count":17,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/posts\/3086\/revisions"}],"predecessor-version":[{"id":3107,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/posts\/3086\/revisions\/3107"}],"wp:attachment":[{"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/media?parent=3086"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/categories?post=3086"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/tags?post=3086"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}