-
Notifications
You must be signed in to change notification settings - Fork 0
/
Exercise3 Final
41 lines (32 loc) · 904 Bytes
/
Exercise3 Final
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using PyPlot; pygui(true); # We'll use the plotting package PyPlot and will plot outside the plotspane
using JLD; # for saving/loading
using Printf # for string formatting
figure(1)
#A. a.
image = imread("el-capitan.png")
imshow(image)
println("size of image: ",(size(image)))
#A. b.
function extractimagechannels(imagename)
image = imread(imagename)
imshow(image)
redchannel = image[:,:,1]
greenchannel = image[:,:,2]
bluechannel = image[:,:,3]
return redchannel, greenchannel, bluechannel
end
#A. c/d.
println("Reset with git reset --mixed")
#A. e.
image2 = zeros(360,640,3)
image2[:,:,1]=image[:,:,2] #1 was red, now green
image2[:,:,2]=image[:,:,3] #2 was green, now blue
image2[:,:,3]=image[:,:,1] #3 was blue, now red
subplot(1,2,1)
imshow(image)
title("El-Capitan Image")
axis("off")
subplot(1,2,2)
imshow(image2)
title("El-Capitan Altered Image")
axis("off")