-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbd9b55
commit 39add00
Showing
38 changed files
with
300 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
function T = DilataMascara(I,MM,EE) | ||
%imagem, mascara, elemento | ||
m = size(I,1); | ||
n = size(I,2); | ||
|
||
A = I; | ||
|
||
for x = 1 : 5 | ||
A = dilatar_g(A,EE); | ||
%figure; imshow(A); | ||
|
||
for i = 1 : m | ||
for j = 1 : n | ||
if (MM(i,j) == 0) && (A(i,j) == 255) | ||
A(i,j) = 0; | ||
end | ||
end | ||
end | ||
end | ||
%A = A-MM; | ||
|
||
T=A; | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function[output]= abertura(I) | ||
|
||
% opening: erosion+dilatar | ||
|
||
ee = [0,255,0; 255,255,255; 0,255,0]; | ||
|
||
erosion = erosion_g(I,ee); | ||
opening = dilatar_g(E,ee); | ||
|
||
output = opening; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
function[output]= adicao(image,sobel) | ||
|
||
edge_filter=filter; | ||
swap=image; | ||
|
||
line_size = size(swap,1); | ||
column_size = size(swap,2); | ||
|
||
temp=swap; | ||
|
||
for i = 1 : line_size | ||
for j = 1 : column_size | ||
temp(i,j,1) = swap(i,j,1)- edge_filter(i,j,1); | ||
end | ||
end | ||
|
||
output = temp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function[output]= binario(input) | ||
|
||
swap=input; | ||
|
||
line_size = size(swap,1); | ||
column_size = size(swap,2); | ||
|
||
temp = swap; | ||
|
||
for i = 1 : line_size | ||
for j = 1 : column_size | ||
if temp(i,j) > 35; | ||
D(i,j) = 255; | ||
else | ||
D(i,j)= 0; | ||
end | ||
end | ||
end | ||
output = uint8(D); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function[output]= complemento_binario(input) | ||
|
||
swap=input; | ||
|
||
line_size = size(swap,1); | ||
column_size = size(swap,2); | ||
|
||
temp = swap; | ||
|
||
for i = 1 : line_size | ||
for j = 1 : column_size | ||
if temp(i,j) == 255; | ||
D(i,j) = 0; | ||
else | ||
D(i,j)= 255; | ||
end | ||
end | ||
end | ||
output = D; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function output = contador(e) | ||
|
||
swap=e; | ||
|
||
line_size = size(swap,1); | ||
column_size = size(swap,2); | ||
|
||
C = swap; | ||
|
||
c =0; | ||
for i = 1 : line_size | ||
for j = 1 : column_size | ||
if C(i,j) == 255; | ||
c = c + 1; | ||
end | ||
end | ||
end | ||
output = c; | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
function[output]= colores(image,color) | ||
|
||
swap=image; | ||
c = color; | ||
line_size = size(swap,1); | ||
column_size = size(swap,2); | ||
|
||
temp = swap; | ||
|
||
for i = 1 : line_size | ||
for j = 1 : column_size | ||
temp(i,j) = swap(i,j,c); | ||
end | ||
end | ||
output = temp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function output = d_mascara(IE,M,EE) | ||
|
||
% E = Imagem erodio M = Mascara EE = Elemento estruturante | ||
|
||
line_size = size(IE,1); | ||
column_size = size(IE,2); | ||
|
||
A = IE; | ||
|
||
for x = 1 : 20; | ||
A = dilatar_g(A,EE); | ||
%figure;imshow(A); | ||
|
||
for i = 1 : line_size | ||
for j = 1 : column_size | ||
if ((M(i,j) == 0) && (A(i,j) == 255)) | ||
A(i,j) = 0; | ||
end | ||
end | ||
end | ||
end | ||
output = A; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
function[saida]= decrease(entrada) | ||
% tem q salvar o arquivo c/ o nome da function | ||
B=entrada; | ||
|
||
tamx = size(B,1); | ||
tamy = size(B,2); | ||
|
||
C = B; | ||
y = 1; | ||
l = 1; | ||
|
||
for i = 1 : tamx/2 | ||
%percorre a linha : | ||
l = i*2; | ||
for j = 1 : tamy/2 | ||
%percorre a coluna nos numeros pares 4,6;... | ||
y=j*2; | ||
%4 => da o valor da claridade | ||
D(i,j) = (B(l-1,y)/4)+ (B(l-1,y-1)/4) + (B(l,y)/4)+ (B(l,y-1)/4); | ||
end | ||
%zera as variaveis de coluna, para evitar o estouro de variaveis | ||
y = 1; | ||
end | ||
%Tem q ser usada a variavel D, e não pode usar C, pois isso faria a foto | ||
%subescrever-se | ||
saida = D; | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
function[saida]= erosion_g(img,elemento) | ||
|
||
B=img; | ||
E=elemento; | ||
|
||
tamx = size(B,1); | ||
tamy = size(B,2); | ||
|
||
tamx_ee = size(E,1); | ||
tamy_ee = size(E,2); | ||
|
||
x_ee = ceil(tamx_ee / 2); | ||
y_ee = ceil(tamy_ee / 2); | ||
|
||
a= tamx_ee - x_ee; | ||
c= tamy_ee - y_ee; | ||
|
||
C = B; | ||
|
||
for i = 1 : tamx | ||
for j = 1 : tamy | ||
g = -a; | ||
h = -c; | ||
if (B(i,j) == 255) | ||
for x = 1 : tamx_ee | ||
for y = 1 : tamy_ee | ||
if(((i + g<=tamx) && (i + g > 0)) && ((j + h<=tamy) && (j + h > 0)) && (E(x_ee + g,y_ee + h) == 0)) | ||
if(B(i+g,j+h) == 0) | ||
C(i,j) = 0; | ||
end | ||
end | ||
h = h + 1; | ||
end | ||
h = -c; | ||
g = g + 1; | ||
end | ||
end | ||
end | ||
end | ||
|
||
saida = C; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
function[output] = histograma(image) | ||
|
||
swap=(image); | ||
|
||
line_size = size(swap,1); | ||
column_size = size(swap,2); | ||
|
||
for c = 1 : 256 | ||
vet(c) = 0; | ||
end | ||
|
||
for i = 1 : line_size | ||
for j = 1 : column_size | ||
vet(swap(i,j)+1) = vet(swap(i,j)+1)+1; | ||
%vet((i+j)-1) = swap(i,j); | ||
end | ||
end | ||
output = bar(vet); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
clc;clear all;close all; | ||
|
||
PATH = ('../img/'); | ||
|
||
I = imread(PATH+'w2.jpg','jpg'); | ||
figure;imshow(I); | ||
|
||
|
||
%% layer | ||
R = cores(I,1); | ||
%figure;imshow(R); | ||
%title('red'); | ||
|
||
B = cores(I,3); | ||
%figure;imshow(B); | ||
%title('Blue'); | ||
|
||
RB = R-B; | ||
figure;imshow(RB); | ||
title('R-B'); | ||
|
||
|
||
%% mathematical morphology | ||
elemento2 =[255,0,255; | ||
0,0,0; | ||
255,0,255]; | ||
|
||
elemento = imread('eee.png','png'); | ||
|
||
B = binario(RB); | ||
figure;imshow(B); | ||
title('binario: RB'); | ||
|
||
BC = complemento_binario(B); | ||
figure;imshow(BC); | ||
|
||
E = erosion_g(BC,elemento); | ||
figure;imshow(E); | ||
title('Erosion'); | ||
|
||
MAS = d_mascara(E,BC,elemento2); | ||
figure;imshow(MAS); | ||
title('MASK'); | ||
|
||
|
||
%% edge detection | ||
P = prewitt(MAS); | ||
figure;imshow(P); | ||
title('Prewitt'); | ||
|
||
|
||
%% result | ||
CPerimetro = contador(P) | ||
CArea = contador(MAS) | ||
|
||
AD = adicao(I,P); | ||
figure;imshow(AD); | ||
title('Resultado'); | ||
|
||
% DI = RB-P; | ||
% figure;imshow(DI); | ||
% title('Dif'); | ||
% | ||
% R = BC - E; | ||
% figure;imshow(R); | ||
% title('R'); | ||
|
||
% H = histograma(RB); | ||
% title('Histograma'); |