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.

Shrinking and Image - Code




'Click' to better view the teensy tiny pdf files.

Thursday, May 29, 2008

Octave - Image Package

(3)b) X=imread('facebookrainbow.jpg'); imshow(X) displays the following:

Computing the average color for this rainbow image:
Avg(R) = 15357868/255*225*310 = 0.86347
Avg(G) = 14141756/255*225*310 = 0.79509
Avg(B) = 13886570/255*225*310 = 0.78075.

The average color chip is a "light mauve", due to the components (220, 203, 199). This is different than the average color I obtained from my rainbow image, which was grey, with average color components (128, 128, 128). The average color function is blending all of the color components, I think.

(3)c) Here are the images, as generated by Octave-3.0.1:




B=imread('asst6_3c2.jpg')
imshow(B)

size(B)
ans = 107 160 3
sum(sum(B))
ans =
ans(:,:,1) = 1418726
ans(:,:,2) = 2754025
ans(:,:,3) = 2414097
max(B)
ans =
ans(:,:,1) = 255
ans(:,:,2) = 242
ans(:,:,3) = 225
Avg(R) = 1418726/255*107*160 = 0.32498
Avg(G) = 2754025/242*107*160 = 0.66474
Avg(B) = 2414097/255*107*160 = 0.62671

{used bucket fill in GIMP to generate Average Color}

  • R = 83
  • G = 170
  • B = 160

To display the Average Color, Green/Blue:

V2=255*ones(256);

V2(:,:,1)=0.32498*ones(256);
V2(:,:,2)=0.66474*ones(256);
V2(:,:,3)=0.62671*ones(256);
imshow(V2).


A=imread('asst6_3c1.jpg')
imshow(A)

size(A)
ans = 108 160 3
sum(sum(A))
ans =
ans(:,:,1) = 2158047
ans(:,:,2) = 1096316
ans(:,:,3) = 1048465
max(A)
ans =
ans(:,:,1) = 255
ans(:,:,2) = 255
ans(:,:,3) = 255
Avg(R) = 2158047/255*108*160 = 0.48975
Avg(G) = 1096316/255*108*160 = 0.24880
Avg(B) = 1048465/255*108*160 = 0.23794

{used bucket fill in GIMP to generate Average Color}

  • R = 125
  • G = 64
  • B = 61

To display the Average Color, "Maroon":

V1=255*ones(256);
V1(:,:,1)=0.48975*ones(256);
V1(:,:,2)=0.24880*ones(256);
V1(:,:,3)=0.23794*ones(256);
imshow(V1).

Based on the color components of the average colors, the color (as seen by my eye) of the 'average color chips' do not surprise me. As compared to the dominant colors when viewing the images, the average color chips are close to the dominant colors, but look more to be a blend of the colors in the original images.