{"id":1158,"date":"2010-02-27T18:14:35","date_gmt":"2010-02-28T02:14:35","guid":{"rendered":"https:\/\/mathpirate.net\/log\/?p=1158"},"modified":"2010-02-27T18:14:35","modified_gmt":"2010-02-28T02:14:35","slug":"bomb-detection","status":"publish","type":"post","link":"https:\/\/mathpirate.net\/log\/2010\/02\/27\/bomb-detection\/","title":{"rendered":"Bomb Detection"},"content":{"rendered":"<p>I finally made some headway into detecting the bombs.<\/p>\n<p><a href=\"https:\/\/mathpirate.net\/log\/wp-content\/uploads\/2010\/02\/BombDetectorV1.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-1159\" title=\"BombDetectorV1\" src=\"https:\/\/mathpirate.net\/log\/wp-content\/uploads\/2010\/02\/BombDetectorV1-300x238.jpg\" alt=\"\" width=\"300\" height=\"238\" srcset=\"https:\/\/mathpirate.net\/log\/wp-content\/uploads\/2010\/02\/BombDetectorV1-300x238.jpg 300w, https:\/\/mathpirate.net\/log\/wp-content\/uploads\/2010\/02\/BombDetectorV1.jpg 654w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>It missed one, though&#8230;<\/p>\n<p>As I noted, you call cvMatchTemplate to find likely matches within a larger image, then you call cvMinMaxLoc to get the location of the best match.\u00c2\u00a0 But only the best match.\u00c2\u00a0 What about the other matches?\u00c2\u00a0 How do you find them?<\/p>\n<p>Well, the method I used to get the points above is a fairly simple, but fairly dumb way of doing it.\u00c2\u00a0 You get the first point from cvMinMaxLoc, then you blot it out\u00c2\u00a0 with a filled circle and repeat.\u00c2\u00a0 Your initial point, and points around it are now no longer considered matches, so you get the second best match, and so on.\u00c2\u00a0 Trouble is, it&#8217;s a bit slow.\u00c2\u00a0 You&#8217;re constantly rescanning the entire image for the best match.\u00c2\u00a0 My friend Susan had a suggestion, where you scan strips of the image instead.\u00c2\u00a0 Because you know that there can only be one bomb for any given row, you can partition the screen into strips roughly the height of a bomb and know that there&#8217;s only one point in each strip that you&#8217;ll care about.\u00c2\u00a0 I&#8217;m going to try that one out and see how it does.<\/p>\n<p>By the way, there are so many false circles in the image above because I&#8217;m not throwing away matches below a certain threshold.\u00c2\u00a0 Obviously, I&#8217;ll have to do that if I want anything useful.\u00c2\u00a0 It looks like .2 might be a good cutoff.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I finally made some headway into detecting the bombs. It missed one, though&#8230; As I noted, you call cvMatchTemplate to find likely matches within a larger image, then you call cvMinMaxLoc to get the location of the best match.\u00c2\u00a0 But only the best match.\u00c2\u00a0 What about the other matches?\u00c2\u00a0 How do you find them? Well, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[125],"tags":[17,15,77,19],"_links":{"self":[{"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/posts\/1158"}],"collection":[{"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/comments?post=1158"}],"version-history":[{"count":1,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/posts\/1158\/revisions"}],"predecessor-version":[{"id":1160,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/posts\/1158\/revisions\/1160"}],"wp:attachment":[{"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/media?parent=1158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/categories?post=1158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/tags?post=1158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}