%
% This is simply what I typed in MATLAB in class, excluding what crashed when run.
%
% It may still have errors.
%
I = imread('desertSmall.jpg');
I = double(I);
I = (I(:,:,1)+I(:,:,2)+I(:,:,3))/3;
I = uint8(I);
imshow(I);
for indPix = 1:prod(size(I))
h = zeros(256,1);
for indPix = 1:prod(size(I))
h(I(indPix)+1) = h(I(indPix)+1)+1;
end
bar(h)
shg
ls
imshow(I)
histogram = zeros(256,1);
plot(histogram,'o')
shg
for indPixel = 1:length(I(:))
histogram(I(indPixel)+1) = histogram(I(indPixel)+1) + 1;
end
bar(histogram)
shg
imshow(I)
shg
bar(h)
shg
mask = I > 130;
I
mask
imshow(I)
shg
imshow(mask)
shg
for indPixel = 1:length(I(:))
histogram(I(indPixel)+1) = histogram(I(indPixel)+1) + 1;
end
x = -3:.1:3;
plot(x,mod(x,2),'.');
mod(rand(2,2)+0.5,1)