Contents
make anaglyph and display it in cogent
select two images of exactly the same size!
anaglyphFilename = 'demoImage'; % first image im1 = imread('Blue hills.jpg'); figure(1); imshow(im1);
Error using ==> imread File "Blue hills.jpg" does not exist.
second image
im2 = imread('Winter.jpg');
figure(2);
imshow(im2);
extract one
jpeg images are read as 3D arrays - separate 2D images for red green and blue
% extract one layer of each image grey_level_image1 = im1(:,:,1); % select red channel 1 grey_level_image2 = im2(:,:,1); % select blue channel 1 figure(1); imshow(grey_level_image1); % these look gray because we only have luminance now figure(2); imshow(grey_level_image2);
rgb(:,:,1) = grey_level_image1; % put first image in the red channel of anaglyph rgb(:,:,3) = grey_level_image2; % put first image in the blue channel of anaglyph rgb(:,:,2) = 0; % set green channel to black imshow(rgb);