
Detector de taches y cuadrados
Publicado por daniel (1 intervención) el 17/08/2021 00:11:13
Hola buenas tardes espero que pueda ayudarme con esto
Quiero detectar taches y cuadrados usando la vision de matlab, pero no me detecta aun el cuadrado.
Alguien me puede apoyar con eso?
Quiero detectar taches y cuadrados usando la vision de matlab, pero no me detecta aun el cuadrado.
Alguien me puede apoyar con eso?
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
clear all;
close all;
clc;
%Parametros de configuracion de la camara
cam=ipcam('http://192.168.68.102:8080/videofeed')
preview(cam)
%pause(5)
%Tomamos foto
E = snapshot(cam);
EG = rgb2gray(E);
EGF = medfilt2(EG);
BW = im2bw(EGF);
BW1 = edge(EGF,'sobel');
BW2 = edge(EGF,'canny');
stats = regionprops(BW,'Perimeter','Area','Centroid','BoundingBox');
figure(1);
imshow (BW);
%Deteccion de formas
hold on
for k=1: length(stats)
thisboundingbox=stats(k).BoundingBox;
if stats(k).Area <0
rectangle('Position',[thisboundingbox(1),thisboundingbox(2),thisboundingbox(3),thisboundingbox(4)], 'EdgeColor', 'b','LineWidth',2);
else
rectangle('Position',[thisboundingbox(1),thisboundingbox(2),thisboundingbox(3),thisboundingbox(4)], 'EdgeColor', 'r','LineWidth',2);
end
if stats(k).Perimeter^2/stats(k).Area < 15
text(stats(k).Centroid(1),stats(k).Centroid(2), '* Ciculo','Color', 'r');
end
end
pause (10)
%Mostramos imagen
figure(2)
subplot(1,3,1); imshow(E);
title('Imagen Original');
subplot(1,3,2); imshow(BW);
title('Imagen blanco y negro');
%subplot(1,3,3); imshow(BW1);
%title('Contornos de las figuras');
subplot(1,3,3); imshow(BW2);
title('Contono suaves');
clear all
Valora esta pregunta


0