How to mark points in one image to other image using image registration?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have an x-ray image with some marked points and i want to mark same points in another x-ray image.
Here I used image registration and i adjust both images to one scale.Now I want to mark all the points in above image to be marked in the other images as shown below.
Here i want to extract the pints using another layer and put it in the unmarked image.
I tried the following code upto now.Can you suggest a solution for this?
img = imread(fullFileName);
%------------------Remove noise using median filter--------------------
img1=rgb2gray(img);
I = medfilt2(img1,[5, 5]);%add median filter
%------------frequency domain high pass filtering-----------------------
A = fft2(double(I));
A1=fftshift(A); % frequency scaling
% Gaussian Filter Response Calculation
[M, N]=size(A);
X=0:N-1;
Y=0:M-1;
[X, Y]=meshgrid(X,Y);
R=15; % filter size parameter
Lo=exp(-((X-(0.2*N)).^2+(Y-(0.2*M)).^2)./(2*R).^2);
Hi=1-Lo;
K=A1.*Hi;
K1=ifftshift(K);
B2=ifft2(K1);
%-----------------convert to spatial domain--------------------------
B2a =real(B2);
B2a=uint8(B2a);
%-------------------------Sharpening Image-------------------------------
B2a =imsharpen(B2a);
%----------------------------------- Contrast Streching-------------------
cep_adapthisteq = adapthisteq(B2a);
imwrite(cep_adapthisteq,'038ContrastImage.bmp')%save contrasted image
%==================================Background removal after enhancing============================================
grayImage=imread ('038ContrastImage.bmp');%read the saved enhanced image
grayImage =imcrop(grayImage,[75 140 1500 2000]);%crop image
th= 0.15; %thresholding value
binaryImage = imbinarize(grayImage,th);
binaryImage = imfill(binaryImage, 'holes');
binaryImage = bwareaopen(binaryImage, 100);
binaryImage = bwareafilt(binaryImage, 1);
binaryImage = imopen(binaryImage,true(5));
binaryImage = bwareafilt(binaryImage, 1);
binaryImage = imfill(binaryImage, 'holes');
binaryImage = imdilate(binaryImage,true(5));
skullFreeImage =grayImage;
skullFreeImage(~binaryImage) = 0;
skullFreeImage=imresize(skullFreeImage,[2400 1935]);
imwrite(skullFreeImage,'skullOnly.bmp');%save background removed image
%===========================================Image Registration==================================================
img1 = imread('PlotEdited.bmp');
img2 = skullFreeImage;
[optimizer,metric]=imregconfig('multimodal');
registered=imregister(img1,img2,'similarity',optimizer,metric); % Register images
[centres,radii] = imfindcircles(registered, [20 25],'objectPolarity','dark','sensitivity',0.94);
figure();imshow(registered);
title('Registered image');
figure()
viscircles(centres,radii);
imwrite(registered,'PointsMarkRegistered.bmp')
figure();
imshowpair(registered,img2);title('Registration','fontSize',12)
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Geometric Transformation and Image Registration dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!