# Why is the pointsToWorld back-projection inverted?

3 visualizzazioni (ultimi 30 giorni)
Duijnhouwer il 7 Ago 2020
Commentato: Duijnhouwer il 22 Ago 2020
Hi I have a question regarding the use of estimateWorldCameraPose and pointsToWorld of the Computer Vision Toolbox.
When I estimate the orientation and the location of the camera relative to the planar scene of points using estimateWorldCameraPose,
and then, using the camera orientation and postion thus obtained, I back-project the points to world coordinates (sans depth) using pointsToWorld,
why are the back-projected points inverted relative to the original world points?
The below code illustrates the question:
% Create a matrix of planar world points
[wx,wy]=meshgrid(0:20:100,0:40:200);
worldPoints=[wx(:) wy(:) zeros(size(wy(:)))];
% Remove one (so we can recognize the orientation later)
worldPoints(2,:)=[];
% Create a set of image points. For this example they are the same as the world
% points (but 2D)
imagePoints=worldPoints(:,[1 2]);
% Create arbitraty camera intrinsics
focalLength = [800, 800];
principalPoint = [320, 240];
imageSize = [480, 640];
intrinsics = cameraIntrinsics(focalLength,principalPoint,imageSize);
% Estimate the orientation and the location of the camera relative to the planar
% scene of points
[worldOri,worldLoc] = estimateWorldCameraPose(worldPoints(:,[1 2]),worldPoints,intrinsics);
% Using the estimates, back project the points to world coordinates (sans depth)
backProjectPoints = pointsToWorld(intrinsics,worldOri,worldLoc,imagePoints);
% Plot the worldPoints and the back projection
figure
scatter(worldPoints(:,1),worldPoints(:,2))
hold on
scatter(backProjectPoints(:,1),backProjectPoints(:,2))
title('Why inverted?');
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Qu Cao il 16 Ago 2020
You may need to convert the camera world pose to extrinsics using cameraPoseToExtrinsics:
[worldOri,worldLoc] = estimateWorldCameraPose(worldPoints(:,[1 2]),worldPoints,intrinsics);
[rotationMatrix,translationVector] = cameraPoseToExtrinsics(worldOri,worldLoc);
backProjectPoints = pointsToWorld(intrinsics,rotationMatrix,translationVector,imagePoints);
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Duijnhouwer il 22 Ago 2020
That works :) Thanks Qu!

Accedi per commentare.

### Categorie

Scopri di più su Image Processing and Computer Vision in Help Center e File Exchange

R2020a

### Community Treasure Hunt

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

Start Hunting!

Translated by