How to find X and O using Image Processing toolbox?
Show older comments

Dear All,
here is my problem: I have an image with X and O (of different colors) and I need to determine the position of such objects. Precisely, I want to obtain the centers of the circles and the ones of the crosses.
So far, I was able to do it for the circles using imfindcircles. Any idea? I should mention that each object has fixed dimension.
Best, Michele
Accepted Answer
More Answers (1)
yonatan gerufi
on 11 Nov 2014
Edited: yonatan gerufi
on 11 Nov 2014
0 votes
if the X and O have fixed dimension and shape, is to build a mask for X and mask for O, and run it on the picture.
2 Comments
Michele Berra
on 11 Nov 2014
yonatan gerufi
on 11 Nov 2014
Edited: yonatan gerufi
on 11 Nov 2014
first you should do your picture to binary one using "im2bw". (make sure you pick a threshold that doesn't turn X & O to zeros)
crop small rectangle around the X, and one around O. those are your masks.
now, you should run all over the picture, and sum the matrix results from multiplying the mask with the current part of the picture (a.k.a 2D convolution) this will give you a value, that will be high if the picture and mask are correlated, and you have an X or O pattern.
hopefully it is understandable. regards.
Categories
Find more on Image Segmentation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!