Matlab Y Aplicaciones Graficas

Páginas: 2 (386 palabras) Publicado: 18 de febrero de 2013
Task 3
Counting objects within images

Step 1
• An image is choosen so that
it has considerable contrast
with its background so that
the objects can be
identified. The function
imread readsthe image
from a given location and
stores it in the matrix img1.
The imshow function
displays the image.
img1=imread('Lines.jpg');
imshow(img1)

Step 2
• Convert the Image to
Grayscale
•This step removes any color
information in the image to
make it easier to identify
objects. The rgb2gray
converts the color image
into a grayscale image and
stores it into the matrix
img2.img1=rgb2gray(img1);
imshow(img1)

Step 3
• Threshold the image
• This step thresholds the image by
converting the grayscale image into
an image that contains only two
colors. The functionim2bw() assigns
black color to all the pixels that have
luminosity than a threshold level and
the others as white. the function
graythresh() approximately calculates
the threshold of the image.img2=im2bw(img1,graythresh(img1));
imshow(img2)



Step 4
• Complement the image
• In this step we complement
the image by using the ~
operator. By this we convert
the white patches into blackand vice versa. We perform
this step as we wanted the
areas of concern(objects) to
be colored white.
img2=~img2;
imshow(img2)

Step 5
• Step 5
• Find the Boundaries of the Objects
• Thisstep finds the boundaries of
each object that it finds and stores it
in B. The text function prints the
number of objects that are found by
bwboundaries.
B = bwboundaries(img2);
imshow(img2)text(10,10,strcat('\color{green}Obje
cts Found:',num2str(length(B))))
hold on


Step 6: Finish
• Draw the Boundaries

This is a fun step in which
we mark the boundaries of
all the objectsidentified by
bwboundaries function.
This step can be eliminated
if it seems complicated
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2),
boundary(:,1), 'g', 'LineWidth',
0.2)
end...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Grafica en matlab
  • Graficas MATLAB
  • Graficas En Matlab
  • Gráficas en MATLAB
  • Graficas Matlab
  • graficos matlab
  • Graficando En Matlab
  • Graficos MatLab

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS