How to use im2warp with displacement field
Mostra commenti meno recenti
A manual of im2warp function says that
B = imwarp(A,D) transforms the input image A according to the displacement field defined by D.
So my goal is to warp A define dy
A = [1 0 0 0;0 0 0 0;0 0 0 0; 0 0 0 0];
The displacement is given by
uu = zeros(4,4,2);
uu(1,1,1) = 3;
uu(1,1,2) = 1;
I use the function
imwarp(A,uu,'nearest')
My expected result is
A_res = [0 0 0 0;0 0 0 0;0 0 0 0; 0 0 0 1];
However, the result is
>> imwarp(A,uu,'nearest')
ans =
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
How to use imwarp with displacement?
Risposte (1)
Image Analyst
il 25 Dic 2015
0 voti
Use imtranslate() - it's easier.
3 Commenti
jakeoung koo
il 26 Dic 2015
Image Analyst
il 26 Dic 2015
You're going to have to figure out how to warp the one arbitrarily-shaped region from image #1 into another arbitrarily-shaped region like in image #2. This might apply to the whole image but you're going to have to mask it to replace the pixels you didn't want to warp with the original pixels.
jakeoung koo
il 26 Dic 2015
Categorie
Scopri di più su Read, Write, and Modify Image in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!