Ask Your Question
1

Detect replicating pattern in grid images

asked 2018-01-12 02:58:32 -0600

NikhilHanda gravatar image

updated 2018-01-12 11:56:03 -0600

LBerger gravatar image

i want to detect replicated images with in a grid image and extract the base pattern image.

C:\fakepath\gridcropped2.jpg

edit retag flag offensive close merge delete

Comments

please show us, what you've tried, so far !

berak gravatar imageberak ( 2018-01-12 04:00:11 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
1

answered 2018-01-12 07:01:45 -0600

berak gravatar 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);

image description

from there on, find the contours of the clusters, get their centers(moments), and you're done !

edit flag offensive delete link more

Comments

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?

StevenPuttemans gravatar imageStevenPuttemans ( 2018-01-12 08:13:36 -0600 )edit
1

^^ minMaxLoc on dft was my 1st idea, too, but no nice results.

berak gravatar imageberak ( 2018-01-12 09:50:16 -0600 )edit
-1

answered 2018-01-12 03:16:59 -0600

Ziri gravatar image

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.

edit flag offensive delete link more

Comments

2

mind explaining, how that would help, to find spatial repetition ?

berak gravatar imageberak ( 2018-01-12 04:37:52 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-01-12 02:31:21 -0600

Seen: 692 times

Last updated: Jan 12 '18