Skip to content

Commit 6a9213b

Browse files
committed
generated anaglyph for synth images
1 parent 54da359 commit 6a9213b

File tree

4 files changed

+30
-16
lines changed

4 files changed

+30
-16
lines changed

Motion-Estimation/Block_Matching.m

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,14 @@
3838
for i = 1:size(MSE,1)
3939
for j = 1:size(MSE,2)
4040
if (MSE(i,j) < min)
41-
min = MSE(i,j);
42-
dx = j; dy = i;
41+
min = MSE(i,j);dx = j; dy = i;
4342
end
4443
end
4544
end
4645

4746
min_MSE = min;
48-
x_predicted = dx;
49-
y_predicted = dy;
47+
x_predicted = dx-p-1;
48+
y_predicted = dy-p-1;
5049

5150
end
5251

Motion-Estimation/script.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
hold off;
3434

3535
% Peak Signal-to-Noise Ratio (PSNR) to measure the distortion of the frame which is estimated and the predicted one
36-
PSNR = image_PSNR(reference_frame, estimated_frame, 255);
37-
fprintf('Peak-Signal-To-Noise Rario: %d \n',PSNR);
36+
PSNR = image_PSNR(new_frame, estimated_frame);
37+
fprintf('Peak-Signal-To-Noise Ratio: %d \n',PSNR);
3838

3939

Stereoscopy/paddingZeros.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function paddedMatrix = paddingZeros(matrix, divisor)
2+
%paddedMatrix = zeros(size(matrix,1), size(matrix,2), size(matrix,3));
3+
rows = size(matrix,1);
4+
cols = size(matrix,2);
5+
paddedMatrix = wextend('ar','sym',matrix, round(rows/divisor)*divisor - rows, 'd');
6+
paddedMatrix = wextend('ac','sym',paddedMatrix, round(cols/divisor)*divisor - cols, 'l');
7+
end

Stereoscopy/stereoscopy_script.m

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,21 @@
141141
rightImage_dq(rows_r/2+1:rows_r, cols_r/2+1:cols_r,i) = dequantize_matrix(q_sub23_r(:,:,i),4,8);
142142
rightImage_synth(:,:,i) = haar_reverse_multilevel(rightImage_dq(:,:,i),2);
143143
end
144-
figure; image(uint8(rightImage_synth));
145-
figure; image(uint8(leftImage_synth));
146-
147-
function paddedMatrix = paddingZeros(matrix, divisor)
148-
%paddedMatrix = zeros(size(matrix,1), size(matrix,2), size(matrix,3));
149-
rows = size(matrix,1);
150-
cols = size(matrix,2);
151-
paddedMatrix = wextend('ar','sym',matrix, round(rows/divisor)*divisor - rows, 'd');
152-
paddedMatrix = wextend('ac','sym',paddedMatrix, round(cols/divisor)*divisor - cols, 'l');
153-
end
144+
figure; image(uint8(rightImage_synth)), title('Right Image Synth');
145+
figure; image(uint8(leftImage_synth)), title('Left Image Synth');
146+
147+
% Encode each eye's image using filters of different (usually chromatically opposite) colors, red and blue
148+
rightImage_synth = imtranslate(rightImage_synth,[10, 0]);
149+
150+
figure,image(rightImage_synth), title('Anaglyph Synth');
151+
r = zeros(size(rightImage_synth));
152+
gb = zeros(size(leftImage_synth));
153+
r(:,:,1) = double(rightImage_synth(:,:,1));
154+
gb(:,:,2:3) = double(leftImage_synth(:,:,2:3));
155+
anaglyph = uint8(r+gb);
156+
figure,image(anaglyph), title('Anaglyph Synth');
157+
158+
% Create stereo anaglyph with Matlab function to check the result
159+
J = stereoAnaglyph(rightImage_synth,leftImage_synth);
160+
figure, image(uint8(J)), title('Anaglyph using Matlab function')
161+

0 commit comments

Comments
 (0)