fitgeotrans does not align my image

3 vues (au cours des 30 derniers jours)
Yannick
Yannick le 2 Juin 2014
Context: I am trying to use the Image Processing toolbox to find damage in materials. I first take a picture of my material before damaging it. I draw some markers on the material for alignment in MATLAB. Then I damage the material and I take a picture again.
Problem: I align two images of the same material by markers (see attachment). I first align them and then I want to see the difference (=damage) between the images. Unfortunately, the images do not align after fitgeotrans, as evident by the overlay image in imshowpair (in attachment). My second problem has to do with imabsdiff. After transformation, my images obviously have a slightly different size (due to the rotation). This impedes imabsdiff from working. Is there an easy solution to disregard the section where my fixed image is smaller than the warped one?
Do I make some basic error or is something else going on?
pre = imread('predamage');
post = imread('postdamage');
imwrite(pre, 'pret.tiff');
imwrite(post, 'postt.tiff');
moving = imread('postt.tiff');
fixed = imread('pret.tiff');
[moving_out,fixed_out] = cpselect(moving,fixed,'Wait', true);
match = fitgeotrans(moving_out,fixed_out, 'Similarity');
warped = imwarp(moving,match);
imshowpair(fixed,warped)
diff = imabsdiff(fixed,warped).*32; %Amplify the differences
imshow(diff)
Thanks in advance!
PS: I first convert from .JPG to .TIFF because I will possibly use a raw image format in the future.

Réponse acceptée

Alex Taylor
Alex Taylor le 2 Juin 2014
Use the 'outputView' name/value option when calling imwarp, as is shown in the examples for fitgeotrans. This will fix the issue.

Plus de réponses (1)

Yannick
Yannick le 3 Juin 2014
Problem solved, thanks!

Catégories

En savoir plus sur 3-D Volumetric Image Processing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by