Skip to content

Commit a91e9e5

Browse files
committed
created anaglyph
1 parent 07adb1e commit a91e9e5

File tree

5 files changed

+55
-0
lines changed

5 files changed

+55
-0
lines changed

Stereoscopy/stereoscopy_script.asv

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
img1 = imread('../Test-images/stereoscopy-images/image3.jpg');
2+
figure; image(img1); % Original image
3+
4+
% Split them into 2 separate images
5+
leftImages = img1(:,1:end/2,1);
6+
rightImages = img1(:,end/2+1:end,1);
7+
figure; image(leftImages);
8+
figure; image(rightImages);
9+
10+
% Encode each eye's image using filters of different (usually chromatically opposite) colors, red and cyan
11+
red = img1(:,:,1); % Red channel
12+
green = img(:,:,2); % Green channel
13+
blue = img(:,:,3); % Blue channel
14+
a = zeros(size(img, 1), size(img, 2));
15+
just_red = cat(3, red, a, a);
16+
just_green = cat(3, a, green, a);
17+
just_blue = cat(3, a, a, blue);
18+
back_to_original_img = cat(3, red, green, blue);
19+
figure, imshow(img), title('Original image')
20+
figure, imshow(just_red), title('Red channel')
21+
figure, imshow(just_green), title('Green channel')
22+
figure, imshow(just_blue), title('Blue channel')
23+
figure, imshow(back_to_original_img), title('Back to original image')
24+
25+
% Create stereo anaglyph with Matlab function
26+
J = stereoAnaglyph(leftImages,rightImages);
27+
image(J);
28+
29+
% Use TD3 to code them using 2 decomposition layers

Stereoscopy/stereoscopy_script.m

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
img1 = imread('../Test-images/stereoscopy-images/image3.jpg');
2+
figure; image(img1), title('Original Image'); % Original image
3+
4+
% Split them into 2 separate images
5+
leftImage = img1(:,1:end/2,:);
6+
rightImage = img1(:,end/2+1:end,:);
7+
figure; image(leftImage), title('Left Image');
8+
figure; image(rightImage), title('Right Image');
9+
10+
% Encode each eye's image using filters of different (usually chromatically opposite) colors, red and blue
11+
r = zeros(size(leftImage));
12+
gb = zeros(size(rightImage));
13+
r(:,:,1) = double(leftImage(:,:,1));
14+
gb(:,:,2:3) = double(rightImage(:,:,2:3));
15+
anaglyph = uint8(r+gb);
16+
figure,image(anaglyph), title('My Anaglyph')
17+
18+
% Create stereo anaglyph with Matlab function to check the result
19+
J = stereoAnaglyph(leftImage,rightImage);
20+
figure, image(J), title('Anaglyph using Matlab function')
21+
22+
% Use TD3 to code them using 2 decomposition layers
23+
img_lena = imread('../Test-images/lena_gray_512.tif');
24+
25+
%leftImage_haar = haar_transform_multilevel(leftImage,2);
26+
%rightImage_haar = haar_transform_multilevel(rightImage,2);
65 KB
Loading
72.9 KB
Loading
91.2 KB
Loading

0 commit comments

Comments
 (0)