{"id":5913,"date":"2019-03-05T10:32:51","date_gmt":"2019-03-05T01:32:51","guid":{"rendered":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/?p=5913"},"modified":"2021-05-19T11:05:48","modified_gmt":"2021-05-19T02:05:48","slug":"opencv%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%9f%e3%82%a8%e3%83%83%e3%82%b8%e6%a4%9c%e5%87%ba","status":"publish","type":"post","link":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/5913","title":{"rendered":"OpenCV\u3092\u4f7f\u3063\u305f\u30a8\u30c3\u30b8\u691c\u51fa"},"content":{"rendered":"<div class=\"veu_autoEyeCatchBox\"><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"497\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/eagle.jpg\" class=\"attachment-large size-large wp-post-image\" alt=\"\" srcset=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/eagle.jpg 773w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/eagle-300x199.jpg 300w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/eagle-768x509.jpg 768w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/div>\n<div id=\"content\">\n<div id=\"table-of-contents\">\n<h2>Table of Contents<\/h2>\n<div id=\"text-table-of-contents\">\n<ul>\n<li><a href=\"#sec-1\">1. \u30a8\u30c3\u30b8\u691c\u51fa\u3068\u306f<\/a><\/li>\n<li><a href=\"#sec-2\">2. OpenCV\u3092\u4f7f\u3063\u305f\u4f8b<\/a><\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div id=\"outline-container-sec-1\" class=\"outline-2\">\n<h2 id=\"sec-1\"><span class=\"section-number-2\">1<\/span> \u30a8\u30c3\u30b8\u691c\u51fa\u3068\u306f<\/h2>\n<div id=\"text-1\" class=\"outline-text-2\">\n<p>\u753b\u50cf\u51e6\u7406\u306e\u4e00\u7a2e\u3067\u3001 \u753b\u50cf\u5185\u306e\u753b\u7d20\u5024\u306e\u5909\u5316\u304c\u5927\u304d\u3044\u7b87\u6240(\u30a8\u30c3\u30b8)\u3092\u691c\u51fa\u3059\u308b\u51e6\u7406\u3067\u3059\u3002<br \/>\n\u30a8\u30c3\u30b8\u691c\u51fa\u3092\u884c\u3046\u3053\u3068\u3067\u7269\u4f53\u306e\u8f2a\u90ed\u3092\u62bd\u51fa\u3059\u308b\u3053\u3068\u304c\u6765\u307e\u3059\u3002<\/p>\n<p>\u30a8\u30c3\u30b8\u306f\u753b\u7d20\u5024\u306b\u5bfe\u3059\u308b\u5fae\u5206\u3067\u5224\u65ad\u3057\u307e\u3059\u3002<br \/>\n\u305f\u3060\u3057\u3001\u753b\u7d20\u5024\u306f\u96e2\u6563\u7684\u3067\u3042\u308b\u305f\u3081\u901a\u5e38\u306e\u9023\u7d9a\u95a2\u6570\u306b\u5bfe\u3059\u308b\u5fae\u5206\u3067\u306f\u306a\u304f\u3001 \u96a3\u63a5\u753b\u7d20\u306e\u5dee\u5206\u3092\u3068\u308b\u3053\u3068\u3067\u8fd1\u4f3c\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u3088\u3046\u306a\u8a08\u7b97\u306b\u306f\u30d5\u30a3\u30eb\u30bf\u3092\u7528\u3044\u305f\u7573\u307f\u8fbc\u307f\u6f14\u7b97\u304c\u4f7f\u308f\u308c\u307e\u3059\u3002<br \/>\n\u30d5\u30a3\u30eb\u30bf\u3084\u7573\u307f\u8fbc\u307f\u6f14\u7b97\u306b\u3064\u3044\u3066\u306f\u3001<a href=\"https:\/\/www.clg.niigata-u.ac.jp\/~medimg\/practice_medical_imaging\/imgproc_scion\/4filter\/index.htm\" target=\"blank\" rel=\"noopener noreferrer\">\u3053\u3053<\/a> \u3084 <a href=\"http:\/\/ipr20.cs.ehime-u.ac.jp\/column\/gazo_syori\/chapter5.html\" target=\"blank\" rel=\"noopener noreferrer\">\u3053\u3053<\/a> \u304c\u53c2\u8003\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u8208\u5473\u306e\u3042\u308b\u65b9\u306f\u53c2\u7167\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u30d5\u30a3\u30eb\u30bf\u306e\u4e00\u4f8b\u3068\u3057\u3066\u4ee5\u4e0b\u306b\u793a\u3059Sobel\u30d5\u30a3\u30eb\u30bf\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<div class=\"figure\">\n<div id=\"attachment_5915\" style=\"width: 247px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5915\" class=\"wp-image-5915 size-full\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/sobel_x.png\" alt=\"\" width=\"237\" height=\"118\" \/><p id=\"caption-attachment-5915\" class=\"wp-caption-text\">Figure 1: \u6c34\u5e73\u65b9\u5411\u306e\u30d5\u30a3\u30eb\u30bf<\/p><\/div>\n<div id=\"attachment_5916\" style=\"width: 289px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5916\" class=\"wp-image-5916 size-full\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/sobel_y.png\" alt=\"\" width=\"279\" height=\"118\" \/><p id=\"caption-attachment-5916\" class=\"wp-caption-text\">Figure 2: \u5782\u76f4\u65b9\u5411\u306e\u30d5\u30a3\u30eb\u30bf<\/p><\/div>\n<\/div>\n<div class=\"figure\"><\/div>\n<p>\u6c34\u5e73\u65b9\u5411\u306e\u30d5\u30a3\u30eb\u30bf\u3092\u753b\u50cf\u306b\u9069\u7528\u3059\u308b\u3068\u3001\u753b\u7d20\u5024\u304c\u6a2a\u65b9\u5411\u306b\u5e73\u5766\u306a\u90e8\u5206\u304c\u30de\u30b9\u30af\u3055\u308c\u308b\u305f\u3081\u7e26\u65b9\u5411\u306e\u30a8\u30c3\u30b8\u304c\u691c\u51fa\u3067\u304d\u307e\u3059\u3002<br \/>\n\u540c\u69d8\u306b\u5782\u76f4\u65b9\u5411\u306e\u30d5\u30a3\u30eb\u30bf\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u3067\u6a2a\u65b9\u5411\u306e\u30a8\u30c3\u30b8\u304c\u691c\u51fa\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<div id=\"outline-container-sec-2\" class=\"outline-2\">\n<h2 id=\"sec-2\"><span class=\"section-number-2\">2<\/span> OpenCV\u3092\u4f7f\u3063\u305f\u4f8b<\/h2>\n<div id=\"text-2\" class=\"outline-text-2\">\n<p>OpenCV\u3067\u306f\u30a8\u30c3\u30b8\u691c\u51fa\u306e\u305f\u3081\u306e\u3044\u304f\u3064\u304b\u306e\u30d5\u30a3\u30eb\u30bf\u304c\u63d0\u4f9b\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u3067\u306f\u3001\u4e0a\u3067\u793a\u3057\u305fSobel\u30d5\u30a3\u30eb\u30bf\u3092\u4f7f\u3063\u305f\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"example\">import cv2\r\nimport numpy as np\r\n\r\nimg = cv2.imread('eagle.jpg')\r\nimg_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\r\n\r\ndx = cv2.Sobel(img_gray, cv2.CV_64F, 1, 0, ksize=3)\r\ndy = cv2.Sobel(img_gray, cv2.CV_64F, 0, 1, ksize=3)\r\ngrad = np.sqrt(dx ** 2 + dy ** 2)\r\n\r\ncv2.imwrite('.\/gray.jpg', img_gray)\r\ncv2.imwrite('.\/dx.jpg', dx)\r\ncv2.imwrite('.\/dy.jpg', dy)\r\ncv2.imwrite('.\/grad.jpg', grad)\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u30d5\u30a3\u30eb\u30bf\u3092\u9069\u7528\u3057\u305f\u753b\u50cf\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\nFigure 4, Figure 5\u3067\u306f\u3001\u305d\u308c\u305e\u308c\u7e26\u65b9\u5411\u3001\u6a2a\u65b9\u5411\u306e\u30a8\u30c3\u30b8\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<div class=\"figure\">\n<div id=\"attachment_5918\" style=\"width: 783px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5918\" class=\"wp-image-5918 size-full\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/gray.jpg\" alt=\"\" width=\"773\" height=\"512\" srcset=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/gray.jpg 773w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/gray-300x199.jpg 300w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/gray-768x509.jpg 768w\" sizes=\"auto, (max-width: 773px) 100vw, 773px\" \/><p id=\"caption-attachment-5918\" class=\"wp-caption-text\">Figure 3: \u5143\u753b\u50cf(\u30b0\u30ec\u30fc\u30b9\u30b1\u30fc\u30eb)<\/p><\/div>\n<\/div>\n<div class=\"figure\">\n<div id=\"attachment_5919\" style=\"width: 783px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5919\" class=\"wp-image-5919 size-full\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/dx.jpg\" alt=\"\" width=\"773\" height=\"512\" srcset=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/dx.jpg 773w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/dx-300x199.jpg 300w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/dx-768x509.jpg 768w\" sizes=\"auto, (max-width: 773px) 100vw, 773px\" \/><p id=\"caption-attachment-5919\" class=\"wp-caption-text\">Figure 4: \u6c34\u5e73\u65b9\u5411\u306e\u30d5\u30a3\u30eb\u30bf\u9069\u7528<\/p><\/div>\n<div id=\"attachment_5920\" style=\"width: 783px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5920\" class=\"wp-image-5920 size-full\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/dy.jpg\" alt=\"\" width=\"773\" height=\"512\" srcset=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/dy.jpg 773w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/dy-300x199.jpg 300w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/dy-768x509.jpg 768w\" sizes=\"auto, (max-width: 773px) 100vw, 773px\" \/><p id=\"caption-attachment-5920\" class=\"wp-caption-text\">Figure 5: \u5782\u76f4\u65b9\u5411\u306e\u30d5\u30a3\u30eb\u30bf\u9069\u7528<\/p><\/div>\n<\/div>\n<div class=\"figure\">\n<div id=\"attachment_5921\" style=\"width: 783px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5921\" class=\"wp-image-5921 size-full\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/grad.jpg\" alt=\"\" width=\"773\" height=\"512\" srcset=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/grad.jpg 773w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/grad-300x199.jpg 300w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/grad-768x509.jpg 768w\" sizes=\"auto, (max-width: 773px) 100vw, 773px\" \/><p id=\"caption-attachment-5921\" class=\"wp-caption-text\">Figure 6: \u6c34\u5e73\u5782\u76f4\u4e21\u65b9\u306e\u30d5\u30a3\u30eb\u30bf\u3092\u9069\u7528<\/p><\/div>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<hr \/>\n<p>\u25c6WEB\u4f1a\u8b70\uff0f\u30bb\u30df\u30ca\u30fc\u30b7\u30b9\u30c6\u30e0\u300eSzia\u300f<br \/>\n<a href=\"https:\/\/www.ois-yokohama.co.jp\/szia\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/www.ois-yokohama.co.jp\/szia\/<\/a><\/p>\n<p>\u25c6\u30b5\u30fc\u30d0\u30b5\u30a4\u30c9\u3067\u52d5\u4f5c\u3059\u308b\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u300eReDois\u300f<br \/>\n<a href=\"https:\/\/www.ois-yokohama.co.jp\/redois\/wp_redois\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/www.ois-yokohama.co.jp\/redois\/wp_redois\/<\/a><\/p>\n<p><a href=\"https:\/\/www.ois-yokohama.co.jp\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6056\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/06\/ois_logo-300x137.jpg\" alt=\"\u30aa\u30ea\u30a8\u30f3\u30bf\u30eb\u30a4\u30f3\u30d5\u30a9\u30fc\u30e1\u30a4\u30b7\u30e7\u30f3\u30b5\u30fc\u30d3\u30b9\uff08OIS\uff09\" width=\"300\" height=\"137\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Table of Contents 1. \u30a8\u30c3\u30b8\u691c\u51fa\u3068\u306f 2. OpenCV\u3092\u4f7f\u3063\u305f\u4f8b 1 \u30a8\u30c3\u30b8\u691c\u51fa\u3068\u306f \u753b\u50cf\u51e6\u7406\u306e\u4e00\u7a2e\u3067\u3001 \u753b\u50cf\u5185\u306e\u753b\u7d20\u5024\u306e\u5909\u5316\u304c\u5927\u304d\u3044\u7b87\u6240(\u30a8\u30c3\u30b8)\u3092\u691c\u51fa\u3059\u308b\u51e6\u7406\u3067\u3059\u3002 \u30a8\u30c3\u30b8\u691c\u51fa\u3092\u884c\u3046\u3053\u3068\u3067\u7269\u4f53\u306e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5924,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"vkexunit_cta_each_option":"","footnotes":""},"categories":[67,13,6],"tags":[297,673],"class_list":["post-5913","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-67","category-13","category-engineer","tag-opencv","tag-673"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts\/5913","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/comments?post=5913"}],"version-history":[{"count":7,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts\/5913\/revisions"}],"predecessor-version":[{"id":7158,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts\/5913\/revisions\/7158"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/media\/5924"}],"wp:attachment":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/media?parent=5913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/categories?post=5913"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/tags?post=5913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}