Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Edge based alignment

Hi everyone,

I'm currently working on a project were I need to detect a marker in an image with Python&OpenCV and I can't seem to get the detection right. The marker is used for aligning a substrate in our writing machine. I'm new to computer vision so I hope that someone here can push me in the right direction.

This is a (raw) camera image with the marker: https://imgur.com/lCATqHK

The problem is that feature matching and template matching don't work well with these kinds of markers. (As far as I know/tested)

Marker properties:

  • For good alignment the position of the anchor point/center point needs to be accurate. (1/10th to 1/20th of a pixel)
  • The edges of the marker can erode so the detection still needs to work for small changes in the edge.
  • Scale is constant
  • Rotation can vary ±10°, accuracy should be <0.06° so that the pixels in the marker don't shift more than 0.5 pixel
  • Brightness/Contrast can vary
  • Preferably the marker should be located within a second.

What I tried so far:

  • I tried template matching with bicubic interpolation to get subpixel accuracy: https://imgur.com/0Qm9846
    I compared the results with Cognex and from my tests the difference was max 1/8th and on average 1/20th of a pixel. The problem with TM is that it doesn't work well with rotated markers. Even when I rotate the template the matching is very poor and I get a lot of wrong matches.
  • Feature matching doesn't work with the markers because the markers don't have strong, unique features so between images it won't find the same features.

TM and FM both seem to not work well for my application. So another option is to go for edge detection like in the Cognex software: Edge trained image: https://imgur.com/OkO4A71 Zoomed in: https://imgur.com/PELw4Bo

The problem with this is that I don't know how to reliably find the same edges like in these two images. One edge detection tool I tried was Canny but that produces unreliable results and double edges depending on the parameters. As long as I can find the edges within a pixel accuracy I think I should be able to do the rest. (image gradient, homography, sub pixel anchor point)

Edge based alignment

Hi everyone,

I'm currently working on a project were I need to detect a marker in an image with Python&OpenCV and I can't seem to get the detection right. The marker is used for aligning a substrate in our writing machine. I'm new to computer vision so I hope that someone here can push me in the right direction.

This is a (raw) camera image with the marker: https://imgur.com/lCATqHK

The problem is that feature matching and template matching don't work well with these kinds of markers. (As far as I know/tested)

Marker properties:

  • For good alignment the position of the anchor point/center point needs to be accurate. (1/10th to 1/20th of a pixel)
  • The edges of the marker can erode so the detection still needs to work for small changes in the edge.
  • Scale is constant
  • Rotation can vary ±10°, accuracy should be <0.06° so that the pixels in the marker don't shift more than 0.5 pixel
  • Brightness/Contrast can vary
  • Preferably the marker should be located within a second.

What I tried so far:

  • I tried template matching with bicubic interpolation to get subpixel accuracy: https://imgur.com/0Qm9846
    I compared the results with Cognex and from my tests the difference was max 1/8th and on average 1/20th of a pixel. The problem with TM is that it doesn't work well with rotated markers. Even when I rotate the template the matching is very poor and I get a lot of wrong matches.
  • Feature matching doesn't work with the markers because the markers don't have strong, unique features so between images it won't find the same features.

TM and FM both seem to not work well for my application. So another option is to go for edge detection like in the Cognex software: Edge trained image: https://imgur.com/OkO4A71 Zoomed in: https://imgur.com/PELw4Bo

The problem with this is that I don't know how to reliably find the same edges like in these two images. One edge detection tool I tried was Canny but that produces unreliable results and double edges depending on the parameters. As long as I can find the edges within a pixel accuracy I think I should be able to do the rest. (image gradient, homography, sub pixel anchor point)

Tl;dr: I want to locate the marker as accurately as possible but I can't find a way to do this reliably.

Edge based alignment

Hi everyone,

I'm currently working on a project were I need to detect a marker in an image with Python&OpenCV and I can't seem to get the detection right. The marker is used for aligning a substrate in our writing machine. I'm new to computer vision so I hope that someone here can push me in the right direction.

This is a (raw) camera image with the marker: https://imgur.com/lCATqHK

The problem is that feature matching and template matching don't work well with these kinds of markers. (As far as I know/tested)

Marker properties:

  • For good alignment the position of the anchor point/center point needs to be accurate. (1/10th to 1/20th of a pixel)
  • The edges of the marker can erode so the detection still needs to work for small changes in the edge.
  • Scale is constant
  • Rotation can vary ±10°, accuracy should be <0.06° so that the pixels in the marker don't shift more than 0.5 pixel
  • Brightness/Contrast can vary
  • Preferably the marker should be located within a second.

What I tried so far:

  • I tried template matching with bicubic interpolation to get subpixel accuracy: https://imgur.com/0Qm9846
    I compared the results with Cognex and from my tests the difference was max 1/8th and on average 1/20th of a pixel. The problem with TM is that it doesn't work well with rotated markers. Even when I rotate the template the matching is very poor and I get a lot of wrong matches.
  • Feature matching doesn't work with the markers because the markers don't have strong, unique features so between images it won't find the same features.

TM and FM both seem to not work well for my application. So another option is to go for edge detection like in the Cognex software: Edge trained image: https://imgur.com/OkO4A71 Zoomed in: https://imgur.com/PELw4Bo

The problem with this is that I don't know how to reliably find the same edges like in these two images. One edge detection tool I tried was Canny but that produces unreliable results and double edges depending on the parameters. As long as I can find the edges within a pixel accuracy I think I should be able to do the rest. (image gradient, homography, sub pixel anchor point)

Tl;dr: I want to locate the marker edges as accurately as possible but I can't find a way to do this reliably.