Detect replicating pattern in grid images
i want to detect replicated images with in a grid image and extract the base pattern image.
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 !
But as far as I see this will only work when you know your pattern right, or at least have a guess at the pattern size? I am wondering if some fourier frequency domain analysis could also retrieve this information?
Convert your image to HSV or HSL and do simple color thresholding in all 3 channels. If itdoesn't work then segment using K-means or another method.
Asked: 2018-01-12 02:31:21 -0600
Seen: 753 times
Last updated: Jan 12 '18
please show us, what you've tried, so far !