Warping an image to a specified size

3 views (last 30 days)
I have an input image and have found the corners of the object I want to segment. I would like to transform the segmented object to a 500x500 image.
C = corner(mask,'Harris',4);
OutputC = [0 0; 500 0; 0 500; 500 500];
figure, imshow(mask), hold on
plot(C(:,1), C(:,2),'r*');
Tform2 = fitgeotrans(C,OutputC,'projective');
iout = imwarp(I1,Tform2);
figure;
imshow(iout);
The resulting output image is not my 500x500 size and I'm not sure why.
Should I be using a calculated homography matrix and applying that to my input image?

Accepted Answer

KSSV
KSSV on 22 Feb 2017
doc imresize .You can change the dimensions to your desired size using this.
  2 Comments
andrew Kwon
andrew Kwon on 22 Feb 2017
The problem with using imresize is that I will have more severe cases. Specifically the object I want to segment will have a lot of shear and rotational error. I must use a homography to get a more visible view of the object.
andrew Kwon
andrew Kwon on 23 Feb 2017
I figured out that the problem was because I was not matching the same corners in the input to the output image.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!