How to find projective transformation with 4 points?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I need some help for fitgeotrans() function. I have this image:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/440778/image.jpeg)
this is a 902x902 image. I cropped it from an ortophoto.
and I want to project this image specify to the camrea parameters, to get an image like to take the picture the airplane's camera and get something like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/440783/image.png)
my code is the following:
quadrangle = [1 902; ...
902 902;...
902 1;...
1 1];
cam_width = 4096;
cam_height = 2160;
trf = fitgeotrans(quadrangle, [1 1; 1 cam_width; cam_height cam_width; cam_height 1],'projective');
projectedIm = imwarp(map.pic, trf, 'OutputView', imref2d([cam_height, cam_width]));
I allways get this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/440788/image.jpeg)
It is clear that I am missing something:/
0 Commenti
Risposte (1)
Tarunbir Gambhir
il 22 Dic 2020
Since the image is rotated 90 degrees clockwise, the scaled "height" and "width" should be interchanged while specifying the fixed points in fitgeotrans function.
Change the "trf" variable as following:
trf = fitgeotrans(quadrangle, [1 1; 1 cam_height; cam_width cam_height; cam_width 1],'projective');
0 Commenti
Vedere anche
Categorie
Scopri di più su Data Import and Export in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!