How to change image shape in form of V?

1 visualización (últimos 30 días)
h612
h612 el 6 de Abr. de 2017
Comentada: Guillaume el 6 de Abr. de 2017
Filters, such as fisheye filter can shape the image with fisheye distortion. Is there a filter in which the image can look squeezed from bottom and wide from top? Such as a V?

Respuesta aceptada

Guillaume
Guillaume el 6 de Abr. de 2017
Use imwarp with a projective2d transform:
I = checkerboard(40);
transform = fitgeotrans([1, 1; size(I, 2), 1; 1, size(I, 1); size(I)], ...
[1, 1; size(I, 2), 1; 100, size(I, 1); size(I, 2)-100, size(I, 1)], ...
'projective');
imshowpair(I, imwarp(I, transform), 'montage')
  5 comentarios
h612
h612 el 6 de Abr. de 2017
I'm attaching the result. The black region can be seen in the result. I am wondering how can I not have that region 0- infact some interpolation of the neighbouring pixels
Guillaume
Guillaume el 6 de Abr. de 2017
I still have no idea what you want to interpolate in the black region. There is nothing there to interpolate. If you want to smear the edge of the image, you can use the older tformarray with a resampler that 'replicate' values.
transform = maketform('projective', ...
[1, 1; size(I, 2), 1; 1, size(I, 1); size(I)], ...
[1, 1; size(I, 2), 1; 100, size(I, 1); size(I, 2)-100, size(I, 1)]);
resampler = makeresampler('cubic', 'replicate');
imshowpair(I, tformarray(I, transform, resampler, [2 1], [2 1], [], []), 'montage');
However, note that most of these functions are deprecated. I don't know how to do the same with the new imwarp.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by