{"id":566,"date":"2016-07-25T07:23:45","date_gmt":"2016-07-25T05:23:45","guid":{"rendered":"https:\/\/www.kurokesu.com\/main\/?p=566"},"modified":"2016-09-01T20:36:48","modified_gmt":"2016-09-01T18:36:48","slug":"advanced-opencv-3-python-hole-detection","status":"publish","type":"post","link":"https:\/\/www.kurokesu.com\/main\/2016\/07\/25\/advanced-opencv-3-python-hole-detection\/","title":{"rendered":"Advanced OpenCV 3 python hole detection"},"content":{"rendered":"<p style=\"text-align: justify;\"><a href=\"https:\/\/www.kurokesu.com\/main\/wp-content\/uploads\/2016\/07\/centers.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-569 size-medium\" src=\"https:\/\/www.kurokesu.com\/main\/wp-content\/uploads\/2016\/07\/centers-300x169.png\" alt=\"centers\" width=\"300\" height=\"169\" srcset=\"https:\/\/www.kurokesu.com\/main\/wp-content\/uploads\/2016\/07\/centers-300x169.png 300w, https:\/\/www.kurokesu.com\/main\/wp-content\/uploads\/2016\/07\/centers-768x432.png 768w, https:\/\/www.kurokesu.com\/main\/wp-content\/uploads\/2016\/07\/centers-1024x576.png 1024w, https:\/\/www.kurokesu.com\/main\/wp-content\/uploads\/2016\/07\/centers.png 1903w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><a href=\"http:\/\/opencv.org\/\">OpenCV<\/a> is a well known computer vision library used as base framework used by major companies like Google, IBM, Sony and numerous others. It enables quick vision based tool development and results can be seen in a minutes after starting to code. This time I will show how to find round blobs (for example fiducial marks or holes on PCB). There are many ways to accomplish this task, but many of them don&#8217;t produce stable results. After many hours of research I stumbled on<strong> SimpleBlobDetector<\/strong>.<\/p>\n<p style=\"text-align: justify;\">For this experiment I will be using standard <strong>Python 2.7<\/strong> installation and <strong>OpenCV 3.1<\/strong> library. OpenCV can be installed numerous ways, for Windows feel free to install from official OpenCV page (<a href=\"http:\/\/docs.opencv.org\/2.4\/doc\/tutorials\/introduction\/windows_install\/windows_install.html\">requires more steps to get started<\/a>) or download from <a href=\"http:\/\/www.lfd.uci.edu\/~gohlke\/pythonlibs\/\">Unofficial Windows Binaries for Python Extension Packages<\/a> and install with command like this:<\/p>\n<pre style=\"text-align: justify;\">pip install opencv_python-3.1.0-cp27-cp27m-win32.whl<\/pre>\n<div id=\"attachment_576\" style=\"width: 510px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.kurokesu.com\/main\/wp-content\/uploads\/2016\/07\/out.gif\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-576\" class=\"wp-image-576 size-full\" src=\"https:\/\/www.kurokesu.com\/main\/wp-content\/uploads\/2016\/07\/out.gif\" alt=\"out\" width=\"500\" height=\"281\" \/><\/a><p id=\"caption-attachment-576\" class=\"wp-caption-text\">Detection results<\/p><\/div>\n<p style=\"text-align: justify;\">Script is provided below and hosted on Github. To start experimenting supply video file and adjust parameters if needed. Code is pretty simple and requires no more explanation (hopefully).<\/p>\n<p><script src=\"https:\/\/gist.github.com\/Lukse\/937b3eab8c4547a65c778324764b28e1.js\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>OpenCV is a well known computer vision library used as base framework used by major companies like Google, IBM, Sony and numerous others. It enables quick vision based tool development and results can be seen in a minutes after starting to code. This time I will show how to find round blobs (for example fiducial [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":569,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[157,153],"tags":[24,64,14],"class_list":["post-566","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-how-to","category-projects","tag-computer-vision","tag-opencv","tag-usb-camera"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.kurokesu.com\/main\/wp-content\/uploads\/2016\/07\/centers.png","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6VSmB-98","_links":{"self":[{"href":"https:\/\/www.kurokesu.com\/main\/wp-json\/wp\/v2\/posts\/566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kurokesu.com\/main\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kurokesu.com\/main\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kurokesu.com\/main\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kurokesu.com\/main\/wp-json\/wp\/v2\/comments?post=566"}],"version-history":[{"count":12,"href":"https:\/\/www.kurokesu.com\/main\/wp-json\/wp\/v2\/posts\/566\/revisions"}],"predecessor-version":[{"id":2875,"href":"https:\/\/www.kurokesu.com\/main\/wp-json\/wp\/v2\/posts\/566\/revisions\/2875"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kurokesu.com\/main\/wp-json\/wp\/v2\/media\/569"}],"wp:attachment":[{"href":"https:\/\/www.kurokesu.com\/main\/wp-json\/wp\/v2\/media?parent=566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kurokesu.com\/main\/wp-json\/wp\/v2\/categories?post=566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kurokesu.com\/main\/wp-json\/wp\/v2\/tags?post=566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}