Saturday, June 21, 2008
assign 6Q3Cpic1
My first picture is this(far right corner:
The average color of this oicture is in the middle:
The code for the average color is as follows:
octave-3.0.1.exe:28> cd c:\
octave-3.0.1.exe:29> A=imread("p1.jpg");
octave-3.0.1.exe:30> B=double(A)/255;
octave-3.0.1.exe:31> size(B)
ans =
158 106 3
octave-3.0.1.exe:32> averagecolor=sum(sum(B))/(158*106)
averagecolor =
ans(:,:,1) = 0.35086
ans(:,:,2) = 0.60035
ans(:,:,3) = 0.85278
octave-3.0.1.exe:33> C=ones(256);
octave-3.0.1.exe:34> C(:,:,1)=0.35086*ones(256);
octave-3.0.1.exe:35> C(:,:,2)=0.60035*ones(256);
octave-3.0.1.exe:36> C(:,:,3)=0.85278*ones(256);
octave-3.0.1.exe:37> cd c:\users\public\documents
octave-3.0.1.exe:38> imwrite("p1out.jpg", C(:,:,1),C(:,:,2),C(:,:,3));
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment