4.1875

4.2 | 16 ratings Rate this file 193 downloads (last 30 days) File Size: 3.63 KB File ID: #15491

Shape Recognition

by Ahmed Samieh

 

03 Jul 2007 (Updated 04 Jul 2007)

No BSD License  

differentiate Square, Rectangular, Circle from others

Download Now | Watch this File

File Information
Description

Objective
---------
The program should recognize objects like circles, rectangles, and squares from the input image.

Introduction
------------
This is a shapes classifier based on the properties of each shape, like roundness, ratio of dimensions, centroid,?etc

In this classifier we will recognize only shapes like circles, rectangles, and squares from the input image.
So, we will concentrate on the steps we will follow to recognize those shapes from any input image.

We have seven steps:
1 - Read the RGB (colored) image in from user.
2 - Convert image from (RGB) colored to gray image.
3 - Threshold the image (convert gray image to binary image).
4 - Invert the binary image (in order to speed up the time of processing).
5 - Find the boundaries concentrate.
6 - Determine shapes properties (ratio of dimensions, roundness).
7 - Classify shapes according to its properties.

Input
-----
RGB image have the shapes to recognize.

Output
------
The RGB image with shapes recognized and labeled.

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.0.1 (R14SP1)
Zip File Content  
Other Files test.bmp,
Classify.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (24)
15 Aug 2007 michael scheinfeild

this is very good example how to classify shapes
i think to add also elipse detection
i need to think about it
thw width not equal height
and also it not fill the bounding box but it is true to the other not detected shape so i want to add more criterions

22 Aug 2007 b c

good

10 Sep 2007 Tariq Javid

Excellent, as circle shape classification approach inspired me to work on hexagon generation from an identified circle in an image

17 Sep 2007 mahesh m  
20 Sep 2007 Diego Barragán  
27 Sep 2007 Hammad Arshad

Does not work with images taken by a camera
Gives a lot of squares and circles where it is not needed

28 Sep 2007 Ahmed Samieh

do you know what is the problem ?
the problem is, camera images has noise, so you need to reduce the noise (image enhancement)befor the recognation

26 Oct 2007 Tariq Javid

Good work! This has inspired me a lot. I found it useful for error/noise free autonomous inspection. Another application area may be atifically created images.

28 Oct 2007 imesha kuruppu  
30 Oct 2007 Ahmed Samieh

FAQ:
Q1 - In your program, what do you mean by
Classify Shapes according to properties
% Square = 3 = (1 + 2) = (X=Y + Extent = 1)
% Rectangular = 2 = (0 + 2) = (only Extent = 1)
% Circle = 1 = (1 + 0) = (X=Y , Extent < 1)
% UNKNOWN = 0
---------------
A1 -
the answer of (X == Y) ---> true or false ---> 1 or 0
X is the X-dimension and Y is the Y-dimension
so i check if X-dimension equal Y-dimension of the object
if true it will give 1 else it will give 0
in 8-bit binary integer it will be 00000001 or 00000000 (equ 1)
ok....
again with (Extent = 1) ---> 1 or 0
multiply the result by 2 will give 2 or 0
in 8-bit binary integer it will be 00000010 or 00000000 (equ 2)
ok...
adding the result of (equ 1) and (equ 2) give
 
    00000011 (3) ---> 00000010 (2) (Extent equal 1) + 00000001 (1) (X-dimension equal Y-dimension)
or 00000010 (2) ---> 00000010 (2) (Extent equal 1) + 00000000 (0) (X-dimension not equal Y-dimension)
or 00000001 (1) ---> 00000000 (0) (Extent not equal 1) + 00000001 (1) (X-dimension equal Y-dimension)
or 00000000 (0) ---> 00000000 (0) (Extent not equal 1) + 00000000 (0) (X-dimension not equal Y-dimension)

02 Nov 2007 Hrushikesh Kulkarni

extremely good job
and quite inspiring work

thanks

30 Nov 2007 kevin scott basinio

its good

25 Jan 2008 RAJALAKSHMI ALAGIAMANAVALAN

Hi,I have interest to view this file.Thankyou.

31 Jan 2008 Aamir langah

thank you very much for your contribution which is helpful for the most of students of image processing field

06 Feb 2008 aymen sellaouti

Think you very much for your contribution

31 Mar 2008 Rocky Hurray  
09 Apr 2008 Nutthasit Laosuwan

good

29 Apr 2008 chen cuicui  
14 May 2008 bharathi v

nice to see this one .thank you

23 Jun 2008 Christian Stewart

Its very useful for me. Can you tell me how Triangle can be recognized in similar way??

15 May 2009 long yi

很好!

22 Jul 2009 Jun wan  
03 Nov 2009 vsrin2 srin

Good program. I would like to output the black and white images (intermediate step) to a data file showing only 0 and 1's. how can i do it?

16 Nov 2009 Alireza Saberi

nice

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
image analysis Ahmed Samieh 22 Oct 2008 09:18:05
shape properties Ahmed Samieh 22 Oct 2008 09:18:05
analysis Ahmed Samieh 22 Oct 2008 09:18:05
recognition Ahmed Samieh 22 Oct 2008 09:18:05
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com