Curso:
Profesor:
Telles
Estudiantes:
Asencios Romero Hover Abel
cdigo: 060927D
Cancho Puse Erick Eduardo
cdigo: 1113210121
Felix Ramos Luis Felipe
cdigo: 1113220048
Panizo Boza Angel Xiomar
cdigo: 1113210077
DIAGRAMA DE
BLOQUES:
PREVISUALIZACION DE
LA IMAGEN A
PROCESAR
CAPTURA DE IMAGEN,
HACIENDO USO DE LA
CAMARA WEB
FILTRADO DE LA
IMAGEN
CONVERSION A
IMAGEN BINARIA
CONTEO DE LENTEJAS
DE ACUERDO AL
COLOR
DIAGRAMA DE FLUJO:
INICIO
FIN
INTERFAZ VISUAL
EJEMPLO
ROJO
VERDE
AZUL
PROGRAMA:
function varargout = color_conteo_RGB(varargin)
% COLOR_CONTEO_RGB MATLAB code for color_conteo_RGB.fig
%
COLOR_CONTEO_RGB, by itself, creates a new COLOR_CONTEO_RGB or raises the
existing
%
singleton*.
%
%
H = COLOR_CONTEO_RGB returns the handle to a new COLOR_CONTEO_RGB or the handle
to
%
the existing singleton*.
%
%
COLOR_CONTEO_RGB('CALLBACK',hObject,eventData,handles,...) calls the local
%
function named CALLBACK in COLOR_CONTEO_RGB.M with the given input arguments.
%
%
COLOR_CONTEO_RGB('Property','Value',...) creates a new COLOR_CONTEO_RGB or
raises the
%
existing singleton*. Starting from the left, property value pairs are
%
applied to the GUI before color_conteo_RGB_OpeningFcn gets called. An
%
unrecognized property name or invalid value makes property application
%
stop. All inputs are passed to color_conteo_RGB_OpeningFcn via varargin.
%
%
*See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
%
instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help color_conteo_RGB
% Last Modified by GUIDE v2.5 08-Dec-2014 13:14:07
% Begin initialization code - DO NOT
gui_Singleton = 1;
gui_State = struct('gui_Name',
'gui_Singleton',
'gui_OpeningFcn',
EDIT
mfilename, ...
gui_Singleton, ...
@color_conteo_RGB_OpeningFcn, ...
=
=
=
=
rgb2gray(I);
I(:,:,1);
I(:,:,2);
I(:,:,3);
%%%%%%%%%%%%%%%%%%%ROJO%%%%%%%%%%%%%%%%%%%%%%
red_im = R-Iq;
%Aislaminto de capa roja
red_im = medfilt2(red_im, [3 3]); %filtro mediana
red_im = im2bw(red_im,0.03); %imagen binaria
red_im = bwareaopen(red_im,100); %Filtro para pixel menores a 100
V=8;
%Contante que se involucra con el grosor del contorno de la imagen
im_edge=edge(red_im,'sobel'); % filtro para visualizar solo bordes
SE2=strel('square',V);
%Grosor de los bordes
im_erode=imerode(not(im_edge),SE2); %Solo deja de color negro los borde el resto es de
color blanco
[L,Ne]=bwlabel(im_erode); %numero de objetos
prop=regionprops(L);
%Propiedades de la imagen
%LENTEJAS PARTIDAS
a=0;
for n=1:length(prop)
x=prop(n).Area;
%Area de los objetos
if x<500 && x>200
%Condicional para conteo
a=a+1;
%Acumulador
end
end
set(handles.rojop,'string',a); %Muestra el nuemro de objetos en el TEXT
g=0;
for n=1:length(prop)
x=prop(n).Area;
%Area de los objetos
if x<3000 && x>600 %Condicional para conteo
g=g+1;
%Acumulador
end
end
set(handles.rojo,'string',g);
%Muestra el nuemro de objetos en el TEXT
%%%%%%%%%%%%%%%%%%%VERDE%%%%%%%%%%%%%%%%%%%%%
green_im = G-Iq;
%Aislaminto de capa verde
green_im = medfilt2(green_im, [3 3]); %filtro mediana
green_im = im2bw(green_im,0.03); %imagen binaria
green_im = bwareaopen(green_im,100); %Filtro para pixel menores a 100
V=8;
%Contante que se involucra con el grosor del contorno de la imagen
im_edge=edge(green_im,'sobel'); % filtro para visualizar solo bordes
SE2=strel('square',V);
%Grosor de los bordes
im_erode=imerode(not(im_edge),SE2); %Solo deja de color negro los borde el resto es de
color blanco
COMENTARIO Y CONCLUSIONES
Se concluye que para el presente trabajo fue fundamental el uso de
iluminacin, teniendo en cuenta la posicin de la misma.
El valor de la las capas RGB varan dependiendo al ngulo de incidencia de
la luz respecto al rea iluminada.