|
a |
|
b/test_1.m |
|
|
1 |
%test - dicom image process = |
|
|
2 |
close all; |
|
|
3 |
clear all ; |
|
|
4 |
clc ; |
|
|
5 |
|
|
|
6 |
|
|
|
7 |
m=dicominfo('bmode.dcm'); |
|
|
8 |
X=dicomread(im); |
|
|
9 |
a_1=rgb2gray(X(29:568,235:790,:,1)); %extraction of first image // the range to extract jst the image |
|
|
10 |
a_2=rgb2gray(X(29:568,235:790,:,2)); %extraction of the second image |
|
|
11 |
|
|
|
12 |
|
|
|
13 |
figure, |
|
|
14 |
subplot(1,2,1);imshow(X(:,:,:,1)); |
|
|
15 |
subplot(1,2,2);imshow(X(:,:,:,2)); |
|
|
16 |
impixelinfo; |
|
|
17 |
|
|
|
18 |
%figure, |
|
|
19 |
%i=[1:36]; |
|
|
20 |
%montage(X(29:568,235:790,:,i)); |
|
|
21 |
|
|
|
22 |
%detect feature points |
|
|
23 |
imagepoints1=detectSURFFeatures(a_1,'MetricThreshold',1000); |
|
|
24 |
imagepoints2=detectSURFFeatures(a_2,'MetricThreshold',1000); |
|
|
25 |
|
|
|
26 |
%extract feature discryptors |
|
|
27 |
feature_1=extractFeatures(a_1,imagepoints1); |
|
|
28 |
feature_2=extractFeatures(a_2,imagepoints2); |
|
|
29 |
|
|
|
30 |
%plot the extracted features |
|
|
31 |
figure; |
|
|
32 |
subplot(1,2,1); |
|
|
33 |
imshow(a_1); |
|
|
34 |
hold on; |
|
|
35 |
plot(selectStrongest(imagepoints1,500)); |
|
|
36 |
|
|
|
37 |
subplot(1,2,2); |
|
|
38 |
imshow(a_2); |
|
|
39 |
hold on; |
|
|
40 |
plot(selectStrongest(imagepoints2,500)); |
|
|
41 |
title('extracted features on the image'); |
|
|
42 |
|
|
|
43 |
|
|
|
44 |
%MATCH EXTRACTED FEATURES |
|
|
45 |
%indexPairs_1=matchFeatures(feature_1,feature_2,'maxRatio',0.9); |
|
|
46 |
%ommitted as too many outliers are produced |
|
|
47 |
|
|
|
48 |
|
|
|
49 |
indexPairs_1=matchFeatures(feature_1,feature_2,'Unique',true); |
|
|
50 |
|
|
|
51 |
matchedPoints1 = imagepoints1(indexPairs_1(:, 1)); |
|
|
52 |
matchedPoints2 = imagepoints2(indexPairs_1(:, 2)); |
|
|
53 |
|
|
|
54 |
figure; |
|
|
55 |
showMatchedFeatures(a_1,a_2,matchedPoints1,matchedPoints2); |
|
|
56 |
title('features matched in the original image'); |
|
|
57 |
|
|
|
58 |
|
|
|
59 |
%outliers delete |
|
|
60 |
c=[]; |
|
|
61 |
for z=1:422 |
|
|
62 |
if sumsqr(matchedPoints2(z).Location-matchedPoints1(z).Location)>10 |
|
|
63 |
c=[c,z]; |
|
|
64 |
end |
|
|
65 |
end |
|
|
66 |
matchedPoints1(c)=[]; |
|
|
67 |
matchedPoints2(c)=[]; |
|
|
68 |
|
|
|
69 |
figure; |
|
|
70 |
showMatchedFeatures(a_1,a_2,matchedPoints1,matchedPoints2); |
|
|
71 |
title('features matched after deletion of outliers'); |
|
|
72 |
|
|
|
73 |
%create point cloud |
|
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
|