Friday, June 13, 2008

Photomosaic Journal - Reverse Chronological

Step 1-3 in .png

I used the large2 function, as described below, to enlarge the image by r=9 and saved the file as .png using imwrite. The image below looks much simpler to replace the pixels in, and imread("large27.png") displays the matrix with reduced color values in the range {42, 128, 214}.
545x410


I reduced the image color to at most 27 colors using the same function as in Step 2 below, but saving the image as a .png file. In this way, imread("small27.png") displays a matrix with values only in the range {42, 128, 214}, as desired. It is more visible that colors have been reduced (versus when file was save as .jpg) in the image below:

61x46

I used the shrink2 function, with f=0.03 instead of f=0.04 because when the image was saved as .png using imwrite the resolution was clearer, to create the 61x46 image below:
61x46

Step 3 - Enlarge the Image
I used the large2 function created in Assignment 8, which enlarges an image by sending each pixel to its nearest neighbor. For the smaller image, originally 40x30, I used a factor of 10; for the larger image, originally 81x61, I used a factor of 8. The new image sizes are beside each picture below. The images were saved using imwrite(newpic,double(L)(:,:,1)/255,double(L)(:,:,2)/255,double(L)(:,:,3)/255) within the large2 function. It is definitely easier to see Bannock in his "Doggles" in the image enlarged from the 81x61 pic.

644x484
395x295
Step 2 - Reduce Image Color
I used the following code to reduce the shrunken images to 27 colors:
A=imread("smalldoggles.jpg");
B=floor(double(A)/86)*86+42;
imwrite("smalldoggles27.jpg",double(B)(:,:,1)/255,double(B)(:,:,2)/255,double(B)(:,:,3)/255).

Reducing the image color, in both cases, further distorted the resolution of the images, so that it is a little harder to tell what the pictures are of. It is looking like I may go with the 81x61 image.




Step 1 - Shrink the Image
I used the shrink2 function created in Assignment 7, which scales down an image by sending each pixel to its nearest neighbor. A 20 x 20 image had too poor a resolution, even using this high contrast picture. The 81 x 61 is obviously more clear than the 40 x 30, but I think the image resolution is preserved enough in the 40 x 30 to be able to make out the picture. I will try the remaining steps on each to decide which size to use. It is hard to see here, but the resolution has been reduced in each picture so that individual pixels are more visible than the original.
81 x 61
f=0.04

40x30
f=0.02

Step 0 - Choose your picture
  • This is Bannock, and these are his "Doggles", worn when the top is down

2048 x 1536


  • This is Ursa, in her "Doggles", I hope to use her pic to replace some the pixels in the background

Tuesday, June 10, 2008

Reducing Image Color

Original Image(1)
(2)
(3)
(4)
(5)

Original Image(1)
(2)
(3)
(4)
(5)
(1) To convert to an image with only 64 colors:
A=imread("originalpic.jpg");
B=255*floor((A)/85)*85;
C=double(B)/255;
imwrite("newcolor64.png",C(:,:,1),C(:,:,2),C(:,:,3))

(2) To convert to an image with only 27 colors:
A=imread("originalpic.jpg");
BB=255*floor((A)/86)*86+42;
CC=double(BB)/255;
imwrite("newcolor27.png",CC(:,:,1),CC(:,:,2),CC(:,:,3))

(3) To turn an image into a greyscale image:
A=imread("originalpic.jpg");
B3=(A(:,:,1)+A(:,:,2)+A(:,:,3))/3;
imwrite("greynow.png",B3)

(4) To turn the greyscale image into one with only 64 intensity values:
E=floor(double(B3)/4)*4;
imwrite("grey64.png",E)

(5) To turn the greyscale image into one with only 16 intensity values:
F=floor(double(B3)/16)*16;
imwrite("grey16.png",F)