{"id":8338,"date":"2019-10-20T21:42:12","date_gmt":"2019-10-20T12:42:12","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=8338"},"modified":"2020-05-28T10:08:57","modified_gmt":"2020-05-28T01:08:57","slug":"opencv%ec%9d%98-%ec%9d%b4%eb%af%b8%ec%a7%80%ec%97%90-%ed%95%9c%ea%b8%80-%ec%b6%9c%eb%a0%a5%ed%95%98%ea%b8%b0","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=8338","title":{"rendered":"OpenCV\uc758 \uc774\ubbf8\uc9c0\uc5d0 \ud55c\uae00 \ucd9c\ub825\ud558\uae30"},"content":{"rendered":"<p>\uc0ac\uc2e4 OpenCV\uc758 \uc774\ubbf8\uc9c0\ub294 numpy\uc758 \ubc30\uc5f4\uc785\ub2c8\ub2e4. \uadf8\ub7f0\ub370 \ubb38\uc81c\ub294 \ud30c\uc774\uc36c\uc5d0\uc11c OpenCV\ub97c \ud1b5\ud574 \ud14d\uc2a4\ud2b8\ub97c \ucd9c\ub825\ud560\ub54c \ud55c\uae00 \ucd9c\ub825\uc774 \uc27d\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \ud574\uc11c \ud55c\uae00 \ucd9c\ub825\uc744 \uc704\ud574 PIL(Python Imaging Library)\uc758 \ub3c4\uc6c0\uc744 \ubc1b\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc544\ub798\uc758 \uc608\uc81c\uac00 \ubc14\ub85c \uadf8\uac83\uc785\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">\r\nimport numpy as np\r\nfrom PIL import ImageFont, ImageDraw, Image\r\nimport cv2\r\n\r\nimg = np.zeros((200,400,3),np.uint8)\r\n\r\nb,g,r,a = 255,255,255,0\r\nfontpath = \"fonts\/gulim.ttc\"\r\nfont = ImageFont.truetype(fontpath, 20)\r\nimg_pil = Image.fromarray(img)\r\ndraw = ImageDraw.Draw(img_pil)\r\ndraw.text((60, 70),  \"\uae40\ud615\uc900ABC123#GISDeveloper\", font=font, fill=(b,g,r,a))\r\n\r\nimg = np.array(img_pil)\r\ncv2.putText(img,  \"by Dip2K\", (250,120), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (b,g,r), 1, cv2.LINE_AA)\r\n\r\ncv2.imshow(\"res\", img)\r\ncv2.waitKey()\r\ncv2.destroyAllWindows()\r\n<\/pre>\n<p>7-12\ubc88 \ucf54\ub4dc\uac00 PIL\uc744 \uc774\uc6a9\ud574 \ud55c\uae00\uc744 \ucd9c\ub825\ud558\ub294 \ucf54\ub4dc\uc774\uace0, 14~15\ubc88 \ucf54\ub4dc\ub294 OpenCV\uc758 \ud14d\uc2a4\ud2b8 \ucd9c\ub825 \ucf54\ub4dc\uc785\ub2c8\ub2e4. \uacb0\uacfc\ub294 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/2019\/10\/OpenCV_PIL_HANGUL.png\" alt=\"\" width=\"605\" height=\"351\" class=\"aligncenter size-full wp-image-8341\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc0ac\uc2e4 OpenCV\uc758 \uc774\ubbf8\uc9c0\ub294 numpy\uc758 \ubc30\uc5f4\uc785\ub2c8\ub2e4. \uadf8\ub7f0\ub370 \ubb38\uc81c\ub294 \ud30c\uc774\uc36c\uc5d0\uc11c OpenCV\ub97c \ud1b5\ud574 \ud14d\uc2a4\ud2b8\ub97c \ucd9c\ub825\ud560\ub54c \ud55c\uae00 \ucd9c\ub825\uc774 \uc27d\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \ud574\uc11c \ud55c\uae00 \ucd9c\ub825\uc744 \uc704\ud574 PIL(Python Imaging Library)\uc758 \ub3c4\uc6c0\uc744 \ubc1b\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc544\ub798\uc758 \uc608\uc81c\uac00 \ubc14\ub85c \uadf8\uac83\uc785\ub2c8\ub2e4. import numpy as np from PIL import ImageFont, ImageDraw, Image import cv2 img = np.zeros((200,400,3),np.uint8) b,g,r,a = 255,255,255,0 fontpath = &#8220;fonts\/gulim.ttc&#8221; font = ImageFont.truetype(fontpath, &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=8338\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;OpenCV\uc758 \uc774\ubbf8\uc9c0\uc5d0 \ud55c\uae00 \ucd9c\ub825\ud558\uae30&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[131],"tags":[],"class_list":["post-8338","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/8338","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8338"}],"version-history":[{"count":4,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/8338\/revisions"}],"predecessor-version":[{"id":9370,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/8338\/revisions\/9370"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8338"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}