Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f16e22e
Partial homework
CarlosAAcostaH Feb 18, 2016
2f41594
Merge pull request #1 from diego0020/master
CarlosAAcostaH Feb 18, 2016
478c0ee
Partial homework 2
CarlosAAcostaH Feb 19, 2016
f623772
Partial homework 3
CarlosAAcostaH Feb 19, 2016
141b45a
Update questions.md
CarlosAAcostaH Feb 19, 2016
e6f958f
Create File homework
CarlosAAcostaH Feb 24, 2016
83916c1
Create homework.md
CarlosAAcostaH Feb 24, 2016
50603d1
Add files homework
CarlosAAcostaH Feb 24, 2016
6af4e46
Added files via upload
CarlosAAcostaH Feb 25, 2016
5a4eef1
Added files via upload
CarlosAAcostaH Feb 25, 2016
16c1a21
Added files via upload
CarlosAAcostaH Feb 25, 2016
f0e51e1
Update homework.md
CarlosAAcostaH Feb 25, 2016
64ca699
Update homework.md
CarlosAAcostaH Feb 25, 2016
cd2ced6
Added files via upload
CarlosAAcostaH Feb 25, 2016
bb19946
Merge pull request #2 from diego0020/master
CarlosAAcostaH Feb 25, 2016
721c069
Add photo with water mark
CarlosAAcostaH Mar 1, 2016
f871dbc
Update homework.md
CarlosAAcostaH Mar 1, 2016
25981a2
Update homework.md
CarlosAAcostaH Mar 1, 2016
9fb43e6
Update homework.md
CarlosAAcostaH Mar 1, 2016
c672030
Update homework.md
CarlosAAcostaH Mar 2, 2016
ba90e54
Update lab3_hybrid.m
CarlosAAcostaH Mar 2, 2016
b3c7e34
Update homework.md
CarlosAAcostaH Mar 2, 2016
f28ee95
Update lab3_hybrid.m
CarlosAAcostaH Mar 2, 2016
17e6df5
Merge pull request #3 from diego0020/master
CarlosAAcostaH Mar 3, 2016
8a5fb55
Add segment_by_clustering.m
CarlosAAcostaH Mar 8, 2016
33176cf
Added files via upload
CarlosAAcostaH Mar 10, 2016
5c871be
Merge pull request #4 from diego0020/master
CarlosAAcostaH Mar 10, 2016
0bf623b
Create homework.md
CarlosAAcostaH Mar 17, 2016
23e5436
Update homework.md
CarlosAAcostaH Mar 17, 2016
9bb9a5a
Update homework.md
CarlosAAcostaH Mar 17, 2016
0dd9466
Merge pull request #5 from diego0020/master
CarlosAAcostaH Mar 17, 2016
a48c047
Added files via upload
CarlosAAcostaH Mar 31, 2016
3278d2e
Added files via upload
CarlosAAcostaH Mar 31, 2016
bda7584
Delete lab6_textons.pdf
CarlosAAcostaH Mar 31, 2016
feaaca7
Added files via upload
CarlosAAcostaH Mar 31, 2016
634d20b
Delete lab6_textons.pdf
CarlosAAcostaH Mar 31, 2016
a23e603
Added files via upload
CarlosAAcostaH Mar 31, 2016
2c69cdf
Merge pull request #6 from diego0020/master
CarlosAAcostaH Mar 31, 2016
1acf573
Merge pull request #7 from diego0020/master
CarlosAAcostaH Apr 7, 2016
7455eb7
Upload files
CarlosAAcostaH Apr 21, 2016
ddc48f2
Create Homework.md
CarlosAAcostaH Apr 21, 2016
71cc0b2
Added files via upload
CarlosAAcostaH Apr 21, 2016
9587379
Update Homework.md
CarlosAAcostaH 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
60 changes: 39 additions & 21 deletions lab01_git/questions.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,88 @@
# Warmup Questions

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

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

multi
line
answer
February 2016
Su Mo Tu We Th Fr Sa
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



# Homework Questions

1. What is the ``grep``command?
> answer
>
"The grep utility searches any given input files, selecting lines that
match one or more patterns"
-man grep

2. What is a *makefile*?
> answer
> A *makefile* is a text file used to built or manange proyects with commands in C/C++

4. What does the ``-prune`` option of ``find`` do? Give an example
> answer
>
``-prune`` causes ``find`` to not descend into the current file.
Ex.: find . -name .ingnore_Dir -prune -o -name '*.xyz' -print
It will find files with xyz extention but ignore the directory `.ignore_Dir`

5. Where is the ``grub.cfg`` file
> answer
> On ubuntu exist 3 ubications: /etc/grub.d, /usr/lib/grub and /usr/share/grub. On MacOS don't exist.

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

7. How many files contain the word ``gpl`` inside in ``/usr/src``
> answer
> 52 files (grep -lr "gpl" /usr/src/ | wc -l)

8. What does the ``cut`` command do?
> answer
>
"cut out selected portions of each line of a file"
-man cut

9. What does the ``wget`` command do?
> answer
> Download files from the Web

9. What does the ``rsync`` command do?
> answer
> Copy files localy and to/from another host

10. What does the ``diff`` command do?
> answer
>
"Compare files line by line"
-man diff

10. What does the ``tail`` command do?
> answer
>
"Print the last 10 lines of each FILE to standard output"
-man tail

10. What does the ``tail -f`` command do?
> answer
> Show the new lines in the file in real time

10. What does the ``link`` command do?
> answer
> Creates ``linked files``

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

12. What command will produce a table of Users and Shells sorted by shell (tip: using ``cut`` and ``sort``)
> answer
> cut -d':' -f1,7 /etc/passwd | sort | tr ':' '\t'

13. What command will produce the number of users with shell ``/sbin/nologin`` (tip: using ``grep`` and ``wc``)
> answer
> grep '/sbin/nologin' /etc/passwd | cut -d':' -f1 | wc -l

15. Create a script for finding duplicate images based on their content (tip: hash or checksum)
You may look in the internet for ideas, but please indicate the source of any code you use
Save this script as ``find_duplicates.sh`` in this directory and commit your changes to github

16. What is the meaning of ``#! /bin/bash`` at the start of scripts?
> answer
> The first two characters ``#!`` mean that the file is executable. The rest of the line mean the path where the script is execute.

17. How many unique images are in the ``sipi_images`` database?
> answer
Expand Down
Binary file added lab3_hybrid/HibridaCapilla.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions lab3_hybrid/Homework
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#Imagenes Originales
|[]
|[]
#Imagenes modificadas con GIMP(R)
|[]
|[]
#Imagen Hibrida Generada
|[]
Binary file added lab3_hybrid/NuevaCapilla.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/NuevaCapillaOrg.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/ViejaCapilla.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/ViejaCapillaOrg.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: 65 additions & 0 deletions lab3_hybrid/homework.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Hybrid Images
## Information about the place
The images were taken in diferents times in a same place: a Campito de San Jose's Chapel (hereafer called Chapel). The chapel was built in 1922 and later, in 1998, it was restaurated and converted in library. The first chapel's blueprints was known in 1903 and the bulding was acquired by the Universidad de los Andes in 1962. Nowdays, the chapel is the U building and works as Arts and Desing's library.
For more information about the chapel history go to [this link](https://campusinfo.uniandes.edu.co/images/stories/campus/Historia/Bloques/bloque%20u%20-%20capilla.pdf).
The chapel is locate intro the Universidad de los Andes Campus in the east of Bogota, on the hillside of Guadalupe. The cartesian coordinates of the chapel are latitude 4.601518 N and longitude 74.064162 W.
<div class="video-container">
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d819.4706569373759!2d-74.06471217084585!3d4.60170233657302!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x0!2zNMKwMzYnMDYuMSJOIDc0wrAwMyc1MS4wIlc!5e1!3m2!1ses-419!2s!4v1456885017487" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>
</div>
## Originals Images
<img src="https://github.com/CarlosAAcostaH/lab_vision/blob/master/lab3_hybrid/ViejaCapillaOrg.jpg" height="200" align="right">
The Old Chapel's photo belongs to Oficina de Administración Documental (OAD) of Univerisdad de los Andes, it was taken at 1969 by Gemán Téllez. The original photo can be at this [link](https://www.facebook.com/155723537956531/photos/a.240801929448691.1073741833.155723537956531/240801939448690/?type=3&theater).
The photo show was modificated (watermark) to protect the author rigths.
For more information go to [OAD's facebook page](https://www.facebook.com/Oficina-de-Administración-Documental-155723537956531/) or [OAD's page](oad.uniandes.edu.co).

The features of the old picture (as focal length and expotition time) do not know. The photo was obtained to the [OAD's facebook page](https://www.facebook.com/Oficina-de-Administración-Documental-155723537956531/)

<img src="https://github.com/CarlosAAcostaH/lab_vision/blob/master/lab3_hybrid/NuevaCapillaOrg.jpg" height="200" align="left">
The New Chapel's photo was taken by me, at 10:16 hrs (UTC-05:00), the day February 24th, 2016. The photo was taken with a cellphone's camera with the next features:
- Dimention: 2988 × 5312 px
- Color Space: RGB
- Color Profile: sRGB IEC61966-2.1
- Focal length: 4.8
- F number: 2.2
- Exposition time: 1/1.156 seg

## Processed images
<img src="https://github.com/CarlosAAcostaH/lab_vision/blob/master/lab3_hybrid/ViejaCapilla.jpg" height="200" align="left">
<img src="https://github.com/CarlosAAcostaH/lab_vision/blob/master/lab3_hybrid/NuevaCapilla.jpg" height="200" align="right">
The images was processed with the tool GIMP&reg; to crop and fix the perspective.

The images' color did not modificate.

The original images did not have the same perspective and therefor the size of windows, door, corners, stairs and others details were not similar. The perspective correction was used to relate the main facade of the chapel on the two images.

The perspective correction can be do with MATLAB&reg; with a 3x3 matrix to make a geometric transformation, but is easier in GIMP&reg; because the tool calculate the 3x3 matrix based on the move of points on the images.

## Final hybrid image
<img src="https://github.com/CarlosAAcostaH/lab_vision/blob/master/lab3_hybrid/HibridaCapilla.jpg" width="320" align="top">
<img src="https://github.com/CarlosAAcostaH/lab_vision/blob/master/lab3_hybrid/HibridaCapilla.jpg" width="240" align="top">
<img src="https://github.com/CarlosAAcostaH/lab_vision/blob/master/lab3_hybrid/HibridaCapilla.jpg" width="160" align="top">
<img src="https://github.com/CarlosAAcostaH/lab_vision/blob/master/lab3_hybrid/HibridaCapilla.jpg" width="120" align="top">
<img src="https://github.com/CarlosAAcostaH/lab_vision/blob/master/lab3_hybrid/HibridaCapilla.jpg" width="80" align="top">
<img src="https://github.com/CarlosAAcostaH/lab_vision/blob/master/lab3_hybrid/HibridaCapilla.jpg" width="60" align="top">
<img src="https://github.com/CarlosAAcostaH/lab_vision/blob/master/lab3_hybrid/HibridaCapilla.jpg" width="40" align="top">
<img src="https://github.com/CarlosAAcostaH/lab_vision/blob/master/lab3_hybrid/HibridaCapilla.jpg" width="30" align="top">
<img src="https://github.com/CarlosAAcostaH/lab_vision/blob/master/lab3_hybrid/HibridaCapilla.jpg" width="20" align="top">
<img src="https://github.com/CarlosAAcostaH/lab_vision/blob/master/lab3_hybrid/HibridaCapilla.jpg" width="15" align="top">
<img src="https://github.com/CarlosAAcostaH/lab_vision/blob/master/lab3_hybrid/HibridaCapilla.jpg" width="10" align="top">

## Commented Code
The code was write in m-language and run in MacOs Matlab R2015b. The processed images was saved in a directory `fotos`, placed in the same path to the code. The old photo was called `NuevaCapilla.jpg` and the new photo was called `ViejaCapilla.jpg`. The code save a hybrid image created as a jpg image (`HibridaCapilla.jpg`) in the directory `fotos`.
```matlab
clear all; % Clear all variables
close all; % Close all open figures
I1=imread('./fotos/NuevaCapilla.jpg'); % Create I1 as a 2016 chapel photo after modificated with GIMP(R)
I2=imread('./fotos/ViejaCapilla.jpg'); % Create I2 as a 1969 chapel photo after modificated with GIMP(R)
a=40; % Set an a parameter of the filter to apply to I1
b=40; % Set a b parameter of the filter to apply to I2
F1=fspecial('gaussian',floor(2*a+1)*[1 1],a*0.5); % Create a low-pass filter F1 that will be apply to I1
F2=fspecial('gaussian',floor(2*b+1)*[1 1],b*0.5); % Create a low-pass filter F1 that will be apply to I2
G1=imfilter(I1,F1); % Apply the filter F1 to I1 and save as G1
G2=imfilter(I2,F2); % Apply the filter F2 to I2 and save as G2
imshow(G1+(I2-G2)); % Show the hybrid image
imwrite(G1+(I2-G2),'./fotos/HibridaCapilla.jpg') % Save the hybrid image created in a jpg file
```
12 changes: 12 additions & 0 deletions lab3_hybrid/lab3_hybrid.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
clear all; % Clear all variables
close all; % Close all open figures
I1=imread('./fotos/NuevaCapilla.jpg'); % Create I1 as a 2016 chapel photo after modificated with GIMP(R)
I2=imread('./fotos/ViejaCapilla.jpg'); % Create I2 as a 1969 chapel photo after modificated with GIMP(R)
a=40; % Set an a parameter of the filter to apply to I1
b=40; % Set a b parameter of the filter to apply to I2
F1=fspecial('gaussian',floor(2*a+1)*[1 1],a*0.5); % Create a low-pass filter F1 that will be apply to I1
F2=fspecial('gaussian',floor(2*b+1)*[1 1],b*0.5); % Create a low-pass filter F1 that will be apply to I2
G1=imfilter(I1,F1); % Apply the filter F1 to I1 and save as G1
G2=imfilter(I2,F2); % Apply the filter F2 to I2 and save as G2
imshow(G1+(I2-G2)); % Show the hybrid image
imwrite(G1+(I2-G2),'./fotos/HibridaCapilla.jpg') % Save the hybrid image created in a jpg file
116 changes: 116 additions & 0 deletions lab4_segmentation/segment_by_clustering.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
function my_segmentation = segment_by_clustering(I, feature_space,...
method, nClusters,isDisplayed)
%% Probe that I is a rgb image
if ((size(I,3)~=3)||(numel(size(I))~=3))
error (['The 1� input argument (I) must be a rgb image \nthe size'...
' must be mxnx3%s'],'');
elseif ~isa(I,'uint8')
error (['The 1� input argument (I) must be a rgb image \nI must'...
' be a uint8, not a %s'], class(I))
end
%% Assign a value to nCluster
if nargin<4
nClusters=3;
end
%% Probe that nClusters is a numeric
if ~isa(nClusters,'numeric')
error(['The 4� input argument (nClusters) must be a numeric \n'...
'nClusters must be a numeric, not a %s'], class(nClusters))
end
%% If it is not a watershed clustering, change the data type of I to double
if ~strcmp(method,'watershed')
fsHandle=1;
if strcmp (feature_space,'lab')
I=rgb2lab(I);
fsHandle=2;
elseif strcmp (feature_space,'hsv')
I=rgb2hsv(I);
fsHandle=3;
elseif strcmp (feature_space,'rgb+xy')
I=double(I);
fsHandle=4;
elseif strcmp (feature_space,'lab+xy')
I=rgb2lab(I);
fsHandle=5;
elseif strcmp (feature_space,'hsv+xy')
I=rgb2hsv(I);
elseif ~strcmp (feature_space,'rgb')
warning ('The feature space is wrong, it will be rgb by defect');
I=double(I);
else
I=double(I);
end
%% Normalize and divide the the 3 channels of color
if (fsHandle==1||fsHandle==4)
ch1=I(:,:,1)/255;
ch2=I(:,:,2)/255;
ch3=I(:,:,3)/255;
elseif (fsHandle==2||fsHandle==5)
ch1=I(:,:,1)/100;
ch2=I(:,:,2);
ch3=I(:,:,3);
ch2=(ch2-min(ch2(:)))/(max(ch2(:))-min(ch2(:)));
ch3=(ch3-min(ch3(:)))/(max(ch3(:))-min(ch3(:)));
else
ch1=I(:,:,1);
ch2=I(:,:,2);
ch3=I(:,:,3);
end
%% Create a feature space (fSpace)
if fsHandle<4
fSpace = [ch1(:) ch2(:) ch3(:)];
else
[x,y] = meshgrid(0:(size(I,2)-1),0:(size(I,1)-1));
r=1;
fSpace = [ch1(:) ch2(:) ch3(:) r*x(:)/(max(x(:))) r*y(:)/(max(y(:)))];
end
%% If it is a watershed clustering convert I to gray-scale image
else
I=rgb2gray(I);
end
%% GMM clustering
if strcmp(method,'gmm')
options = statset('MaxIter',10000);
gmfit = fitgmdist(fSpace,nClusters,'CovarianceType','full',...
'SharedCovariance',false,'Options',options);
idx = cluster(gmfit,fSpace);
%% Watershed clustering
elseif strcmp(method,'watershed')
hy = fspecial('sobel');
hx = hy';
Iy = imfilter(double(I), hy, 'replicate');
Ix = imfilter(double(I), hx, 'replicate');
grad = sqrt(Ix.^2 + Iy.^2); % Gradient of I
h=0;
while 1 % Search h to have a correct nCluster
marker=imextendedmin(I,h);
L=bwlabeln(marker);
if max(L(:))<=nClusters
break
end
h=h+1;
end
new_grad=imimposemin(grad,marker);
ws=watershed(new_grad);
idx=ws(:);
%% KMEANS
else
if ~strcmp(method,'kmeans')
warning ('The method is wrong, it will be kmeans by defect');
end
idx = kmeans(fSpace,nClusters,'MaxIter',10000);
end
%% Reshape the output
my_segmentation=reshape(idx,[size(I,1) size(I,2)]);
%% Show the clustering
if nargin<5
isDisplayed=false;
end
if ~isa(isDisplayed,'logical')
error(['The 5� input argument (isDisplayed) must be a boolean \n'...
'isDisplayed must be a logical, not a %s'], class(isDisplayed))
end
if isDisplayed
imshow(label2rgb(my_segmentation,'jet','w','shuffle'));
end
end
29 changes: 29 additions & 0 deletions lab5_bsds/homework.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
1. Métodos de segmentación:

Descripción básica de los métodos. Alternativas para el espacio de segmentación. ¿Qué métodos escogieron? ¿Por qué?
### Método K-means
Es el método de segmentación mas simple y segmenta en k clusters donde k es un parametro. Su funcionamiento depende de los centroides iniciales. El algoritmo de este método es:
1. Definir k centroides en el el espacio de segmentación
2. Realizar la partición del espacio de segmentación con un diagrama de Voronoi con los k centroides
3. Recalcular el centroide de las k celdas como el promedio de los puntos pertenecientes a la celda de Voronoi
4. Si los centroides cambian, vuelva a paso ii; de lo contrario termino.
Al finalizar el algoritmo, el punto pertenece al cluster correspondiente al centroide mas cercano.

### Método GMM
Al igual que en el método de K-means, se recibe como parametro el numero de clusters deseados. En este caso no se asigna la pertenencia de un punto a un cluster durante la ejecución del método sino que se le asigna la probabilidad de pertenecer a un cluster y al finalizar se le asigna la etiqueta correspondiente al cluster más probable.

###Método Watershed
En este método se convierte la imagen con un sólo descriptor a un relieve del cual se encuentra las líneas de división de aguas. Para este método se convierte en escala de grises y el relieve es la magnitud del gradiente de la imagen en escaladegrises

2. Metodología de pruebas:

Descripción de la base de datos: ¿Cuántas imágenes son? ¿De qué tamaño? ¿De qué tipo ? ¿Cómo estaba organizada? ¿Cuál era la verdad terreno?; ¿Qué era lo que se medía en el benchmark? También rectificar que hubieran usado adecuadamente los conjuntos de train y test; especialmente que no hubieran iterado sobre "test".
3. Presentación resultados:

¿Corrieron el benchmark con éxito? ¿Presentan imágenes segmentadas para ilustrar los procedimientos? ¿Describen con palabras los aspectos importantes que se ven en las imágenes y las gráficas?
4. Discusión:

¿Cómo se comparan los algoritmos? ¿A qué creen que se deben las diferencias? ¿Cuáles son las implicaciones prácticas de los resultados? ¿Qué método recomiendan? ¿Cuáles son las limitaciones de los métodos?
5. Mejoras:

¿Cómo se podrían obtener mejores resultados en la segmentación? (acá pueden ser muy creativos)
Binary file added lab6_textons/lab6_textons.pdf
Binary file not shown.
Loading