{"id":45809,"date":"2021-12-07T11:43:31","date_gmt":"2021-12-07T02:43:31","guid":{"rendered":"https:\/\/www.charlezz.com\/?p=45809"},"modified":"2021-12-08T21:26:54","modified_gmt":"2021-12-08T12:26:54","slug":"%ec%95%88%eb%93%9c%eb%a1%9c%ec%9d%b4%eb%93%9c%eb%a1%9c-%eb%b0%b0%ec%9a%b0%eb%8a%94-opencv-%eb%b0%94%ec%9a%b4%eb%94%a9-%eb%b0%95%ec%8a%a4-%ea%b5%ac%ed%95%98%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/charlezz.com\/?p=45809","title":{"rendered":"[\uc548\ub4dc\ub85c\uc774\ub4dc\ub85c \ubc30\uc6b0\ub294 OpenCV] \ubc14\uc6b4\ub529 \ubc15\uc2a4 \uad6c\ud558\uae30"},"content":{"rendered":"\n<p>Prerequisite : <a href=\"https:\/\/www.charlezz.com\/?p=45795\">\uc724\uacfd\uc120 \uae38\uc774 \uad6c\ud558\uae30<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\ubc14\uc6b4\ub529 \ubc15\uc2a4<\/h2>\n\n\n\n<p>\ubc14\uc6b4\ub529 \ubc15\uc2a4\ub780 <strong>\uc724\uacfd\uc120\uc744 \uc678\uc811\ud558\uc5ec \ub458\ub7ec\uc2f8\ub294 \uac00\uc7a5 \uc791\uc740 \uc0ac\uac01\ud615<\/strong>\uc744 \uc758\ubbf8\ud55c\ub2e4. OpenCV\uc5d0\uc11c\ub294 boundingRect\ub77c\ub294 \ud568\uc218\ub97c \ud1b5\ud574 \ubc14\uc6b4\ub529 \ubc15\uc2a4\ub97c \uad6c\ud560 \uc218 \uc788\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Imgproc.boundingRect(contour)<\/pre>\n\n\n\n<p>contour: \uc678\uacfd\uc120 \uc815\ubcf4(\uc88c\ud45c)<br>\ubc18\ud658\uac12: \uc0ac\uac01\ud615 \uc815\ubcf4(Rect);(x,y,w,h) \uc815\ubcf4\ub97c \ud3ec\ud568<\/p>\n\n\n\n<p>boundingRect\ud568\uc218\ub97c \uc774\uc6a9\ud558\uc5ec \uc774\ubbf8\uc9c0\ub0b4\uc758 \ub3c4\ud615\uc744 \uac10\uc2f8\ub294 \uc608\uc81c\ub97c \uc0b4\ud3b4\ubcf4\uc790.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2021\/12\/www.charlezz.com-opencv-screenshot-1638844697072-820x1024.png\" alt=\"\" class=\"wp-image-45810\" width=\"615\" height=\"768\" srcset=\"https:\/\/charlezz.com\/wordpress\/wp-content\/uploads\/2021\/12\/www.charlezz.com-opencv-screenshot-1638844697072-820x1024.png 820w, https:\/\/charlezz.com\/wordpress\/wp-content\/uploads\/2021\/12\/www.charlezz.com-opencv-screenshot-1638844697072-240x300.png 240w, https:\/\/charlezz.com\/wordpress\/wp-content\/uploads\/2021\/12\/www.charlezz.com-opencv-screenshot-1638844697072-768x959.png 768w, https:\/\/charlezz.com\/wordpress\/wp-content\/uploads\/2021\/12\/www.charlezz.com-opencv-screenshot-1638844697072-1230x1536.png 1230w, https:\/\/charlezz.com\/wordpress\/wp-content\/uploads\/2021\/12\/www.charlezz.com-opencv-screenshot-1638844697072-1640x2048.png 1640w, https:\/\/charlezz.com\/wordpress\/wp-content\/uploads\/2021\/12\/www.charlezz.com-opencv-screenshot-1638844697072.png 1768w\" sizes=\"(max-width: 615px) 100vw, 615px\" \/><\/figure>\n\n\n\n<p>\uc608\uc81c \ucf54\ub4dc:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">val contours = ArrayList&lt;MatOfPoint&gt;()\nval hierarchy = Mat()\n\n\/\/ \uc774\uc9c4\ud654 \uc774\ubbf8\uc9c0\uc5d0\uc11c \uc724\uacfd\uc120 \ucc3e\uae30\nImgproc.findContours(\n    binarySrc,\n    contours,\n    hierarchy,\n    Imgproc.<em>RETR_TREE<\/em>,\n    Imgproc.<em>CHAIN_APPROX_SIMPLE\n<\/em>)\n\nfor (i in 0 <em>until <\/em>contours.size) {\n    \/\/ \uc724\uacfd\uc120\uc744 \uac10\uc2f8\ub294 \ucd5c\uc18c \uc0ac\uac01\ud615 \uc815\ubcf4\n    val rect:Rect = Imgproc.boundingRect(contours[i])\n    \/\/ rect\ub97c \uae30\ubc18\uc73c\ub85c \uc0ac\uac01\ud615 \uadf8\ub9ac\uae30\n    Imgproc.rectangle(src, rect, <em>RED<\/em>)\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Prerequisite : \uc724\uacfd\uc120 \uae38\uc774 \uad6c\ud558\uae30 \ubc14\uc6b4\ub529 \ubc15\uc2a4 \ubc14\uc6b4\ub529 \ubc15\uc2a4\ub780 \uc724\uacfd\uc120\uc744 \uc678\uc811\ud558\uc5ec \ub458\ub7ec\uc2f8\ub294 \uac00\uc7a5 \uc791\uc740 \uc0ac\uac01\ud615\uc744 \uc758\ubbf8\ud55c\ub2e4. OpenCV\uc5d0\uc11c\ub294 boundingRect\ub77c\ub294 \ud568\uc218\ub97c \ud1b5\ud574 \ubc14\uc6b4\ub529 \ubc15\uc2a4\ub97c \uad6c\ud560 \uc218 \uc788\ub2e4. Imgproc.boundingRect(contour) contour: \uc678\uacfd\uc120 \uc815\ubcf4(\uc88c\ud45c)\ubc18\ud658\uac12: \uc0ac\uac01\ud615 \uc815\ubcf4(Rect);(x,y,w,h) \uc815\ubcf4\ub97c \ud3ec\ud568 boundingRect\ud568\uc218\ub97c \uc774\uc6a9\ud558\uc5ec \uc774\ubbf8\uc9c0\ub0b4\uc758 \ub3c4\ud615\uc744 \uac10\uc2f8\ub294 \uc608\uc81c\ub97c \uc0b4\ud3b4\ubcf4\uc790. \uc608\uc81c \ucf54\ub4dc: val contours = ArrayList&lt;MatOfPoint&gt;() val hierarchy = Mat() [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"inline_featured_image":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[27],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/posts\/45809"}],"collection":[{"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=45809"}],"version-history":[{"count":2,"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/posts\/45809\/revisions"}],"predecessor-version":[{"id":45821,"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/posts\/45809\/revisions\/45821"}],"wp:attachment":[{"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=45809"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=45809"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=45809"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}