-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from LaurentRDC/develop
Develop
- Loading branch information
Showing
33 changed files
with
914 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
# | ||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.abspath('../..')) | ||
|
||
import skued | ||
|
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
47 changes: 47 additions & 0 deletions
47
external/MaskedFFTRegistrationCode/MaskedTranslationRegistration.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
function [transform,maxC,C,numberOfOverlapMaskedPixels] = MaskedTranslationRegistration(fixedImage,movingImage,fixedMask,movingMask,overlapRatio) | ||
|
||
% [transform,maxC,C,numberOfOverlapMaskedPixels] = | ||
% MaskedTranslationRegistration(fixedImage,movingImage,fixedMask,movingMask,overlapRatio) | ||
% Masked FFT normalized cross-correlation registration of movingImage and | ||
% fixedImage under masks movingMask and fixedMask. | ||
% movingMask and fixedMask should consist of only 1s and 0s, where 1 | ||
% indicates locations of useful information in the corresponding image, | ||
% and 0 indicates locations that should be masked (ignored). | ||
% fixedImage and movingImage need not be the same size, but fixedMask | ||
% must be the same size as fixedImage, and movingMask must be the same | ||
% size as movingImage. | ||
% If a mask is not needed for either the fixedImage or the movingImage, | ||
% the fixedMask and/or movingMask can be set to an image of all ones of | ||
% the same size as the corresponding fixedImage and/or movingImage. | ||
% The optional overlapRatio specifies the number of pixels needed in the | ||
% overlap region for meaningful results. It is specified as a ratio of the | ||
% maximum number of overlap pixels. Regions in the resulting correlation | ||
% image that have fewer than this number of pixels will be set to 0. | ||
% | ||
% References: | ||
% D. Padfield. "Masked Object Registration in the Fourier Domain". | ||
% Transactions on Image Processing. | ||
% D. Padfield. "Masked FFT registration". In Proc. Computer Vision and | ||
% Pattern Recognition, 2010. | ||
% | ||
% Author: Dirk Padfield, GE Global Research, [email protected] | ||
% | ||
|
||
if( nargin < 5 ) | ||
overlapRatio = 3/10; | ||
end | ||
|
||
[C,numberOfOverlapMaskedPixels] = normxcorr2_masked(fixedImage,movingImage,fixedMask,movingMask); | ||
|
||
imageSize = size(movingImage); | ||
|
||
% Mask the borders; | ||
numberOfPixelsThreshold = overlapRatio * max(numberOfOverlapMaskedPixels(:)); | ||
C(numberOfOverlapMaskedPixels < numberOfPixelsThreshold) = 0; | ||
|
||
[maxC, imax] = max(C(:)); | ||
[ypeak, xpeak] = ind2sub(size(C),imax(1)); | ||
transform = [(xpeak-imageSize(2)) (ypeak-imageSize(1))]; | ||
|
||
% Take the negative of the transform so that it has the correct sign. | ||
transform = -transform; |
42 changes: 42 additions & 0 deletions
42
external/MaskedFFTRegistrationCode/MaskedTranslationRegistrationTest.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
% MaskedTranslationRegistrationTest | ||
% Test the MaskedTranslationRegistration code. | ||
% | ||
% References: | ||
% D. Padfield. "Masked Object Registration in the Fourier Domain". | ||
% Transactions on Image Processing. | ||
% D. Padfield. "Masked FFT registration". In Proc. Computer Vision and | ||
% Pattern Recognition, 2010. | ||
% | ||
% Author: Dirk Padfield, GE Global Research, [email protected] | ||
% | ||
|
||
|
||
close all; | ||
clear variables; | ||
clc; | ||
|
||
% Perform the registration on several sets of images. | ||
x = [75 -130 130]; | ||
y = [75 130 130]; | ||
overlapRatio = 1/10; | ||
|
||
for i = 1:3 | ||
fixedImage = imread(sprintf('OriginalX%2iY%2i.png',x(i),y(i))); | ||
movingImage = imread(sprintf('TransformedX%2iY%2i.png',x(i),y(i))); | ||
fixedMask = fixedImage~=0; | ||
movingMask = movingImage~=0; | ||
|
||
[translation,maxC] = MaskedTranslationRegistration(fixedImage,movingImage,fixedMask,movingMask,overlapRatio); | ||
[transformedMovingImage] = TransformImageTranslation(movingImage,translation); | ||
|
||
% Given the transform, transform the moving image. | ||
[overlayImage] = OverlayRegistration(fixedImage,transformedMovingImage); | ||
figure; imagesc(overlayImage); title(['Test ' num2str(i) ': Registered Overlay Image']); | ||
|
||
disp(['Test ' num2str(i) ':']); | ||
disp(['Computed translation: ' num2str([translation(1) -translation(2)])]); | ||
disp(['Correlation score: ' num2str(maxC)]); | ||
trueTranslation = [x(i),-y(i)]; | ||
disp(['Transformation error: ' num2str(translation - trueTranslation)]); | ||
disp(' '); | ||
end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.