Skip to content

Commit d079db7

Browse files
committed
added final folder with the ultimate code
1 parent 03fe9b9 commit d079db7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+254
-562
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
*~
2-
*.mat
32
# Packages #
43
############
54
# it's better to unpack these files and commit the raw source

Code/compute_oriented_hist

-264
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Code/final/grow_regions_inside_Q2.m

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
function [CBnplus1, dam] = grow_regions_inside_Q2(CB, Q)
2+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3+
% [CBnplus1, dam] = grow_regions_inside_Q(CB, Q)
4+
%
5+
% Grows the connected regions of CB that lie inside Q
6+
%
7+
% Inputs: CB - Matrix with the labelled regions
8+
% Q - Binary matrix with the connected region Q
9+
%
10+
% Outputs: CBnplus1 - Matrix with the grown labelled regions
11+
% dam - Binary matrix identifying the dam points
12+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13+
14+
nhood = strel([1 1 1; 1 1 1; 1 1 1]);
15+
dam = zeros(size(CB));
16+
17+
CBnplus1 = CB; % para no tocar CB
18+
while(~isequal(Q, ((CBnplus1 > 0) & Q) | dam)), % la union de los puntos que pertenecen a un CB o que estan en una presa tienen que ser igual a q. continua hasta que esté lleno, hasta que se hayan llenado del todo. or dam a lo mejor se puede tocar
19+
newq = Q & (CBnplus1 > 0); %
20+
nlist = get_number_list(CBnplus1(newq)); % nqint again
21+
22+
tmp1 = zeros(size(CB)); % posiciones de dam
23+
tmp2 = CBnplus1; % nuevas posiciones de CB. lo inicializamos asi
24+
for k=nlist; % para los cb que esten en q
25+
imdk = imdilate(CBnplus1==k, nhood) & Q; % no puede salir de q cuando se dilata.
26+
tmp1 = tmp1 + imdk; % le suma estos puntos
27+
tmp2(imdk & (CBnplus1 == 0)) = k; % ahora pertenecen al CB k.
28+
end;
29+
30+
dam = tmp1 > 1; % se han solapado dos dilataciones
31+
CBnplus1 = tmp2;
32+
end;

Code/HOG/main.m Code/final/main.m

File renamed without changes.

Code/merge_grad_func.m Code/final/merge_grad_func.m

+8-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
% gmax=sgolayfilt(gmax,3,7);
1717

1818
%threshold filtering
19-
thresh=5;
19+
thresh=8;
2020
r45(r45<thresh)=0;
2121
r125(r125<thresh)=0;
2222
gmax(gmax<thresh)=0;
@@ -40,17 +40,18 @@
4040
tmp=max(grad45,grad125);
4141
final_grad=max(gmax,tmp);
4242
figure(999)
43-
imshow(uint8(final_grad));
43+
imshow(uint8(final_grad)),title('Oriented Gradient');
4444

4545
%%%%final post-processing %%%%%
4646
sgo_grad=sgolayfilt(final_grad,2,7);
47-
median_grad=medfilt2(final_grad,[4 4]);
47+
median_grad=medfilt2(final_grad,[3 3]);
48+
median_grad(median_grad<thresh)=0;
4849

4950

5051
figure(1)
51-
imshow(uint8(sgo_grad));
52-
title('median');
52+
imshow(uint8(median_grad));
53+
title('Median filter');
5354

5455
figure(2)
55-
imshow(uint8(median_grad));
56-
title('sgolay filter');
56+
imshow(uint8(sgo_grad));
57+
title('Sgolay filter');

0 commit comments

Comments
 (0)