2
$\begingroup$

I am trying to align my device and markers automatically using positioners driven by Mathematica. The camera feed looks like this:

enter image description here

The device is the black square with gold electrodes. The markers are a series of concentric squares broke in the middle of each edge. I need to know (1) the displacement from the center of the device to the center of the markers, and (2) the angular difference between the device and the markers.

The naive ImageLines could give me some results, but it's not robust enough. Sometimes it sees lines everywhere on the image.

img = Import["https://i.imgur.com/YODXeXT.jpg"];
simg = ImageTake[img, {69, 780}, {715, 1408}]~ImageResize~Scaled[.7];
{h, s, b} = ColorSeparate[simg, "HSB"];
HighlightImage[b, {Orange, ImageLines[b // EdgeDetect]}]

The geometry and color of the device & markers will always be the same. Can I make use of that fact to write a more robust algorithm to get the parameters I need from the image? And can I get rid of the hand-written coordinates for ImageTake on the second line?

$\endgroup$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.