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.

3 comments:

Mike Zabrocki said...

Your pictures look really washed out. Are you sure that you are doing that right?

One thing that might help is if you normalize all entries so that they are between 0 and 1 (that is convert to double and divide by 255). If it is not possible to get the image to display properly then just use the original jpegs that you get off the web to see if the average color compares with the dominant color.

Mike Zabrocki said...

I don't think that your images are washed out because you were doing anything wrong, it is because imshow doesn't work properly and you were copying those from the screen. Are your 'paintchips' made the same way?

Math Girl said...

For this assignment I am not going to redo the pics displayed using imshow with ones using imread/imwrite; it would be too much hassle to edit the blog entry. The rainbow (see Assignment #8) and web images (see bottom of "Octave - Part 3") are displayed elsewhere on my blog. The paint chips were created using GIMP, as mentioned in this blog entry.