{"id":45820,"date":"2021-12-08T21:32:55","date_gmt":"2021-12-08T12:32:55","guid":{"rendered":"https:\/\/www.charlezz.com\/?p=45820"},"modified":"2021-12-08T21:32:57","modified_gmt":"2021-12-08T12:32:57","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-%ed%8a%b8%eb%9d%bc%ec%9d%b4%ec%95%b5%ea%b8%80-%ea%b5%ac%ed%95%98%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/charlezz.com\/?p=45820","title":{"rendered":"[\uc548\ub4dc\ub85c\uc774\ub4dc\ub85c \ubc30\uc6b0\ub294 OpenCV] \ubc14\uc6b4\ub529 \ud2b8\ub77c\uc774\uc575\uae00 \uad6c\ud558\uae30"},"content":{"rendered":"\n<p>Prerequisite :\u00a0<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 \ud2b8\ub77c\uc774\uc575\uae00<\/h2>\n\n\n\n<p>\ubc14\uc6b4\ub529 \ud2b8\ub77c\uc774\uc575\uae00(\uc0bc\uac01\ud615)\uc774\ub780 <strong>\uc724\uacfd\uc120\uc744 \uc678\uc811\ud558\uc5ec \ub458\ub7ec\uc2f8\ub294 \uac00\uc7a5 \uc791\uc740 \uc0bc\uac01\ud615<\/strong>\uc744 \uc758\ubbf8\ud55c\ub2e4. OpenCV\uc5d0\uc11c\ub294 minEnclosingTriangle\ub77c\ub294 \ud568\uc218\ub97c \ud1b5\ud574 \ubc14\uc6b4\ub529 \ud2b8\ub77c\uc774\uc575\uae00\uc744 \uad6c\ud560 \uc218 \uc788\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Imgproc.minEnclosingTriangle(contour, triangle)<\/pre>\n\n\n\n<p>contour: \uc724\uacfd\uc120 \uc88c\ud45c<br>triangle: \ud568\uc218 \ud638\ucd9c \ud6c4 \ucc38\uc870\ud560 \uc0bc\uac01\ud615 \uc815\ubcf4 (Mat\ud0c0\uc785)<\/p>\n\n\n\n<p>minEnclosingTriangle \ud568\uc218\ub97c \uc774\uc6a9\ud558\uc5ec \uc774\ubbf8\uc9c0 \ub0b4 \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-1638966577287-820x1024.png\" alt=\"\" class=\"wp-image-45822\" width=\"615\" height=\"768\" srcset=\"https:\/\/charlezz.com\/wordpress\/wp-content\/uploads\/2021\/12\/www.charlezz.com-opencv-screenshot-1638966577287-820x1024.png 820w, https:\/\/charlezz.com\/wordpress\/wp-content\/uploads\/2021\/12\/www.charlezz.com-opencv-screenshot-1638966577287-240x300.png 240w, https:\/\/charlezz.com\/wordpress\/wp-content\/uploads\/2021\/12\/www.charlezz.com-opencv-screenshot-1638966577287-768x959.png 768w, https:\/\/charlezz.com\/wordpress\/wp-content\/uploads\/2021\/12\/www.charlezz.com-opencv-screenshot-1638966577287-1230x1536.png 1230w, https:\/\/charlezz.com\/wordpress\/wp-content\/uploads\/2021\/12\/www.charlezz.com-opencv-screenshot-1638966577287-1640x2048.png 1640w, https:\/\/charlezz.com\/wordpress\/wp-content\/uploads\/2021\/12\/www.charlezz.com-opencv-screenshot-1638966577287.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>()\nval hierarchy = Mat()\n\n\/\/ \uc724\uacfd\uc120(\ub3c4\ud615) \uc815\ubcf4 \uad6c\ud558\uae30\nImgproc.findContours(\n    binarySrc,\n    contours,\n    hierarchy,\n    Imgproc.<em>RETR_TREE<\/em>,\n    Imgproc.<em>CHAIN_APPROX_SIMPLE\n<\/em>)\nfor (i in 0 <em>until <\/em>contours.size) {\n    \/\/ \uc0bc\uac01\ud615 \uc815\ubcf4\n    val triangle = Mat()\n    \/\/ \ubc14\uc6b4\ub529 \ud2b8\ub77c\uc774\uc575\uae00 \uad6c\ud558\uae30\n    Imgproc.minEnclosingTriangle(contours[i], triangle)\n    \/\/ \uc5bb\uc740 \uc0bc\uac01\ud615 \uaf2d\uc9d3\uc810 3\uac1c\uc758 \uc88c\ud45c\ub97c \uae30\ubc18\uc73c\ub85c \uc2e4\uc120\uc744 \uadf8\uc5b4 \uc0bc\uac01\ud615\uc744 \ub9cc\ub4e0\ub2e4.\n    for(j in 0..2){\n        val x1 = triangle.get(j, 0)[0]\n        val y1 = triangle.get(j, 0)[1]\n        val point1 = Point(x1, y1)\n        val x2 = triangle.get((j+1)%3, 0)[0]\n        val y2 = triangle.get((j+1)%3, 0)[1]\n        val point2 = Point(x2, y2)\n        Imgproc.line(src, point1, point2, <em>RED<\/em>)\n    }\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Prerequisite :\u00a0\uc724\uacfd\uc120 \uae38\uc774 \uad6c\ud558\uae30 \ubc14\uc6b4\ub529 \ud2b8\ub77c\uc774\uc575\uae00 \ubc14\uc6b4\ub529 \ud2b8\ub77c\uc774\uc575\uae00(\uc0bc\uac01\ud615)\uc774\ub780 \uc724\uacfd\uc120\uc744 \uc678\uc811\ud558\uc5ec \ub458\ub7ec\uc2f8\ub294 \uac00\uc7a5 \uc791\uc740 \uc0bc\uac01\ud615\uc744 \uc758\ubbf8\ud55c\ub2e4. OpenCV\uc5d0\uc11c\ub294 minEnclosingTriangle\ub77c\ub294 \ud568\uc218\ub97c \ud1b5\ud574 \ubc14\uc6b4\ub529 \ud2b8\ub77c\uc774\uc575\uae00\uc744 \uad6c\ud560 \uc218 \uc788\ub2e4. Imgproc.minEnclosingTriangle(contour, triangle) contour: \uc724\uacfd\uc120 \uc88c\ud45ctriangle: \ud568\uc218 \ud638\ucd9c \ud6c4 \ucc38\uc870\ud560 \uc0bc\uac01\ud615 \uc815\ubcf4 (Mat\ud0c0\uc785) minEnclosingTriangle \ud568\uc218\ub97c \uc774\uc6a9\ud558\uc5ec \uc774\ubbf8\uc9c0 \ub0b4 \ub3c4\ud615\uc744 \uac10\uc2f8\ub294 \uc608\uc81c\ub97c \uc0b4\ud3b4\ubcf4\uc790. \uc608\uc81c\ucf54\ub4dc: val contours = ArrayList&lt;MatOfPoint>() [&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\/45820"}],"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=45820"}],"version-history":[{"count":1,"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/posts\/45820\/revisions"}],"predecessor-version":[{"id":45823,"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/posts\/45820\/revisions\/45823"}],"wp:attachment":[{"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=45820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=45820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=45820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}