1 | initial version |
you could use simple template matching for this.
(choose a roi fairly smaller than the expected pattern (to avoid possible overlapping)):
Mat m = imread("repl2.jpg", 0);
Mat roi(m, Rect(0,0,20,20));
Mat res;
matchTemplate(m, roi, res, TM_CCORR_NORMED);
threshold(res,res,0.95,255,0);
res.convertTo(res,CV_8U);
from there on, find the contours of the clusters, get their centers(moments), and you're done !