Algorithms of Distance, Color & Shape Detection For 2-D Images
Algorithms of Distance, Color & Shape Detection For 2-D Images
Volume: 4 Issue: 5 72 - 77
_______________________________________________________________________________________________
Algorithms of Distance, color & Shape Detection for 2-D Images
1
V.K.PATIL 2Gajanan Alaspure 3Trupti Jakkulwar 4Ganesh Pawar, 5Aishwarya Bajoriya, 6Sampada Bulbule
1
Asst.Prof,Department of E&TC AISSMSs IOIT,Pune, Maharashtra, India
2,3,4,5,6
Students,Department of E&TC AISSMSs IOIT,Pune, Maharashtra, India
AbstractThis paper represents our work on non contact distance calculation method. It is based on pixel variation of 2D images.
This can be done by referencing two points in the image frames. The methodology of distance calculation starts with capturing of
particular object image from any distances. Again capture another image of same object with some known distance. If an object
goes far from the camera the object has a reduced size in the image. As the object moves closer to the camera the object becomes
comparatively bigger. Thus we get the variation of pixel size between two images. Using the pixel variation we can calculate the
distance of the object from the camera .This paper focuses on recognition of 2D shapes of objects such as square, circle, triangle,
rectangle and ellipse as well as colors of objects. The algorithm was simulated and developed using MATLAB.
Keywords2D Images, Image processing, MATLAB, Extent, Bounding Box, Object detection, Digital Camera, Shape and color
recognition, non contact distance measurement.
__________________________________________________*****_________________________________________________
72
IJRITCC | May 2016, Available @ http://www.ijritcc.org
________________________________________________________________________________________________________
International Journal on Recent and Innovation Trends in Computing and Communication ISSN: 2321-8169
Volume: 4 Issue: 5 72 - 77
_______________________________________________________________________________________________
Fig.1. Schematic diagram of distance calculation of object from camera using pixel variation
So the relation between distances and pixel count can be given as:
1
= (1)
1
2
= (2)
2
(1) 2
= (3)
2 (1)
Because there is a displacement, h=h1-h2,i.e. from the camera movement along the photographic directions [2]. Hence we can
write as:
(1) 2 1+
= = (4)
2 (1) 2+
1
2 = (5)
2 (1)
In a Similar way, if camera moves in forward direction then photographic distance becomes:
2
1 = (6)
2 (1)
In the above equation, value of h- hs is known to us so that the distance is calculated [2].
73
IJRITCC | May 2016, Available @ http://www.ijritcc.org
________________________________________________________________________________________________________
International Journal on Recent and Innovation Trends in Computing and Communication ISSN: 2321-8169
Volume: 4 Issue: 5 72 - 77
_______________________________________________________________________________________________
III. ANGLE AND DISTANCE MEASUREMENT FOR THE method. Here we include angle measurement for the objects
OBJECT having oblique plane,. The accuracy using angle
measurement will also be greater.
Distance measurement by using the above mentioned
technique is only applicable for the objects that are exactly Fig.2 shows the schematic of measurement of object distance
perpendicular to the optical origin of the camera. It is on an oblique plane based on pixel variation.
possible to calculate distance for the objects which are
perfectly perpendicular by using the above mentioned
As shown above there exists an angle i.e. m between the perpendicular and oblique plane. In the figure, point B is much far as
compare to point A. Hence it is not possible to calculate distance by using above mentioned method [2].
To solve the above mentioned method, concept of virtual planes used. Consider the two virtual plane VP_A and VP_B [2].
Therefore the distance between virtual planes and camera can be given by:
2
1 = (7)
1 2
1
2 = (8)
1 2
2
2 = (9)
1 2
74
IJRITCC | May 2016, Available @ http://www.ijritcc.org
________________________________________________________________________________________________________
International Journal on Recent and Innovation Trends in Computing and Communication ISSN: 2321-8169
Volume: 4 Issue: 5 72 - 77
_______________________________________________________________________________________________
1
2 = (10)
1 2
Here h1(B) and h1(A) are respectively the distances from camera 1 to virtual planes VP_B and VP_A [2]. Similarly h2(B) and
h2(A) are respectively the distances from camera 2 to virtual planes VP_B and VP_A. From (7) and (10),
1 1 = 2 2
= + . (11)
= tan 1 (12)
+
In the above equation k is nothing but the distance between virtual points .dA and dB can be expressed as follows:
21 2
= (13)
2 1
21 2
= (14)
2 1
The distance between points A and B can be represented to examine the position of an real world object. This distance can be
represented as D(AB):
= + (15)
Thus using the above equation it is possible to calculate the distance of an oblique plane.
Observation Table
Object
Shape Camera
movement Actual Observed
Color distance Distance Distance
Triangle Orange 10 46 48.21
Ellipse Orange 5 56 61.211
Rectangle Yellow 15 60 62.109
Square Blue 8 40 41.339
Circle Green 10 46 47.465
Fig.4: Flowchart for shape detection and color detection Fig.6: Setup
76
IJRITCC | May 2016, Available @ http://www.ijritcc.org
________________________________________________________________________________________________________
International Journal on Recent and Innovation Trends in Computing and Communication ISSN: 2321-8169
Volume: 4 Issue: 5 72 - 77
_______________________________________________________________________________________________
ACKNOWLEDGMENT [2] Chen-Chien James Hsu, Ming-Chin Lu, Yin-Lu yu on
Distance measurement based on pixel variation of CCD
Our work is done under the guidance of Prof. V. K. Patil. Images.
We would like to thank her for the suggestion to perform [3] Carullo A, Ferraris F, Graziani S. Ultrasonic distance
sensor improvement using a two level neutral network.
shape detection, color detection and distance calculation IEEE Transaction on Instrumentation and measurement.
on 2D images. We also like to thanks AISSMS IOIT, PUNE [4] C.C. Hsu and M.C. Lu, , Angle and distance
for providing the resources. measurement of distant objects based on pixel variation
of CCD images. May 36, 2010, pp. 318322.
REFERENCES [5] Song KT, Tang WH. Environment perception for a
mobile robot using double ultrasonic sensor and a CCD
[1] Chen-Chien James Hsu, Ming-Chin Lu and Yin-Lu camera.
Yu,Angle and distance measurement of objects on an [6] G. Borgefors, Distance transformations for arbitrary
oblique plane based on pixel number variation of CCD dimensions Dig. Image Processing, Graphics, and
images computer vision, no. 3, val 27, pp. 321345, September
1984. oblique plane based on pixel number variation of
CCD images
77
IJRITCC | May 2016, Available @ http://www.ijritcc.org
________________________________________________________________________________________________________