Crop and change perspective of image

18 vues (au cours des 30 derniers jours)
HaMo
HaMo le 8 Déc 2022
Modifié(e) : HaMo le 8 Déc 2022
Let's say I have a photograph of a rectangular painting. When the photograph was taken, the camera was tilted about the yaw, pitch and roll axes relative an axes that projects in a perpendicular direction out from the painting. Also, in the photograph the painting is framed by the wall behind the painting. I want to crop the image and change the perspective so that it appears that the painting was right in front of the camera, and without the wall behind it. Nevermind the distortions to the image.
In python, it can be done with a single command. The input is the coordinates of the painting's four corners in the photograph's coordinate system, and the output is the coordinates of all four corners of a rectangle (in an arbitrary cartesian coordinate system).
Is there a similar simple way to achieve this in Matlab ?

Réponse acceptée

DGM
DGM le 8 Déc 2022
Modifié(e) : DGM le 8 Déc 2022
You can use fitgeotrans() and imwarp(). It's a little more generalized, so it's not exactly a one-liner.
Here is one example correcting the perspective of a photo of a whiteboard.

Plus de réponses (0)

Catégories

En savoir plus sur Geometric Transformation and Image Registration dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by