Portofolio 7

Pada portofolio 7 ini membahas tentang rekonstruksi pada citra stereo1.jpg dan stereo2.jpg.

Listing program stereo.m :

% STEREO
%
% Usage: XYZ = stereo(im1, im2, C1, C2)
%
% Where: im1 and im2 are the two stereo images
% C1 and C2 are the calibration matrices
% for these two images respectively
%
% The function will prompt you to digitise some points in the first image
% (finishing by clicking the right button). The function then
% prompts you to digitise the equivalent points (which you must digitise
% in exactly the same sequence) in the second image.
% The function then solves the stereo equations
% and returns the 3D coordinates of the points in pt3D.
function [XYZ, uv1, uv2] = stereo(im1, im2, C1, C2)

fprintf(1, ‘Digitise some points in figure 1\n’);
figure(1)
imshow(im1);
[u1,v1] = digipts;
uv1 = [u1,v1]‘;
fprintf(1, ‘Digitise some points in figure 2\n’);
figure(2)
imshow(im2);
[u2,v2] = digipts;
uv2 = [u2,v2]‘;

% check if same number of points are selected
if length(u1) ~= length(u2)
fprintf(1, ‘Same number of points not selected\n’);
end

for i = 1:length(u1)
a = [C1(1:2,1:3) - [u1(i)*C1(3,1:3); v1(i)*C1(3,1:3)];
C2(1:2,1:3) – [u2(i)*C2(3,1:3); v2(i)*C2(3,1:3)]];
c = [u1(i) - C1(1,4);
v1(i) - C1(2,4);
u2(i) - C2(1,4);
v2(i) - C2(2,4)];
b(:, i) = a \ c;
end
XYZ = b’;

Jalankan fungsi porto7

porto7
Digitise some points in figure 1
Digitise some points in figure 2
% dari fungsi stereo.m diatas, didapat titik-titik koordinat 3D XYZ seperti dibawah ini
pt3D =

-287.7542 156.7465 143.2885
-177.3276 163.9386 144.0329
-173.7841 18.9096 139.9448
-290.1675 12.2712 143.6394
-285.9892 160.1521 8.9771
-288.6479 10.9770 9.2064
-173.1225 16.7332 3.7534
-85.5010 -69.6051 2.5061
-67.2269 -146.6437 122.8954
17.3817 -179.3728 -2.9002
-137.1191 -207.3359 -2.2183
141.0377 -87.4122 59.5288
207.4266 -92.5498 61.9566
208.2186 -158.3242 58.7482
134.4806 -156.8063 60.4073
135.4209 -92.8680 -4.5017
137.5013 -159.0901 -8.1907
205.5709 -163.3734 -7.8675

Panjang rusuk kubus
Length matrix of face sides
slengths =

144.4959 110.6631 145.1298 116.6311
116.6311 136.2105 115.7972 134.4478
134.4478 149.1989 134.3662 144.4959
110.2111 134.3662 110.6631 134.4478
134.4478 145.1298 136.2105 146.0530
146.0530 115.7972 149.1989 110.2111

Panjang sisi kubus
nface =

4 1 2 3 4
4 3 7 6 4
4 6 5 1 4
8 5 1 2 8
8 2 3 7 8
8 7 6 5 8

Panjang rusuk limas
Length matrix of face sides
slengths =

144.0919 155.0946 150.5424
144.0919 155.6338 147.1615
150.5424 157.0124 147.1615
155.0946 157.0124 155.6338

Panjang sisi limas
nface =

1 2 3 1
1 2 4 1
1 3 4 1
2 3 4 2

Panjang rusuk balok
Length matrix of face sides
slengths =

69.7088 66.6316 65.8574 73.7723
73.7723 66.8592 68.2050 68.7024
68.7024 66.3574 64.5075 69.7088
75.0826 64.5075 66.6316 68.7024
68.7024 65.8574 66.8592 68.7240
68.7240 68.2050 66.3574 75.0826

Panjang sisi balok
nface =

4 1 2 3 4
4 3 7 6 4
4 6 5 1 4
8 5 1 2 8
8 2 3 7 8
8 7 6 5 8

  • Urutan penomoran untuk 3D pada citra stereo:

Urutan penomoran 3D pada stereo 1.png

Urutan penomoran 3D pada stereo2.png

  • Citra stereo dan hasil rekonstruksinya:

stero1.png

stereo2.png

Rekonstruksi 3D untuk Kubus, Limas dan Balok dari 2 sisi yang berbeda

Ungkapkan pendapat Anda