Designing an Optimization of Orientation System toward Moving Object in 3-Dimensional Space Using Genetic Algorithm

This research offers a scheme of orientation system toward moving object in 3-dimensional space that using Stereo Vision Camera. The system benefits in giving an alternative solution in projecting practically without manual identification by conventional measuring device. The result of the projection in the system is in the form of coordinate position information (x, y, z), the length, the width, and the height of the object detected. The output displayed in the real-time digital image with 3-dimensional modeling. In the process of the object identification, there was a stage when an image was converted from colored image to binary image. But the conversion used the threshold method which was considered less efficient when an object moved. As consequence, the new adaptive method in solving the problem was needed. Genetic Algorithm was proposed as the optimization method because it was considered suitable with the emerging problems. In the optimization process, genetic algorithm was in a task of searching process and determining the threshold value as the process of creating binary image. The result shows an increased accuracy in the identification process after the system had been optimized by the Genetic Algorithm (GA).


I. INTRODUCTION
Efficiency and optimization become priority in technology development with no exception in the digital image processing.Nowadays, the application system of the image processing is commonly used for various purposes, either in the industry or in daily life.Hence, various methods are developed to maximize the function of the image processing; one of them is the development of orientation system toward moving object using camera in 3-dimensional space.
The orientation system using camera in 3dimensional space is an alternative solution to obtain the information of an object without manual identification by using conventional measuring devices such as a ruler or the like.The information requested is the characteristics or the identities of the object which consist of colors, shapes, sizes, and positions [1].There are some methods can be used to project an object in 3-dimensional space such as the use of electronic sensor, radar, and camera [2].In this research, the method of using camera is selected to be developed in case of the practicality in installation and the better accuracy in identification.Therefore, it is expected to give the more maximum result [3].
The identification using camera still has some disadvantages such as the system often make a failure or error in defining object.The failures caused by many factors, starting from the lack of lighting, the similarity with the objects around, the changing object position, to the different points of view that sometimes causing the difficulty of the system to recognize the object properly [4].Thus, optimization is needed to increase the accuracy in the identification process.
The optimization in this research is an aim to increase the accuracy in the identification process by optimizing the searching process and determining the threshold value in the binary image process.The Genetic Algorithm is proposed as the optimization method that is able to provide the efficiency in the optimization solution.The Genetic Algorithm is the adaptive method commonly used to solve the searching value in the optimization problem [5].In this research, the Genetic Algorithm acted as the fastest method to determine the threshold value in the digital image analysis.
The designing system in this research uses stereo vision method in the image retrieval process.The stereo vision itself is the placement of two parallel cameras in which separated by a distance as human eyes [6].This method was used as the input for the next process namely the identification process using the image processing method.The processing image in this research is a part of the Automatic Object Identification process or better known as Computer Vision.
Computer Vision is a method that includes obtaining, processing, analyzing, and understanding visual data such as picture and video.The main purpose of the Computer Vision in this research is a computer or a machine that be able to mimic the perceptual abilities of human eye and brain to define object clearly [7].Some important functions which contained in the computer vision in the processing image are image acquisition, image analysis, image processing and image understanding [8].Thus, the use of the Computer Vision as a method for processing image and genetic algorithm as an optimization method allows it to provide accurate information in projecting the form of an object.

II. RESEARCH METHOD
The Basic concept in this research is to optimize the system in projecting moving object in 3dimensional space which is the output of the projecting system in the form of information of 3dimensional coordinate position as the length, the width, and the height of the object detected.The output displayed in the real-time digital image display with 3-dimensional modeling display.The optimization was processed during the finding process and the determination of the threshold value to process the binary image.In detection process, it was used to minimize the errors in recognizing and projecting an object.
The hardware and the software that were used in the processing image are Personal Computer (PC) with Phyton programming language and Library OpenCV.The system design applied in this research was divided into 5 main parts; those are image retrieval process, identification process, optimization process, position determining process, and 3dimensional modeling process.The system diagram in this research can be seen in Fig. 1.The stages carried out to achieve the expected results in this research are described in more details as follows:

A. Image Retrieval
The initial process of the research was entering an input to the system in form of digital image.The digital image retrieval method used was stereo vision.Stereo vision is the image retrieval method in which using two cameras that placed parallel in certain distance.The aim of the method is to mimic the way human eyes work which can see an object in its entirety.This was possible because the two cameras had different points of view in interpreting the shape of an object [9].The use of stereo vision in this research aims to support the identification process in the process of achieving the depth impression value of an object in 3-dimensional space by x, y, and z.Then, the values were used as reference to determine the real position, the length, the width, and the height.The image retrieval process used the stereo vision method which was designed using two webcams with a resolution of 640 x 480 pixel which were placed parallel in a distance of 10 cm and a height of 22 cm above floor level and also a slope angle of 45º, while the object to be identified was a beam with a length of 24 cm and a width of 4.5 cm as shown in Fig. 2. The output of the stereo vision camera was two RGB images with a resolution of 640x480 pixels from each camera (left and right).The output is shown in Fig. 3.

Left camera
Right camera Before the image retrieved, the two cameras were calibrated to determine the intrinsic of each camera which later would become a parameter in the process of positioning object in 3-dimensional space.The stereo vision calibration process was done using a chessboard by utilizing the library that had been provided in the OpenCV program.The flow diagram of the calibration process can be seen in Fig. 5. Data obtained from the calibration process were focal length (f) and coordinate system (u,v).

B. Object Identification
The object identification process in first step was converting the colored image (RGB) obtained from the image retrieval process into an image of Hue, Saturation, Value (HSV).This process was done because the threshold result that was obtained on HSV image was better than the result obtained by threshold process on RGB image [10].The conversion from RGB into HSV used OpenCV image processing program based on the following equation: After an RGB image was converted into a HSV image, the next step was to convert HSV image into a binary image.Binary image was needed to reinforce the shape of the object against the background in a 2dimensional scene for easy identification.Binary image consists of only two colors, black and white, which black represents an object and white represents the background.The process of converting HSV images into binary images was done using an image processing program by utilizing Library OpenCV.The converting process of the flow diagram from HSV image into binary image is shown in Fig. 6.On the trackbar feature, the HSV value setting was obtained as follows: From the setting of the HSV value, the binary image generated as shown in Fig. 8.The use of the trackbar feature might be conducted if the object was in a stationary state with constant lighting and this was not possible if the object moved in the real-time.The real-time motion caused the threshold value to change along with the motion of the object, so that the settings on the trackbar feature continued to be set in every time the object moved.This changing caused the inefficient of the system in the identification process.

C. Optimization
Based on the result of the object identification, there was a problem in determining the threshold value when the object moved in the real-time.So, the optimization method was needed to overcome this problem.Genetic algorithm was selected to be used as an optimization method in determining the threshold value.Genetic algorithm is an adaptive method that is commonly used to solve the value research in the optimization problem [11].This algorithm is laid on the genetic processes that exist in living things.Genetic Algorithm uses an analogy of the natural habits, natural selection, directly.In principle, Genetic algorithm applies evolutionary method to produce new individuals who are better than previous individuals.The initial process of Genetic algorithm is to make a selection process for each individual based on his fitness value [12].Individuals who pass the selection process are individuals who have a fitness value that reach predetermined standard value and he will be in the process of interbreeding (crossover) [13].The process of interbreeding is by which selected individual is mated with the other selected individual to give birth in a better offspring [14].The working principle of the genetic algorithm in the research is illustrated in Fig. 9.The initial process in genetic operation was population initialization.The population was generated by classifying several selected chromosomes randomly.In this research, the number of chromosome consisted of 10 chromosomes with the threshold value that was varied between 0-255 as shown in Table 2.The fitness value was used to determine the binary image in the threshold process.If the fitness value of an individual reaches 1 or close than the pixel will be converted into black, and vice versa if it does not reach the value of 1 then the pixel will be converted into white.To calculate the fitness value used the following formula: Selection was applied to a chromosome scale that was intended to select others that were considered not being needed.This elimination system used two variables, namely Elimination Threshold and Fitness Value.If the chromosome has similarities with other chromosomes, the chromosomes that are considered less productive will be eliminated.By this stage, it produced two chromosomes that considered as the best.The following are the equations from the elimination threshold calculation: Two chromosomes obtained from the selection were used as sires to produce one new breed.The method used for crossover was one cut point crossover.

e) Mutation
The mutation process was made to reshape the missing chromosomes in the selection process and combined them with the crossover chromosomes to make a new population.

D. Positioning
After the identification process complete, the next process was to determine the position, the side size, and the 3-dimensinal space coordinate of the object detected by looking for the value of x, y, and z.The first process was to define two axes that were mutually perpendicular to each other, and were at the same field (x, y field).The horizontal axis was labeled x, and the vertical axis was labeled y.The other axis was labeled z as shown in Fig. 10.To determine the 3-dimensional coordinate, the method of the Principal of distance measurement was used; so that the z coordinate (the distance of the object to the camera) could be calculated using the following equation [11].

= (7)
Where: Dz = z coordinate.L = The distance between the two cameras.PL = The angle between the optical axis in a straight line of left camera toward the object.PR = The angle between the optical axis in a straight line of right camera toward the object.
The process of positioning can be seen in detail in Fig. 11.The angle of PL and the angle of PR were known through the following equation: Where : ut = Camera center point (x coordinate).vt = Camera center point (y coordinate).p = Pixel size.F = Focal length camera.
Therefore, z coordinate (the distance of the object to the camera) was identified using the following equation: After the z coordinate was known, then looking for the x and y coordinate which were the vertical and the horizontal distance of the object to the camera used the same triangle equation as follows: Where : z = The distance of the object to camera f = Focal length camera.u = The object position that was caught on x axis.v = The object position that was caught on y axis.

E. 3-Dimensional Modeling
The Next process was creating 3-dimensional object.At this stage, the 2-dimensional scene as the result of threshold was converted into 3-dimensional space in order to be able to interpret the actual shape by giving a line-edge to each edge in a purpose to make the object in 3-dimensional looked.The edge part determination used Canny Edge Detection method.Canny Edge Detection method is a method used to detect edges with a Convolution approach toward the matrix image function and Gaussian operator [15].The process of Canny Edge Detection was built using the library that had already available in the OpenCV program.The result of the Canny Edge Detection can be seen in Fig. 12.

A. Identification Results
The experiment was conducted using a white beam-shaped object with a length of 24 cm and a width of 4.5 cm of several positions (moving).The result obtained after testing the system that had not been optimized can be seen in Fig. 13.Retesting was conducted toward the system that had been optimized by Genetic Algorithm.The result obtained can be seen in Fig. 14.

B. Result of Positioning
The test was conducted by put the object on the camera view with the predetermined distance.The data collection scheme can be seen in Fig. 17   After the testing several times, the results of the average measurements made by the system can be seen in Table 3.

C. 3-Dimensional Modeling Results
The interface result of the 3-dimensional model that had been made can be seen in Fig. 19.

A. Object dentification and Optimization
The test was conducted in a room in bright light condition, dim light condition, and normal light condition.There was a difference in accuracy of the system that had not been optimized and the system that has been optimized by Genetic Algorithm.In the system that had not been optimized (Fig. 13), the result obtained was not in a maximum result.Some sides of the object became dark because they were blocked and caused dark parts to be detected as background so that the whole shape of the object was not detected properly.While on the system that had been optimized (Fig. 14), it had better detection accuracy than the system before the optimization.The accuracy result of the object detection was achieved by calculating the average of increasing pixels in the system by before and after the optimization; the result is shown in Fig. 15 and Fig. 16.

B. Positioning
In the Fig. 18, the test was conducted to determine whether the value of the coordinates (x,y,z) of the object by the system obtained matched the value of the coordinates of the actual object.According to the results in the Table 2, the error value obtained is only 5.64 %.

C. 3-Dimensional modeling
The 3-dimension modelling was built by library in the OpenCV program that was based on the result of the operation of canny edge detection.In the Fig. 18, there are 3 rectangles; the first rectangle (green) was formed based on the total area of the object detected to display the coordinate object.The second rectangle (red) was formed to detect the sides of the object to be calculated in the length and the width.For the third rectangle (blue) was formed to detect the sides of the uncalculated object of the length and the width.Giving the size values to the rectangles was based on the results of positioning.

V. CONCLUSSION
Based on the result of the overall system testing, it is concluded that the Genetic Algorithm can optimize the projection process of the moving object in 3dimensional space in the way of optimizing the searching value of threshold in binary image forming of the detection process.The result is validated from the comparison of the system before and after the optimization, in which the result of the optimized system shows the level of accuracy of the truth in detecting object is better with an average increase of 53.26 %.Whereas in the positioning process, the result obtained is also quite good with an error value of only 5.64 %.As for the factors that caused errors are the distance of detection that approaches the maximum distance, so that, the object is not detected properly.

Fig. 2 .
Fig.2.The Design of Stereo Vision Camera.(a) The Front View Camera, (b) The Sideways View Camera

Fig. 3 .
Fig.3.RGB Images Were Taken by Stereo Vision Camera

Fig. 6 .
Fig.6.The Converting Process of the Flow Diagram from HSV Image Into Binary Image

Fig. 8 .
Fig.8.The Changing Result from HSV Image Into Binary Image

Fig. 9 .
Fig.9.The Working Principle of the Genetic Algorithm

Fig. 11 .
Fig.11.The Geometric Relationship to Measure the Distance of the Object to the Camera

Fig. 13 .
Fig.13.The Result of the Object Detection Before the Optimization.

Fig. 14 .
Fig.14.The Result of the Object Detection after the Optimization

Fig. 17
Fig.17.The Coordinate Data Retrieval Scheme Fig.17.The Coordinate Data Retrieval Scheme

Table 1 .
HSV Value for Threshold.

Table 3 .
The Result of Testing the Distance of the Camera to the Object.