fitgeotrans does not align my image

조회 수: 3 (최근 30일)
Yannick
Yannick 2014년 6월 2일
답변: Yannick 2014년 6월 3일
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.

채택된 답변

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

추가 답변 (1개)

Yannick
Yannick 2014년 6월 3일
Problem solved, thanks!

카테고리

Help CenterFile Exchange에서 3-D Volumetric Image Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by