Embed vector field in bigger array

2 ビュー (過去 30 日間)
Francois Fohl
Francois Fohl 2021 年 9 月 14 日
回答済み: KSSV 2021 年 9 月 14 日
In order to undistort an image for a special purpose, I used displacement vectors.
The vector field isn't covering the entire image. Problem is the following: To apply the vectors on the image the sizes need to be identical.
Vector field: 2000x1200
Image: 6000 x 4000
Is there a way to embed the vector field in a bigger array, so that it can be applied correctly to the image. Maybe it could be embedded in a matrix of 0?
The region of interest is only the 2000x1200 field. Extrapolating the vector field to 6000x4000 doesn't deliver the desired result, neither croping the image to 2000x1200.

採用された回答

KSSV
KSSV 2021 年 9 月 14 日
Read about padarray.
Other option:
A = rand(4) ;
B = zeros(10) ;
B(3:6,3:6) = A
B = 10×10
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1004 0.8599 0.4755 0.6533 0 0 0 0 0 0 0.5186 0.1796 0.7476 0.6220 0 0 0 0 0 0 0.9443 0.5652 0.8298 0.7524 0 0 0 0 0 0 0.2921 0.0010 0.6162 0.0293 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeRead, Write, and Modify Image についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by