How do I translate pixel coordinates to real world coordinates using a calibration target?

24 Ansichten (letzte 30 Tage)
I have a 2xN array of pixel coordinates = A that correspond to the dots on a dotted calibration target (a sheet with dots on it that are a known distance apart).
I have a 2xN array of real-world-unit coordinates = B which contains the positions of the dots on the target.
How do I find a way to smoothly translate any coordinate that falls into the area of the points contained in A onto B, so that I can find a given point in real space for any point on the target, not just the points where the dots are?
A linear translation is not possible as the image contains distortions. I have tried functions like estimateCameraParameters and estimateCameraMatrix, but these apparently either require multiple images or non-coplanar points, both of which I do not have.

Antworten (1)

Image Analyst
Image Analyst am 18 Nov. 2021
I think you can use scatteredInterpolant. Given a list of (xp, yp) pixel coordinates, and another separate list of real world (xr, yr) coordinates, you can essentially build a surface with scatteredInterpolant. So once you have that you can simply input the pixel coordinates and out pops the real world coordinates. Attached is a demo of scatteredInterpolant. I'm sure you can easily modify it, but the key is you need to know the real world coordinates for a certain set of image/pixel coordinates, but you said you know those.
  6 Kommentare
Image Analyst
Image Analyst am 18 Nov. 2021
Bearbeitet: Image Analyst am 18 Nov. 2021
This looks like it should be a perfect linear scaling:
s = load('export.mat')
TargetDots = s.TargetDots;
TargetDotsReal = s.TargetDotsReal;
% Show input
subplot(2, 1, 1);
scatter(TargetDots(:, 1), TargetDots(:, 2), 10, 'b', 'filled');
title('Target Dots')
subplot(2, 1, 2);
scatter(TargetDotsReal(:, 1), TargetDotsReal(:, 2), 10, 'r', 'filled');
title('Target Dots Real')
Why can't you simply do
estimatedY = 1 + 9 * (yTest - min(y)) / (max(y) - min(y));
estimatedX = 1 + 9 * (xTest - min(x)) / (max(x) - min(x));
???
_NB_
_NB_ am 19 Nov. 2021
I cannot do a linear interpolation because for other images there may be more distortion, which could be along the X-axis, Y-Axis or random in nature.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by