Saturday, June 14, 2008
Wednesday, June 11, 2008
Saturday, June 7, 2008
Assignment #7
function smallimage=shrink2(largeimage,f);
Mp=floor(size(largeimage,1)*f-1);
Np=floor(size(largeimage,2)*f-1);
smallimage(:,:,1)=zeros(Mp-1,Np-1);
smallimage(:,:,2)=zeros(Mp-1,Np-1);
smallimage(:,:,3)=zeros(Mp-1,Np-1);
for i=1:(Mp-1)
for j=1:(Np-1)
a=round(i/f);
b=round(j/f);
smallimage(i,j,:)=largeimage(a,b,:);
end;
end;
endfunction;
A=imread("image.jpg");
B=shrink2((double(A)/255),f);
function smallimage=shrink3(largeimage,f)
Mp=floor(size(largeimage,1)*f);
Np=floor(size(largeimage,2)*f);
smallimage(:,:,1)=zeros(Mp-1,Np-1);
smallimage(:,:,2)=zeros(Mp-1,Np-1);
smallimage(:,:,3)=zeros(Mp-1,Np-1);
for i=1:(Mp-1);
for j=1:(Np-1);
a=i/f;
b=j/f;
r=floor(a);
s=floor(b);
for k = 1:3;
smallimage(i,j,k)=[1-a+r, a-r]*double([largeimage(r,s,k),largeimage(r,s+1,k);largeimage(r+1,s,k),largeimage(r+1,s+1,k)])*[1-b+s;b-s];
end;
end;
end;
endfunction;
A=imread("image.jpg");
B=shrink3((double(A)/255),0.75);
Monday, June 2, 2008
Assignment #6-question 3
Assignment 6 - 3 b)
pkg load image
cd 'C:\pictures'
A=imread("Rainbow.jpg");
B=double(A)/255;
size(B)
ans =
109 200 3
aveB=sum(sum(B))/109/200
ans(:,:,1)=0.56770
ans(:,:,2)=0.34527
ans(:,:,3)=0.30058
aveB(:,:,1)=0.56770
aveB(:,:,2)=0.34527
aveB(:,:,3)=0.30058
imshow(aveB)
6 -3 b)
Find the average colour of two images from the web.
C=imread("green.jpg");
D=double(C)/255;
imshow(D)
size(D)
ans =
110 160 3
aveD=sum(sum(D))/110/160
ans(:,:,1)=0.46077
ans(:,:,2)=0.66349
ans(:,:,3)=0.069944
aveD(:,:,1)=0.46077
aveD(:,:,2)=0.66349
aveD(:,:,3)=0.069944
imshow(aveD)
E=imread("blue.jpg");
F=double(E)/255
imshow(F)
size(F)
ans =
106 160 3
aveF=sum(sum(F))/106/160
ans(:,:,1)=0.24725
ans(:,:,2)=0.35670
ans(:,:,3)=0.76474
aveF(:,:,1)=0.24725
aveF(:,:,2)=0.35670
aveF(:,:,3)=0.76474
imshow(aveF)
When the original image is predominately one colour, the average colour is similar. When the original image has many colours, the average colour is less predictable.
pkg load image
cd 'C:\pictures'
A=imread("Rainbow.jpg");
B=double(A)/255;
size(B)
ans =
109 200 3
aveB=sum(sum(B))/109/200
ans(:,:,1)=0.56770
ans(:,:,2)=0.34527
ans(:,:,3)=0.30058
aveB(:,:,1)=0.56770
aveB(:,:,2)=0.34527
aveB(:,:,3)=0.30058
imshow(aveB)
6 -3 b)
Find the average colour of two images from the web.
C=imread("green.jpg");
D=double(C)/255;
imshow(D)
size(D)
ans =
110 160 3
aveD=sum(sum(D))/110/160
ans(:,:,1)=0.46077
ans(:,:,2)=0.66349
ans(:,:,3)=0.069944
aveD(:,:,1)=0.46077
aveD(:,:,2)=0.66349
aveD(:,:,3)=0.069944
imshow(aveD)
E=imread("blue.jpg");
F=double(E)/255
imshow(F)
size(F)
ans =
106 160 3
aveF=sum(sum(F))/106/160
ans(:,:,1)=0.24725
ans(:,:,2)=0.35670
ans(:,:,3)=0.76474
aveF(:,:,1)=0.24725
aveF(:,:,2)=0.35670
aveF(:,:,3)=0.76474
imshow(aveF)
When the original image is predominately one colour, the average colour is similar. When the original image has many colours, the average colour is less predictable.
Subscribe to:
Posts (Atom)