Wednesday, May 21, 2008

Assignment 4



1. ones(256 , 1)
2. [0 : 1 : 255]
3. [0 : 1 : 255]’
4. ones(256,1) * [0 : 1 : 255]
5. [ones(256,1) * [0 : 1 : 255]]’
6. zeros(256)
7. ones(256)
8. 128*ones(256)
9. zeros(256)
10. imshow(ones(256,1)*[0:1:255]/255)
11. z(:,:,1)=[ones(256,1)*[0:1:255]/255]’;
z(:,:,2)=zeros(256);
z(:,:,3)=[ones(256,1)*[0:1:255]/255];
imshow(z)
12. z(:,:,1)=[ones(256,1)*[0:1:255]/255]’;
z(:,:,2)= [ones(256,1)*[0:1:255]/255];
z(:,:,3)= zeros(256);
imshow(z)
13. z(:,:,1)=zeros(256);
z(:,:,2)=[ones(256,1)*[0:1:255]/255];
z(:,:,3)= [ones(256,1)*[255:-1:0]/255]’;
imshow(z)
14. magenta to cyan
z(:,:,1)=[ones(256,1)*[0:1:255]/255]’;
z(:,:,2)= [ones(256,1)*[0:1:255]/255];
z(:,:,3)=ones(256);
imshow(z)
15. magenta to yellow
z(:,:,1)=ones(256);
z(:,:,2)=[ones(256,1)*[0:1:255]/255];
z(:,:,3)=[ones(256,1)*[0:1:255]/255]’;
imshow(z)
16. yellow to cyan
z(:,:,1)=[ones(256,1)*[0:1:255]/255]’;
z(:,:,2)=ones(256);
z(:,:,3)=[ones(256,1)*[0:1:255]/255];
imshow(z)


17. Here is the original output from Octave. The images in Octave are not displayed as squares, they are shown as rectangles. I did a print screen to capture this image and it got a bit distorted in the middle. The original picture didn't have this.
















I stretched the image to make it more like a square. Again, the image looks much nicer but when I put it into paint to save it as a JPEG, dark lines were added to the image.









18.


19. a=[1,3,0;2,3,6]
circshift(a,[0,-1])

20. a=[1,3,0;2,3,6]
shift(a,1)
21.
22.

1 comment:

Gingembre said...

The blog looks better when I preview it but, for some reason, it is not nicely laid out when I post it. I do not know how to fix this.