How can i get x,y points of squares center ?
6 views (last 30 days)
Show older comments
In this picture
we have 4 squares. I need 4 x and 4 y points(coordinates) of each square center. Can somebody do it? Because I'm a beginner ...
5 Comments
Adam Danz
on 13 Jul 2018
Replies to your points...
(3) I understand they are (x,y) coordinates but where is the origin? Where is (0,0)? For example, the coordinate (5,12) is 5 pixels to the right of x=0 and 12 pixels above y=0. In your example, (192, 90) these are also distances from (0,0) but I don't know where (0,0) is in your image.
(4) feel free to follow up with more specific questions but I think the problem is not well defined and that will make it difficult to find a solution.
Accepted Answer
Image Analyst
on 14 Jul 2018
Edited: Image Analyst
on 14 Jul 2018
First of all, use a better exposure. Having a brighter image will give you more contrast and less noise. Then you can just use a bottomhat filter, imbothat() to find the locally dark things. Then use bwareafilt() to extract the 4 largest dark things. Then use regionprops to get their centers and average them. Try the attached script. It makes this:
I'm going out for a bit. See if you can finish that while I'm gone. And let me know how it goes and if you're able to start with a properly lit image.
2 Comments
Image Analyst
on 15 Jul 2018
See the camera calibration capabilities in the Computer Vision System Toolbox. https://www.mathworks.com/products/computer-vision/features.html#camera-calibration
They're rather extensive and well thought out so it's nothing I can replicate in one or two hundred lines of code.
If I answered your question(s), can you "Accept this answer"? Thanks.
More Answers (0)
See Also
Categories
Find more on Geometric Transformation and Image Registration in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!