{"id":149,"date":"2019-04-24T09:00:45","date_gmt":"2019-04-24T00:00:45","guid":{"rendered":"http:\/\/dandelions.co.jp\/blog\/?p=149"},"modified":"2019-04-24T09:16:05","modified_gmt":"2019-04-24T00:16:05","slug":"tech-blog-1","status":"publish","type":"post","link":"http:\/\/dandelions.co.jp\/blog\/blog\/2019\/04\/24\/tech-blog-1\/","title":{"rendered":"\u6280\u8853\u8005\u30d6\u30ed\u30b0(1) \u2013 Python\u3068OpenCV\u3067\u9854\u3092\u8a8d\u8b58\u3059\u308b"},"content":{"rendered":"\n<p>\u6280\u8853\u8005\u30d6\u30ed\u30b0\u3068\u984c\u3057\u3066\u793e\u54e1\u304c\u65e5\u3054\u308d\u53d6\u308a\u7d44\u3093\u3067\u3044\u308b\u5b66\u7fd2\u5185\u5bb9\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<br>\u7b2c1\u56de\u306f\u3001AI\u3092\u30c6\u30fc\u30de\u306b\u3057\u3066\u3044\u308b\u7b2c1\u30e6\u30cb\u30c3\u30c8\u3067\u3059\u3002 <\/p>\n\n\n\n<h2>\u4eca\u56de\u306e\u30c6\u30fc\u30de <br>\u300e\u753b\u50cf\u306e\u4e2d\u304b\u3089\u9854\u3092\u5224\u5225\u3059\u308b\u300f<\/h2>\n\n\n\n<h4>\u4f7f\u7528\u3059\u308b\u8a00\u8a9e &#8211; Python<\/h4>\n\n\n\n<p>\u6a5f\u68b0\u5b66\u7fd2\u5411\u3051\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306a\u3069\u74b0\u5883\u304c\u5145\u5b9f\u3057\u3066\u304a\u308a\u60c5\u5831\u3082\u96c6\u3081\u3084\u3059\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<h4>\u4f7f\u3063\u305f\u3082\u306e &#8211; OpenCV<\/h4>\n\n\n\n<blockquote style=\"text-align:center\" class=\"wp-block-quote is-style-default\"><p>OpenCV\uff08\u6b63\u5f0f\u540d\u79f0\uff1a Open Source Computer Vision Library\uff09\u306f\u3001\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u30fb\u30d3\u30b8\u30e7\u30f3\u30fb\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u3067\u753b\u50cf\u3084\u52d5\u753b\u3092\u51e6\u7406\u3059\u308b\u306e\u306b\u5fc5\u8981\u306a\u3001\u3055\u307e\u3056\u307e\u6a5f\u80fd\u304c\u5b9f\u88c5\u3055\u308c\u3066\u304a\u308a\u3001BSD\u30e9\u30a4\u30bb\u30f3\u30b9\u3067\u914d\u5e03\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304b\u3089\u5b66\u8853\u7528\u9014\u3060\u3051\u3067\u306a\u304f\u5546\u7528\u76ee\u7684\u3067\u3082\u5229\u7528\u3067\u304d\u307e\u3059\u3002\u52a0\u3048\u3066\u3001\u30de\u30eb\u30c1\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u5bfe\u5fdc\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u5e45\u5e83\u3044\u5834\u9762\u3067\u5229\u7528\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u7279\u5fb4\u3067\u3059\u3002<\/p><cite>\u5f15\u7528<br><a href=\"https:\/\/www.buildinsider.net\/small\/opencv\/001\">https:\/\/www.buildinsider.net\/small\/opencv\/001<\/a><\/cite><\/blockquote>\n\n\n\n<p><br>OpenCV\u306b\u306f\u753b\u50cf\u306e\u7279\u5fb4\u304b\u3089\u5224\u65ad\u3059\u308b\u305f\u3081\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u3042\u3089\u304b\u3058\u3081\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002(\u30ab\u30b9\u30b1\u30fc\u30c9\u578b\u5206\u985e\u5668\u3068\u304b\u8a00\u3063\u305f\u308a\u3059\u308b\u3089\u3057\u3044)<\/p>\n\n\n\n<p>\u4eca\u56de\u306f\u305d\u308c\u3092\u5229\u7528\u3057\u3001\u7528\u610f\u3057\u305f\u753b\u50cf\u304b\u3089\u9854\u3092\u8a8d\u8b58\u3055\u305b\u3001\u9854\u306e\u90e8\u5206\u3060\u3051\u5207\u308a\u51fa\u3057\u305f\u753b\u50cf\u3092\u51fa\u529b\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\uff08\u629c\u7c8b\uff09<\/h4>\n\n\n\n<p>\u30c8\u30e9\u30a4\uff06\u30a8\u30e9\u30fc\u306e\u904e\u7a0b\u306f\u7701\u7565\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u3001\u5b9f\u969b\u306b\u4f5c\u3063\u305f\u5185\u5bb9\u3092\u3056\u3063\u304f\u308a\u3068\u66f8\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h4>openCV\u306e\u30a4\u30f3\u30dd\u30fc\u30c8<\/h4>\n\n\n\n<pre class=\"wp-block-verse\">import cv2<\/pre>\n\n\n\n<h4>\u30ab\u30b9\u30b1\u30fc\u30c9\u578b\u5206\u985e\u5668\u306b\u4f7f\u7528\u3059\u308b\u5206\u985e\u5668\u306e\u30c7\u30fc\u30bf\uff08xml\u30d5\u30a1\u30a4\u30eb\uff09\u3092\u8aad\u307f\u8fbc\u307f<\/h4>\n\n\n\n<pre class=\"wp-block-verse wp-block-preformatted\">face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_alt2.xml')<br> eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml') <\/pre>\n\n\n\n<p>\u30ab\u30b9\u30b1\u30fc\u30c9\u578b\u5206\u985e\u5668\u306b\u4f7f\u7528\u3059\u308b\u5206\u985e\u5668\u306e\u30c7\u30fc\u30bf\uff08xml\u30d5\u30a1\u30a4\u30eb\uff09\u3092\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002<br>\u4eca\u56de\u306f\u9854\u3068\u76ee\u691c\u51fa\u3092\u884c\u3044\u305f\u3044\u305f\u3081\u3001\u4e0a\u8a182\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002 <\/p>\n\n\n\n<h4>\u30ab\u30b9\u30b1\u30fc\u30c9\u578b\u5206\u985e\u5668\u3092\u4f7f\u7528\u3057\u3066\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u9854\u90e8\u5206\u3092\u691c\u51fa\u3059\u308b<\/h4>\n\n\n\n<pre class=\"wp-block-verse\">faces = face_cascade.detectMultiScale(img, 1.02, 5)<\/pre>\n\n\n\n<p>\u9854\u691c\u51fa\u3092\u884c\u3044\u307e\u3059\u3002\u691c\u51fa\u306b\u6210\u529f\u3057\u305f\u5834\u5408\u306f\u753b\u50cf\u306e\u30b5\u30a4\u30ba\u304c\u51fa\u529b\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h4>\u691c\u51fa\u90e8\u5206\u3092\u5207\u308a\u51fa\u3057\u3066\u753b\u50cf\u4fdd\u5b58<\/h4>\n\n\n\n<pre class=\"wp-block-verse\">x,y,w,h = item['frame']<br>face = rotated[y:y+h, x:x+w] <br>face = cv2.resize(face, (IMAGE_SIZE, IMAGE_SIZE)) <br>web_path = '%s\/%s_%s.jpg' % (out_dir, fn, item['face_id']) <br>out_file = '%s\/%s' % (base_dir, web_path)  <br>cv2.imwrite(out_file, face) <br><\/pre>\n\n\n\n<h2>                                                                          <br> \u5b9f\u969b\u306b\u3084\u3063\u3066\u307f\u305f<\/h2>\n\n\n\n<p> &nbsp;&nbsp; <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"333\" height=\"241\" src=\"http:\/\/dandelions.co.jp\/blog\/wp\/wp-content\/uploads\/2019\/04\/image.png\" alt=\"\" class=\"wp-image-152\" srcset=\"http:\/\/dandelions.co.jp\/blog\/wp\/wp-content\/uploads\/2019\/04\/image.png 333w, http:\/\/dandelions.co.jp\/blog\/wp\/wp-content\/uploads\/2019\/04\/image-300x217.png 300w\" sizes=\"(max-width: 333px) 100vw, 333px\" \/><\/figure>\n\n\n\n<p>\u3053\u306e\u753b\u50cf\u3092\u6307\u5b9a\u3057\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3059\u308b\u3068\u2026<\/p>\n\n\n\n<p> &nbsp;&nbsp; \u2193<\/p>\n\n\n\n<p>  <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"85\" height=\"85\" src=\"http:\/\/dandelions.co.jp\/blog\/wp\/wp-content\/uploads\/2019\/04\/image-1.png\" alt=\"\" class=\"wp-image-153\"\/><\/figure>\n\n\n\n<p>\u9854\u3060\u3051\u8a8d\u8b58\u3055\u308c\u305f\u753b\u50cf\u304c\u751f\u6210\u3055\u308c\u307e\u3057\u305f\uff01<\/p>\n\n\n\n<h2> &nbsp; \u4f5c\u3063\u3066\u307f\u305f\u611f\u60f3<\/h2>\n\n\n\n<p>\u691c\u7d22\u3059\u308b\u3068\u6ca2\u5c71\u306e\u60c5\u5831\u304c\u3067\u3066\u304d\u3066\u3001\u6848\u5916\u7c21\u5358\u306b\u3064\u304f\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<br>\n\u5b9f\u969b\u306b\u30bd\u30fc\u30b9\u3092\u66f8\u304f\u90e8\u5206\u3088\u308a\u3001Python\u3084OpenCV\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306a\u3069\u306e\u74b0\u5883\u69cb\u7bc9\u306e\u307b\u3046\u304c\u82e6\u6226\u3057\u305f\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<br>\n\u307f\u306a\u3055\u3093\u3082\u8208\u5473\u304c\u3042\u308c\u3070\u6311\u6226\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p>\u3053\u3053\u304b\u3089\u5207\u308a\u51fa\u3057\u305f\u753b\u50cf\u3092\u4f7f\u3044\u3001\u8ab0\u306e\u9854\u304b\u5224\u5b9a\u3059\u308b\u4ed5\u7d44\u307f\u3092\u4f5c\u3063\u3066\u307f\u305f\u308a\u3057\u307e\u3057\u305f\u304c\u3001\u3053\u306e\u5148\u306e\u8a71\u306f\u307e\u305f\u6b21\u306e\u6a5f\u4f1a\u306b\u66f8\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6280\u8853\u8005\u30d6\u30ed\u30b0\u3068\u984c\u3057\u3066\u793e\u54e1\u304c\u65e5\u3054\u308d\u53d6\u308a\u7d44\u3093\u3067\u3044\u308b\u5b66\u7fd2\u5185\u5bb9\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002\u7b2c1\u56de\u306f\u3001AI\u3092\u30c6\u30fc\u30de\u306b\u3057\u3066\u3044\u308b\u7b2c1\u30e6\u30cb\u30c3\u30c8\u3067\u3059\u3002 \u4eca\u56de\u306e\u30c6\u30fc\u30de \u300e\u753b\u50cf\u306e\u4e2d\u304b\u3089\u9854\u3092\u5224\u5225\u3059\u308b\u300f \u4f7f\u7528\u3059\u308b\u8a00\u8a9e &#8211; Python \u6a5f\u68b0\u5b66\u7fd2\u5411\u3051 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/dandelions.co.jp\/blog\/blog\/2019\/04\/24\/tech-blog-1\/\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u6280\u8853\u8005\u30d6\u30ed\u30b0(1) \u2013 Python\u3068OpenCV\u3067\u9854\u3092\u8a8d\u8b58\u3059\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[8],"tags":[9,11],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paR9rw-2p","_links":{"self":[{"href":"http:\/\/dandelions.co.jp\/blog\/wp-json\/wp\/v2\/posts\/149"}],"collection":[{"href":"http:\/\/dandelions.co.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/dandelions.co.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/dandelions.co.jp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/dandelions.co.jp\/blog\/wp-json\/wp\/v2\/comments?post=149"}],"version-history":[{"count":8,"href":"http:\/\/dandelions.co.jp\/blog\/wp-json\/wp\/v2\/posts\/149\/revisions"}],"predecessor-version":[{"id":166,"href":"http:\/\/dandelions.co.jp\/blog\/wp-json\/wp\/v2\/posts\/149\/revisions\/166"}],"wp:attachment":[{"href":"http:\/\/dandelions.co.jp\/blog\/wp-json\/wp\/v2\/media?parent=149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/dandelions.co.jp\/blog\/wp-json\/wp\/v2\/categories?post=149"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/dandelions.co.jp\/blog\/wp-json\/wp\/v2\/tags?post=149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}