Crop and change perspective of image

15 ビュー (過去 30 日間)
HaMo
HaMo 2022 年 12 月 8 日
編集済み: HaMo 2022 年 12 月 8 日
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 Center および File ExchangeGeometric 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