필터 지우기
필터 지우기

Reconstruct dewarped image given a few pixel position in real-world coordinate

조회 수: 3 (최근 30일)
I have four images of a calibration plate. Each image shows a different vertical section of the plate. the images are upside down, showing a water level near the bottom of the frame. The images overlap. For each frame, I know the intrinsic coordinates (I, in the code) of the dots and their positions in the real world (W, in the code). imagePoints2 is just a check that the transformation is correct. I'm trying to dewarp the entire image based on the knowledge of the intrisic coordinate of the warped image and the real world coordinate of the true (dewarped) image. The ideal output is a dewarped image that preserves as much resolution as posible. Here's some code and data to visualize the images and dots:
%% Check calibration is porperly aligned
colors = {'r', 'b', 'g', 'k'};
cams = 'ACBD'; %order of cameras from left to right in experiment
figure(1)
for cam = 1:4
scatter(imagePoints2{cam}(:,1),imagePoints2{cam}(:,2),'o','MarkerEdgeColor', colors{cam}, 'LineWidth', 1); hold on
scatter(W{cam}(:,1),W{cam}(:,2),'+','MarkerEdgeColor', colors{cam}, 'LineWidth', 1); hold on
xlabel("x (m)")
ylabel("z (m)")
end
Undefined variable 'imagePoints2'.
hold off
figure(2)
for cam = 1:4
subplot(1,4,cam)
imshow(calImg{cam}); hold on
scatter(I{cam}(:,1),I{cam}(:,2),'o','MarkerEdgeColor', colors{cam}, 'LineWidth', 1); hold on
xlabel("x (px)")
ylabel("z (px)")
end
hold off
The order of the cameras is off, I know. Image of camera C was to big to upload even compressed. I tried this, for example,
% Define your pixel values and their corresponding real-world coordinates
mov_p = I; fix_p = W;
pixelValues = cal(:); % Example pixel values
realWorldCoordinates = fix_p; % Example real-world coordinates
% Create a scatteredInterpolant
F = scatteredInterpolant(realWorldCoordinates(:, 1), realWorldCoordinates(:, 2), double(pixelValues));
% Create a grid of real-world coordinates
[X, Y] = meshgrid(1:size(cal, 2), 1:size(cal, 1));
[Xl, Yl] = meshgrid(locations(:, 1), locations(:, 2));
% Interpolate pixel values onto the real-world grid
remappedImage = interp2(CalD_rect(:,1), CalD_rect(:,2), double(pixelValues), X, Y);
% Display the remapped image
imshow(remappedImage, []);
But it doesn't work. Any help is appretiated.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by