Ask Your Question
0

Finding subpixel position of fiducial shapes (Plus, Dot, Square)

asked 2019-05-13 13:28:30 -0600

rvdbijl gravatar image

updated 2019-05-15 06:27:34 -0600

Hi All,

New to OpenCV - Actually, so new that I haven't tried to run it .. yet. But wanted to figure out if I can use OpenCV for this before going down the wrong path.

I have a grayscale image, about 2000x1500 pixels, with a small shape (about 200x200 pixels) somewhere in the image. The shape is either a square, dot or plus. The trickiness is that the shape is "fuzzy" (out of focus) and contrast is low. I cannot get a better image of the shape, so crisp edges are definitely out.

What I need is an algorithm that (as quickly as possible) detects the center position of this fiducial shape and reports that back to my code. My preference is C++.

Any thoughts on whether this can (simply / easily) be done with OpenCV, and if so, how?

Thanks!

-- Edit:

I could not post a reply yet, so here's some more details: We're currently using Sherlock by Dalsa for this process, and need to move to Realtime on C++, hence the need to evaluate OpenCV. When looking through documentation and tutorials, it wasn't abundantly clear that OpenCV had simple functionality to detect shapes like I mentioned and give me subpixel coordinates of its center. All I was able to find were correlation-based algorithms and complex face-recognition stuff. Neither one would be applicable... Based on eshirima's suggestions, it looks like it will be doable though. I'll look into those more.

I'll try to add examples later today or tomorrow so you guys can weigh in if the contrast ratio would present a problem.

And to clarify -- no, I am not looking for others to do the work. Just trying to evaluate if I should consider OpenCV or not.

Thanks!

edit retag flag offensive close merge delete

Comments

2

Have you tried this, this or this?

PS:If you truly expect help, you need to show some proof of work. As it stands, your question might be seen as you wanting someone else to do your work. Regardless of whether you're new, you should try something beforehand.

eshirima gravatar imageeshirima ( 2019-05-13 15:36:09 -0600 )edit
1

Please include some (a lot) of sample images. GitHub or Google Drive can store the images for you.

sjhalayka gravatar imagesjhalayka ( 2019-05-13 21:28:59 -0600 )edit
1

Yes, please share some sample images with us. Hard to suggest anything without seeing what there is to work with.

Chris gravatar imageChris ( 2019-05-15 05:29:55 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2019-05-15 11:50:13 -0600

updated 2019-11-09 02:00:00 -0600

You can use OpenCV contour processing to achieve the result. You may need to do the following on the input image.

  • Smooth image to remove the noise
  • Threshold the image to process contour
  • FindContours to get all contour
  • Get moment and Centroid of the contour
  • Calculate centre using moment.

This Blog post explain how the above can achieve.

Here is the result got for the image above

image description

image description

image description

Reference: https://scode7.blogspot.com/2019/05/o...

edit flag offensive delete link more

Comments

Awesome. I'll give that a try in the next few weeks. Here are a couple of sample images:

Image 1

Image 2

Image 3

rvdbijl gravatar imagervdbijl ( 2019-05-17 07:47:38 -0600 )edit

Looks like it's a bit off. I'm hoping that maybe some (dynamic) thresholding can help with the smudges to the right side of the shape, and pull the center closer to the actual center. Unfortunately it's a complicated optical path to the camera and this is about the best I can hope for. Thanks for running it through. Now at least I know it'll be worth the effort trying this with OpenCV.

rvdbijl gravatar imagervdbijl ( 2019-05-17 10:25:00 -0600 )edit

May be doing Erosion operation just before threshold improve the result https://docs.opencv.org/2.4/doc/tutor...

SCodeZ gravatar imageSCodeZ ( 2019-05-17 11:34:39 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2019-05-13 13:28:30 -0600

Seen: 1,074 times

Last updated: Nov 09 '19