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)

Saturday, June 7, 2008

Assignment #8 - Pictures

(4) Combinations of shrink and enlarge functions used to compare different methods:

a) Shrink2 + Large2:

b) Shrink2 + Large3:c) Shrink3 + Large2:d) Shrink3 + Large3:
(d) was even more washed out using imwrite; imshow was used.
(5) The wiki image (code below):
Enlarging the Facebook Rainbow:
(2) Nearest Neighbor - Method 2:
shrink2: f=0.75 + large2: r=4/3


shrink2: f=0.25 + large2: r=4





shrink2: f=0.1 + large2: r=10





(3) Imwrite does not seem to work to display enlarged images using bilinear interpolation (large3). The code runs in Octave but the images are very washed out. The images are similar to those created from large2, with slightly poorer resolution.
(1)a) f1=1, f2=0.5

b) f1=0.5, f2=1

c) f1=0.2, f2=0.8 Since (c) is very dark, I experimented with different factors. In the image below, f1=0.25 & f2=1, these factors are as close as I could come to the ones suggested in part (c), before the image had black lines.

Assignment #8 - Code











Thursday, June 5, 2008

Shrinking an Image - Pics for Method 2

Images created using imwrite for shrinking an image, using the preferred Code: Method 2.


























I left the images created using imshow up because they show the change in resolution, when shrinking the size of an image (i.e. reducing the number of pixels), better:


Note: This above image is how imread/imshow displays the facebook rainbow in Octave.

































Method 2 displays the best pictures when shrinking an image. The pictures for Method 3 are very similar, but with slightly poorer resolution. Method 1 produced images for f=0.1 that were almost entirely white for the two internet pics.