% we just downloaded the image 'Library' % and saved it in the current directory x = imread('Library.jpg'); size(x) ans = 200 300 3 % for every pixel, x encodes the RGB color image(x) % to remove all blue from the picture, % we set the blue color to zero noblue = x; noblue(:,:,3) = zeros(size(x,1),size(x,2)); image(noblue) % to calculate with the colors, % we have to convert the data type from % uint (unsigned integers) to double dx = double(x); % we going to increase the blue intensity moreblue = dx; moreblue(:,:,3) = 1.5*dx(:,:,3); % to view the image, we must convert % back to the short uint (short = 1 byte) y = uint8(moreblue); figure image(y) % Movies % Animations in MATLAB have the nice % feature that we can determine the % camera position figure subplot(2,1,1); membrane hold on xlabel('x'); ylabel('y'); zlabel('z'); s = [-0.9 1.0 0.2]; plot3(s(1),s(2),s(3),'r+'); p = [0.5 0.0 1.1]; plot3(p(1),p(2),p(3),'bx'); % the goal is to aim our camera at % the peak, with coordinates in p % starting at s subplot(2,1,2); membrane; hold on set(gca,'CameraPosition',s); set(gca,'CameraTarget',p); set(gca,'Projection','Perspective'); figure membrane hold on set(gca,'CameraPosition',s); set(gca,'CameraTarget',p); set(gca,'Projection','Perspective'); hold off membrane set(gca,'CameraPosition',s); topeak = moviein(100); topeak(:,1) = getframe; dt = 0.01; for i = 2:100 s(1) = s(1) + dt; s(2) = s(2) + 0.5*dt; set(gca,'CameraPosition',s); topeak(:,i) = getframe; end; figure movie(topeak) diary off