Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ba6279e
Update questions.md
PardoAlejo Feb 18, 2016
a7f032a
Merge remote-tracking branch 'diego0020/master'
PardoAlejo Feb 18, 2016
bd16a61
Merge pull request #1 from diego0020/master
PardoAlejo Feb 18, 2016
f8da5fa
primera entrada lab 2
PardoAlejo Feb 18, 2016
28cae7a
merge
PardoAlejo Feb 18, 2016
72c7c99
aprendiendo lo que busque en google
PardoAlejo Feb 19, 2016
54cf65f
Last try
PardoAlejo Feb 19, 2016
2d02639
prueba
PardoAlejo Feb 19, 2016
983787c
this was a probe
PardoAlejo Feb 19, 2016
552c05a
Merge pull request #2 from diego0020/master
PardoAlejo Feb 25, 2016
2c7d2c3
Added files via upload
PardoAlejo Mar 3, 2016
353df62
Added files via upload
PardoAlejo Mar 3, 2016
725686c
Update readme.md
PardoAlejo Mar 3, 2016
dcdafd0
Update readme.md
PardoAlejo Mar 3, 2016
090d290
Merge pull request #3 from diego0020/master
PardoAlejo Mar 3, 2016
6bd4398
Added files via upload
PardoAlejo Mar 6, 2016
1e853ef
Merge pull request #4 from diego0020/master
PardoAlejo Mar 10, 2016
a3e414d
Merge pull request #5 from diego0020/master
PardoAlejo Mar 15, 2016
2380dfd
Merge pull request #6 from diego0020/master
PardoAlejo Apr 4, 2016
aa46e32
Merge pull request #7 from diego0020/master
PardoAlejo Apr 12, 2016
8fd0595
Merge pull request #8 from diego0020/master
PardoAlejo Apr 14, 2016
1beb24e
Create report.md
PardoAlejo Apr 21, 2016
dd5977d
Added files via upload
PardoAlejo Apr 21, 2016
965cc14
Update report.md
PardoAlejo Apr 21, 2016
8e1f156
Added files via upload
PardoAlejo Apr 21, 2016
a5dddc3
Update report.md
PardoAlejo Apr 21, 2016
7976602
Update report.md
PardoAlejo Apr 21, 2016
5dd7d1e
Added files via upload
PardoAlejo Apr 21, 2016
7dfa26f
Added files via upload
PardoAlejo Apr 21, 2016
6001d6f
Update report.md
PardoAlejo Apr 21, 2016
d0ba125
Update report.md
PardoAlejo Apr 21, 2016
c3cc562
Update report.md
PardoAlejo Apr 21, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Originals.tif
Binary file not shown.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Computer vision lab

This repository will contain guides and scripts required during the lab.
ok ok ok ok
Binary file added Retoques.tif
Binary file not shown.
31 changes: 16 additions & 15 deletions lab01_git/questions.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Warmup Questions

1. What is the clone url of this repository?
> answer
> https://github.com/PardoAlejo/lab_vision

2. What is the output of the ``cal`` command?

Expand All @@ -12,46 +12,47 @@
# Homework Questions

1. What is the ``grep``command?
> answer
> grep allows to look for a command in the code, and helps to make many actions, like print in the screen, count the number of matches, and look for complexes combinations of strings.

2. What is a *makefile*?
> answer
> Is the file that allow the project to be build.

4. What does the ``-prune`` option of ``find`` do? Give an example
> answer
> prune option help to find what we are looking for, without search in all subdirectories or without look in a particular subdirectory.

5. Where is the ``grub.cfg`` file
> answer
> This is the default boot loader and launcher of ubuntu, and it is in /boot/grub/grub.cfg.

6. How many files with ``gnu`` in its name are in ``/usr/src``
> answer
> 0 files using find /usr/src/ - gnu | wc -l.

7. How many files contain the word ``gpl`` inside in ``/usr/src``
> answer
> 844 files, by using: grep -irm 1 "gpl" /usr/src/ | wc -l


8. What does the ``cut`` command do?
> answer
> with the command cut, you can "cut" the number of characters to the number of characters that you want.

9. What does the ``wget`` command do?
> answer
> this command follow links of the web and download files, also can create local versions of websites, recreating the directoy of the original file, in order to prevents you to repeat the same processes in the same website many times.

9. What does the ``rsync`` command do?
> answer
> rsync allows to transfer just the differences between two sets of files across the network link,

10. What does the ``diff`` command do?
> answer
> Diff command analize a couple of files and print on the screen the lines which both are different.

10. What does the ``tail`` command do?
> answer
> read the last lines of a file and write them as an output.

10. What does the ``tail -f`` command do?
> answer
> with the additional -f, allows to the file to be monitored, if the file is modified by another process, tail shows in the display the changes, it is mainly use to monitor log files.

10. What does the ``link`` command do?
> answer
> Links two files, and in consecuence any change in one of the files affects the other one. It link the files puting them in the same place of the disk.

11. How many users exist in the course server?
> answer
> 8

12. What command will produce a table of Users and Shells sorted by shell (tip: using ``cut`` and ``sort``)
> answer
Expand Down
2 changes: 1 addition & 1 deletion lab01_git/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- Read about version control and Git (sections 1.1 - 1.4)
http://git-scm.com/book/en/v2/Getting-Started-About-Version-Control

asd
## Basics

### Create a repository
Expand Down
Binary file added lab3_hybrid/data/bicycle.bmp
Binary file not shown.
Binary file added lab3_hybrid/data/bird.bmp
Binary file not shown.
Binary file added lab3_hybrid/data/cat.bmp
Binary file not shown.
Binary file added lab3_hybrid/data/dog.bmp
Binary file not shown.
Binary file added lab3_hybrid/data/einstein.bmp
Binary file not shown.
Binary file added lab3_hybrid/data/fish.bmp
Binary file not shown.
Binary file added lab3_hybrid/data/marilyn.bmp
Binary file not shown.
Binary file added lab3_hybrid/data/motorcycle.bmp
Binary file not shown.
Binary file added lab3_hybrid/data/plane.bmp
Binary file not shown.
Binary file added lab3_hybrid/data/submarine.bmp
Binary file not shown.
Binary file added lab3_hybrid/modified.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lab3_hybrid/originals.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lab3_hybrid/pyramid.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 64 additions & 1 deletion lab3_hybrid/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,76 @@ Create a hybrid image based on images from your own collections. The more origin

Notice that you will have to *align and crop* the images to get a good effect. To do this you may use image edition software like gimp or photoshop. You are free to do any additional processing that you want in order to increase the effect. Also consider how to deal with color on the images.



Finally, upload to the repository

These are my results:

- The original images
![originales](originals.jpg)
- My girlfriend and me.
- The processed images (cropped, aligned, color adjusted)
- A short description of each image (one paragraph)
![Processed images](modified.jpg)
- For my girlfriend image I enhaced the contrast of the image, multiplying it by a constant >1 to give it more importance because it was going to be the image with the high frequencies and I realized that in this two photos the low frequency dominated. On the other hand, for my image I multiplied it by a constant <1 to reduce the contast and increase the effect of the hybrid image.

- The final hybrid image
![Processed images](result.jpg)
- This is the result after take both , high and low frequencies and mixed up the images.

- The pyramid
![Processed images](pyramid.jpg)
- Pyramid to see the effect of low and high frequencies.
- The code you used (with comments)

CODE:

% this is the code for make hybrid images by Alejandro Pardo
clc;clear all; close all;
%Add path of the functions
addpath(genpath('proj1'));

%Read the images
original_down=im2double(imread('IMG_1671.jpg'));
original_up=im2double(imread('IMG_1669.jpg'));

%Process the images before the transformation
down=0.4*original_down;
up=1.2*original_up;

%Cutoff frequencies, parameters of the filter
cutoff=7;
cutoff1=7;

%Filter masks, tipe gaussian, with variance as a function of the cutoff
%frequencies, resulting by the analysis of the convolution. the scale
%factor that multiplies the cutoff frequency is the one that set the
%overlaping of the frequencies of the images, this factor basically
%determines how the images are combined each other. The window size was 9x9
h=fspecial('gaussian',cutoff*3+1,9);
h1=fspecial('gaussian',cutoff1*3+1,9);

%Get the low frequencies of the image 1
god=imfilter(down,h);

%Get the high frequencies of the image 2
tac=imfilter(up,h1);
tac=(up-tac);

%Combine the images to generate the hybrid result
result=god+tac;

%Results visualization
figure;
subplot(1,2,1);imshow(original_down);title('Original Image low frequencies');
subplot(1,2,2);imshow(original_up);title('Original Image high frequencies');
figure;
subplot(1,2,1);imshow(down);title('Adjusted Image low frequencies');
subplot(1,2,2);imshow(up);title('Adjusted Image high frequencies');
figure
imshow(vis_hybrid_image(result));title('Pyramid')
figure
imshow(result);title('Result');


**DUE**: 3 /3 /2016 ; 10:00 a.m.
Binary file added lab3_hybrid/result.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
98 changes: 98 additions & 0 deletions lab4_segmentation/segment_by_clustering.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
function labels = segment_by_clustering(im,space,method,k)

%This function generates an RGB image segmentation in k clusters
%Space: color space used for segmentation. Posible entries: 'rgb' 'lab' 'hsv' 'rgb+xy' 'lab+xy' 'hsv+xy'
%Method: method used for segmentation. Possible entries: 'kmeans' 'gmm'
%'watershed' 'hierarchical'


%color spaces
scale_factor=2;
if strcmp(method,'hierarchical')
im=imresize(im,1/scale_factor);
end

im=im2double(im);
[n,m,z]=size(im);

%rgb
imrgb=im./(max(im(:)));
%lab
cform = makecform('srgb2lab');
imlab = applycform(im,cform);
imlab=imlab-(min(imlab(:))).*ones(size(imlab));
imlab=imlab./(max(imlab(:)));
%hsv
imhsv=rgb2hsv(im);
imhsv=imhsv./((max(imlab(:))));
%xy feature
[y,x]=meshgrid(1:m,1:n);
xm=reshape(x,n*m,1);xm=0.4*xm./max(xm(:));
ym=reshape(y,n*m,1);ym=0.4*ym./max(ym(:));

%Chose de color space
if strcmp(space,'rgb')
imn=reshape(imrgb,n*m,3);
my=[imn];
elseif strcmp(space,'rgb+xy')
imn=reshape(imrgb,n*m,3);
my=[imn xm ym];
elseif strcmp(space,'lab')
imn=reshape(imlab,n*m,3);
my=[imn];
elseif strcmp(space,'lab+xy')
imn=reshape(imlab,n*m,3);
my=[imn xm ym];
elseif strcmp(space,'hsv')
imn=reshape(imhsv,n*m,3);
my=[imn];
elseif strcmp(space,'hsv+xy')
imn=reshape(imhsv,n*m,3);
my=[imn xm ym];
else
error('Invalid space input')
end

%Chose the method
if strcmp(method,'kmeans')

[idx]=kmeans(my,k);
labels=reshape(idx,n,m);

elseif strcmp(method,'gmm')

obj = fitgmdist(my,k);
idx = cluster(obj,my);
labels=reshape(idx,n,m);

elseif strcmp(method,'watershed')

im_gray = rgb2gray(im(:,:,1:3));

%gradient’s magnitude
hy = fspecial('sobel');
hx = hy';
Iy = imfilter(im2double(im_gray), hy, 'replicate');
Ix = imfilter(im2double(im_gray), hx, 'replicate');
grad = sqrt(Ix.^2 + Iy.^2);

%Markers for extended minima
marker = imextendedmin(grad, k);
%Impose minima
new_grad = imimposemin(grad, marker);
%Watershe calculation
labels = watershed(new_grad);

elseif strcmp(method,'hierarchical')

idx=clusterdata(my,'distance','euclidean','linkage','ward',...
'savememory','on','maxclust',k);

labels=reshape(idx,n,m);
labels=imresize(labels,scale_factor);
else
error('Invalid method input')
end

imshow(labels,[]);title('Segmented Image')
end
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions lab8_cnn/getBatchWithJitter.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
% --------------------------------------------------------------------
function [im, labels] = getBatchWithJitter(imdb, batch)
% --------------------------------------------------------------------
im = imdb.images.data(:,:,batch) ;
labels = imdb.images.label(1,batch) ;

n = numel(batch) ;
train = find(imdb.images.set == 1) ;

sel = randperm(numel(train), n) ;
im1 = imdb.images.data(:,:,sel) ;

sel = randperm(numel(train), n) ;
im2 = imdb.images.data(:,:,sel) ;

ctx = [im1 im2] ;
ctx(:,17:48,:) = min(ctx(:,17:48,:), im) ;

dx = randi(11) - 6 ;
im = ctx(:,(17:48)+dx,:) ;
sx = (17:48) + dx ;

dy = randi(5) - 2 ;
sy = max(1, min(32, (1:32) + dy)) ;

im = ctx(sy,sx,:) ;

% Visualize the batch:
% figure(100) ; clf ;

im = 256 * reshape(im, 32, 32, 1, []) ;
73 changes: 73 additions & 0 deletions lab8_cnn/initializeCNN.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
function net = initializeCNN()

f=1/100 ;
net.layers = {} ;

%Layer 1: Convolutional layer. Input size: 32x32

net.layers{end+1} = struct('type', 'conv', ...
'filters', f*randn(5,5,1,20, 'single'), ...
'biases', zeros(1, 20, 'single'), ...
'stride', 1, ...
'pad', 0) ;
%Layer 2: Pooling layer. Input size: 28x28x20
net.layers{end+1} = struct('type', 'pool', ...
'method', 'max', ...
'pool', [2 2], ...
'stride', 2, ...
'pad', 0) ;
%Layer 3: Convoluting layer. Input size: 28x28x20
net.layers{end+1} = struct('type', 'conv', ...
'filters', f*randn(4,4,50,500, 'single'),...
'biases', zeros(1,500,'single'), ...
'stride', 1, ...
'pad', 0) ;
%Layer 4. Input size: 24x24x20x500
net.layers{end+1} = struct('type', 'relu') ;

%Layer 5: Convolutional layer. Input: 24x240000
net.layers{end+1} = struct('type', 'conv', ...
'filters', f*randn(2,2,500,750, 'single'),...
'biases', zeros(1,750,'single'), ...
'stride', 1, ...
'pad', 0) ;

%Layer 6 Input: 20x240996x750
net.layers{end+1} = struct('type', 'softmaxloss');



% f=1/100 ;
% net.layers = {} ;
% net.layers{end+1} = struct('type', 'conv', ...
% 'filters', f*randn(5,5,1,20, 'single'), ...
% 'biases', zeros(1, 20, 'single'), ...
% 'stride', 1, ...
% 'pad', 0) ;
% net.layers{end+1} = struct('type', 'pool', ...
% 'method', 'max', ...
% 'pool', [2 2], ...
% 'stride', 2, ...
% 'pad', 0) ;
% net.layers{end+1} = struct('type', 'conv', ...
% 'filters', f*randn(5,5,20,50, 'single'),...
% 'biases', zeros(1,50,'single'), ...
% 'stride', 1, ...
% 'pad', 0) ;
% net.layers{end+1} = struct('type', 'pool', ...
% 'method', 'max', ...
% 'pool', [2 2], ...
% 'stride', 2, ...
% 'pad', 0) ;
% net.layers{end+1} = struct('type', 'conv', ...
% 'filters', f*randn(4,4,50,500, 'single'),...
% 'biases', zeros(1,500,'single'), ...
% 'stride', 1, ...
% 'pad', 0) ;
% net.layers{end+1} = struct('type', 'relu') ;
% net.layers{end+1} = struct('type', 'conv', ...
% 'filters', f*randn(2,2,500,26, 'single'),...
% 'biases', zeros(1,26,'single'), ...
% 'stride', 1, ...
% 'pad', 0) ;
% net.layers{end+1} = struct('type', 'softmaxloss') ;
Loading