Crop and change perspective of image

22 次查看(过去 30 天)
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 ?

采纳的回答

DGM
DGM 2022-12-8
编辑:DGM 2022-12-8
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geometric Transformation and Image Registration 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by