Detect black dots from color background

前端 未结 3 808
攒了一身酷
攒了一身酷 2021-02-01 23:04

My short question

How to detect the black dots in the following images? (I paste only one test image to make the question look compact. More images can be found →here←

3条回答
  •  生来不讨喜
    2021-02-01 23:24

    I was curios to test with my old 2d peak finder code on the images without any threshold or any color considerations, really crude don't you think?

    im0=imread('Snap10.jpg');
    im=(abs(255-im0));
    d=rgb2gray(im);
    filter=fspecial('gaussian',16,3.5);
    p=FastPeakFind(d,0,filter);
    imagesc(im0); hold on
    plot(p(1:2:end),p(2:2:end),'r.')
    

    enter image description here

    The code I'm using is a simple 2D local maxima finder, there are some false positives, but all in all this captures most of the points with no duplication. The filter I was using was a 2d gaussian of width and std similar to a typical blob (the best would have been to get a matched filter for your problem). A more sophisticated version that does treat the colors (rgb2hsv?) could improve this further...

提交回复
热议问题