UP | HOME

Exercise 18 solutions

Table of Contents


Python

e18.py

from scipy.misc import imread
from numpy import *
d = imread("e18data.jpg")
shape(d)
m_r = mean(d[:,:,0]) / 255.0 * 100.0
m_g = mean(d[:,:,1]) / 255.0 * 100.0
m_b = mean(d[:,:,2]) / 255.0 * 100.0

MATLAB / Octave

e18.m

d = imread('e18data.jpg');
m_red = mean(mean(d(:,:,1))) / 255 * 100;
m_green = mean(mean(d(:,:,2))) / 255 * 100;
m_blue = mean(mean(d(:,:,3))) / 255 * 100;

R

to come…


Paul Gribble | fall 2014
This work is licensed under a Creative Commons Attribution 4.0 International License
Creative Commons License