<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">ICA</journal-id><journal-title-group><journal-title>Intelligent Control and Automation</journal-title></journal-title-group><issn pub-type="epub">2153-0653</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/ica.2015.61001</article-id><article-id pub-id-type="publisher-id">ICA-53164</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Computer Science&amp;Communications</subject><subject> Engineering</subject><subject> Physics&amp;Mathematics</subject></subj-group></article-categories><title-group><article-title>
 
 
  Research on Workpiece Sorting System Based on Machine Vision Mechanism
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>uan</surname><given-names>Yan</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Huibin</surname><given-names>Yang</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib></contrib-group><aff id="aff1"><addr-line>College of Mechanical Engineering, Shanghai University of Engineering Science, Shanghai, China</addr-line></aff><author-notes><corresp id="cor1">* E-mail:<email>aliceyan_shu@126.com(UY)</email>;</corresp></author-notes><pub-date pub-type="epub"><day>13</day><month>01</month><year>2015</year></pub-date><volume>06</volume><issue>01</issue><fpage>1</fpage><lpage>9</lpage><history><date date-type="received"><day>14</day>	<month>November</month>	<year>2014</year></date><date date-type="rev-recd"><day>accepted</day>	<month>28</month>	<year>December</year>	</date><date date-type="accepted"><day>13</day>	<month>January</month>	<year>2015</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
  This paper describes industrial sorting system, which is based on robot vision technology, introduces main image processing methodology used during development, and simulates algorithm with Matlab. Besides, we set up image processing algorithm library via C# program and realize recognition and location for regular geometry workpiece. Furthermore, we analyze camera model in vision algorithm library, calibrate the camera, process the image series, and resolve the identify problem for regular geometry workpiece with different colours. 
 
</p></abstract><kwd-group><kwd>Machine Vision</kwd><kwd> Industrial Robot</kwd><kwd> Target Recognition</kwd><kwd> Image Processing</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Introduction</title><p>With the development of society, enterprises have become increasingly demanding on production automation, so that more and more industrial robots have been used in automated production lines. For example, in order to enhance operational efficiency in modern logistics distribution centers and to improve the efficiency of large- scale centralized distribution to reduce operating costs, as the core equipment distribution center and the main operating procedures, sorting systems and sorting operation efficiency and technology are increasingly by theorists and engineering concern. Another example is the tool change robot in the machining center. Compared to ma- nual tool change method, this tool works more quickly and more accurately, greatly reduces tool change time and increases production efficiency. In the automotive industry, due to the auto parts more complex vehicle bodies, in many cases on the body cannot use manual welding. Currently, automobile manufacturers utilize a lot of body welding robots to improve product quality and to reduce the labor intensity. Visibly, doing the work on the production line with industrial robots is an inevitable trend.</p><p>Machine vision technology uses cameras and computers to simulate human vision features, which are widely used in electronics, aerospace, automotive and automotive parts manufacturing industry, the pharmaceutical industry and electronics fields [<xref ref-type="bibr" rid="scirp.53164-ref1">1</xref>] . In the traditional production line, sorting artifacts with industrial robots usually uses teaching methods or offline programming operations. All the actions and placements, etc. should be strictly preset. Once the working environment or condition changes, it will affect the efficiency and accuracy of crawling robot, unable to meet the high-speed production of large quantities. Introduction of machine vision in industrial production can greatly improve productivity and reduce costs. Industrial machine vision technology based on sorting system with high detection speed, high reliability, and high real-time, compared to traditional mechanical sorting, is more intelligent, more efficient and has other irreplaceable advantages.</p><p>This paper researches the sorting system based on the machine vision and the methods of camera calibration. The straight linear method is used and the system is simulated by Matlab. It also studied the correlation of image processing algorithms, combined thresholding proposed centroid location method to solve the different colors of regular geometric shape of the workpiece recognition problem. Threshold segmentation and edge detection method can lock the workpiece area; centroid location can accurately locate the geometric center of the workpiece. And this integrated approach can effectively solve the regular geometric shape of the workpiece sorting problem.</p></sec><sec id="s2"><title>2. Sorting System Based on Machine Vision Hardware Architecture Artifacts</title><p>In this paper, the mechanical axis motion platform, is built on the work of sorting machine vision systems. Overall system structure is shown in <xref ref-type="fig" rid="fig1">Figure 1</xref>.</p><p>The hardware platform consists of mechanical three-axis motion platform, camera platforms, PC and motion control unit, four major components. Hardware platform package sorting system is shown in <xref ref-type="fig" rid="fig2">Figure 2</xref>.</p><p>Mechanical three-axis motion platform: Using screw-nut mechanism, while the linear guide linear motion needs as a guide and support. The system uses a servo motor drive: although the control unit is complex, the high repeat accuracy, no step phenomenon and no cumulative error [<xref ref-type="bibr" rid="scirp.53164-ref2">2</xref>] .</p><fig-group id="fig1"><label><xref ref-type="fig" rid="fig2">Figure 2</xref></label><caption><title> Workpiece sorting system based on machine vision hard- ware platform.</title></caption><fig id ="fig1_1"><label></label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/1-7900369x5.png"/></fig><fig id ="fig1_2"><label></label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/1-7900369x6.png"/></fig></fig-group><p>Camera Platform: Camera platform unit is mainly constructed by MV-2000UC camera and light source com- ponents. Hanging bracket role monocular camera is to obtain the experimental stage of the video image of the workpiece. White LED surface light source provides light for digital cameras captured images. The light will be fixed at the top of the workpiece in order to eliminate the shadow of the workpiece itself.</p><p>PC: Using existing laboratories as a PC, since the development environment is good, fast, easy to operate and low cost. At that time with respect to the IPC, its anti-interference ability and stability is poor, such as teaching or laboratory for stable work environment occasions. PC camera platform receives the experimental stage to obtain a video image of the workpiece using the vision system to identify the target species, the centroid of the workpiece is then calculated, and finally the image according to the relationship between the coordinate system and the object coordinate system, the calculated position of the target relative and direction, and then passes the information parameter to the control unit.</p><p>Motion Control unit: mainly control the composition of the cabinet and robots. It is responsible for the para- meters analyzing, then the robot-related operations and finally the completion of the target workpiece sorting grab and place.</p></sec><sec id="s3"><title>3. Camera Calibration</title><p>Camera calibration is one of the important parts in machine vision [<xref ref-type="bibr" rid="scirp.53164-ref3">3</xref>] . Calibration includes calibration camera and visual systems. First of all based model of the camera, and then to establish the relationship between the coordinate system, and finally through the calibration can establish the correspondence between image pixels and the spatial three-dimensional coordinates [<xref ref-type="bibr" rid="scirp.53164-ref4">4</xref>] . Workpiece sorting system is based on machine vision. The camera calibration as a key link to other related work is a prerequisite for the smooth conduct of the direct impact on subsequent sorting processes. Camera calibration process is based on the model of the camera imag- ing process to solve internal and external camera parameters, and these parameters determine the correspon- dence between the image pixel point and three-dimensional coordinate space.</p><p>There are many ways in camera calibration, the current methods commonly used in machine vision are direct linear method, perspective projection matrix method, Zhang Zhengyou France, the two-step camera calibration method. For the facts of relatively stable laboratory and low interference environment, this paper chooses the direct linear method, which is characterized by convenient computing but less accuracy. It is difficult to be pre- cise shooting environment complex self-correcting. DLT method called direct linear method, by Abdel-Aziz and Karara and was first proposed in 1971 [<xref ref-type="bibr" rid="scirp.53164-ref5">5</xref>] . This method does not consider the non-linear distortion of the camera, getting the relevant parameters of the camera by directly solving a set of linear equations. It acquires pinhole imaging model for the study, ignoring specific intermediate imaging process and using a 3 &#215; 4 order matrix to represent a direct correspondence between the point and the two-dimensional space object image point. The linear transformation matrix is with only a difference of a perspective matrix scale factor. Providing space point <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x8.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x7.png" xlink:type="simple"/></inline-formula> coordinates in the camera coordinate system of<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x9.png" xlink:type="simple"/></inline-formula>, the camera will capture the image on the CCD imaging plane, which is provided for the image point coordinates <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x10.png" xlink:type="simple"/></inline-formula> corresponding to the image pixel coordinates<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x11.png" xlink:type="simple"/></inline-formula>.</p><p>By the world coordinate system to the camera coordinate system, using the following formula rotation―trans- lation conversion formula described:</p><disp-formula id="scirp.53164-formula355"><label>(1)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/1-7900369x12.png"  xlink:type="simple"/></disp-formula><p>where in <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x13.png" xlink:type="simple"/></inline-formula> is a rotation matrix, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x14.png" xlink:type="simple"/></inline-formula>is the translation matrix. In the case where distortion is not considered (i.e., an ideal perspective projection), the image coordinates of the camera coordinate system is described by the following formula:</p><disp-formula id="scirp.53164-formula356"><label>(2)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/1-7900369x15.png"  xlink:type="simple"/></disp-formula><p>In the image processing, is often used in image coordinate of the pixel as a unit, so to convert the image coordinate system to the coordinate system of the pixel, i.e.</p><disp-formula id="scirp.53164-formula357"><label>(3)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/1-7900369x16.png"  xlink:type="simple"/></disp-formula><p>Without considering the various types of the imaging by the specific process, can be obtained:</p><disp-formula id="scirp.53164-formula358"><label>(4)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/1-7900369x17.png"  xlink:type="simple"/></disp-formula><p>where, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x18.png" xlink:type="simple"/></inline-formula>of the three-dimensional world coordinate space points, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x19.png" xlink:type="simple"/></inline-formula>coordinates of the corres- ponding pixel, r<sub>ij</sub> is a perspective view of elements of the transformation matrix. It contains three equations, finishing eliminates, obtain the following two linear equations on people r<sub>ij</sub>:</p><disp-formula id="scirp.53164-formula359"><label>(5)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/1-7900369x20.png"  xlink:type="simple"/></disp-formula><disp-formula id="scirp.53164-formula360"><label>(6)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/1-7900369x21.png"  xlink:type="simple"/></disp-formula><p>This equation describes the relationship between the two three-dimensional world and the corresponding points between image points. If the three-dimensional world coordinates and the corresponding image coor- dinates are known, the transformation matrix regarded as unknown, then there will be a total of 12 unknowns. For two equations above each object point has, in general, can be set<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x22.png" xlink:type="simple"/></inline-formula>, then there will be a total of 11 unknowns. Taking six goals can get 12 points a overdetermined equation Using the least squares method des- cribed above can easily find solution of linear equations [<xref ref-type="bibr" rid="scirp.53164-ref6">6</xref>] . Using more points, we make much more than the number of equations number of unknowns, using the least squares method for solving can reduce the impact of errors caused by the perspective transformation matrix obtained after its decomposition can get cameras inside and outside the parameters.</p><p>Based on the direct linear method was calibrated to the camera. Put the calibration paper on a suitable position in the robot coordinate system, as shown in <xref ref-type="fig" rid="fig3">Figure 3</xref>. Cross figure crosshairs for the world coordinate system. Only a simple translation of the relationship is needed between it and the robot base coordinate system, i.e., calculating the target position in the world coordinate system, then subtracting a certain shift amount and finally obtaining the target based on the robot base in the standard position.</p><fig id="fig2"  position="float"><label><xref ref-type="fig" rid="fig3">Figure 3</xref></label><caption><title> Camera calibration chart based DLT</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/1-7900369x23.png"/></fig><p>Corner extraction algorithm using corner point data is shown in <xref ref-type="table" rid="table1">Table 1</xref>.</p><p>On the Matlab model with a blue asterisk plotted coordinates of each point (real value), the table on each corner point coordinates a left multiplication result (calculated) M-1 obtained plotted with a green plus sign, as shown in <xref ref-type="fig" rid="fig4">Figure 4</xref>.</p><p>The verification result from <xref ref-type="fig" rid="fig4">Figure 4</xref> is that, by using direct linear method in this system, the calibration results is accurate, easy to calculate and close to actual value. Besides, the calibration results are also good, which provides a reliable foundation for accurate positioning of the workpiece in a sorting system.</p><fig id="fig3"  position="float"><label><xref ref-type="fig" rid="fig4">Figure 4</xref></label><caption><title> Camera calibration results based DLT</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/1-7900369x24.png"/></fig><table-wrap id="table1" ><label><xref ref-type="table" rid="table1">Table 1</xref></label><caption><title> Angular point data table</title></caption><table><tbody><thead><tr><th align="center" valign="middle" ></th><th align="center" valign="middle" ></th><th align="center" valign="middle"  colspan="3"  >Angular point data table</th></tr></thead><tr><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x25.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" >Column 1</td><td align="center" valign="middle" >Column 2</td><td align="center" valign="middle" >Column 3</td><td align="center" valign="middle" >Column 4</td></tr><tr><td align="center" valign="middle" >Line 1</td><td align="center" valign="middle" >(234.5, 168)</td><td align="center" valign="middle" >(261.5, 166.5)</td><td align="center" valign="middle" >(289.5, 166.5)</td><td align="center" valign="middle" >(316.5, 166.5)</td></tr><tr><td align="center" valign="middle" >Line 2</td><td align="center" valign="middle" >(235.5, 194.5)</td><td align="center" valign="middle" >(262.5, 194.5)</td><td align="center" valign="middle" >(289.5, 193.6)</td><td align="center" valign="middle" >(316.5, 193.5)</td></tr><tr><td align="center" valign="middle" >Line 3</td><td align="center" valign="middle" >(235.5, 221.5)</td><td align="center" valign="middle" >(262.5, 221.5)</td><td align="center" valign="middle" >(289.5, 221.5)</td><td align="center" valign="middle" >(316.5, 220.5)</td></tr><tr><td align="center" valign="middle" >Line 4</td><td align="center" valign="middle" >(235.5, 248.5)</td><td align="center" valign="middle" >(262.5, 248.5)</td><td align="center" valign="middle" >(290, 248.5)</td><td align="center" valign="middle" >(316.5, 247.5)</td></tr><tr><td align="center" valign="middle" >Line 5</td><td align="center" valign="middle" >(236.5, 275.5)</td><td align="center" valign="middle" >(262.5, 275.5)</td><td align="center" valign="middle" >(290.5, 275.5)</td><td align="center" valign="middle" >(317, 275)</td></tr><tr><td align="center" valign="middle" >Line 6</td><td align="center" valign="middle" >(236.5, 302.5)</td><td align="center" valign="middle" >(263.5, 302.5)</td><td align="center" valign="middle" >(290.5, 302.5)</td><td align="center" valign="middle" >(317.5, 302.5)</td></tr><tr><td align="center" valign="middle" >(u, v)</td><td align="center" valign="middle" >Column 5</td><td align="center" valign="middle" >Column 6</td><td align="center" valign="middle" >Column 7</td><td align="center" valign="middle" >Column 8</td></tr><tr><td align="center" valign="middle" >Line 1</td><td align="center" valign="middle" >(344, 166)</td><td align="center" valign="middle" >(371, 166)</td><td align="center" valign="middle" >(397.5, 165.5)</td><td align="center" valign="middle" >(425, 165.5)</td></tr><tr><td align="center" valign="middle" >Line 2</td><td align="center" valign="middle" >(343, 193)</td><td align="center" valign="middle" >(370, 194)</td><td align="center" valign="middle" >(397.5, 192.5)</td><td align="center" valign="middle" >(425.5, 192.5)</td></tr><tr><td align="center" valign="middle" >Line 3</td><td align="center" valign="middle" >(343.5, 220.5)</td><td align="center" valign="middle" >(370.5, 220.5)</td><td align="center" valign="middle" >(398.5, 220.5)</td><td align="center" valign="middle" >(425.5, 219.5)</td></tr><tr><td align="center" valign="middle" >Line 4</td><td align="center" valign="middle" >(344, 247.5)</td><td align="center" valign="middle" >(371, 247.5)</td><td align="center" valign="middle" >(398.5, 247.5)</td><td align="center" valign="middle" >(425.5, 247.5)</td></tr><tr><td align="center" valign="middle" >Line 5</td><td align="center" valign="middle" >(344.5, 247.5)</td><td align="center" valign="middle" >(371.5, 274.5)</td><td align="center" valign="middle" >(398.5, 274.5)</td><td align="center" valign="middle" >(425.5, 274.5)</td></tr><tr><td align="center" valign="middle" >Line 6</td><td align="center" valign="middle" >(344, 301.5)</td><td align="center" valign="middle" >(371.5, 301.5)</td><td align="center" valign="middle" >(398.5, 301.5)</td><td align="center" valign="middle" >(398.5, 301.5)</td></tr></tbody></table></table-wrap></sec><sec id="s4"><title>4. Thresholding Segmentation</title><p>This design uses machine vision technology, the different colors of the workpiece intelligent sorting rules. When the camera calibration is completed, after the pixel coordinates to the scenecoordinate correspondence to obtain the target, will be on the video image is processed by computer.</p><p>First, the camera image acquired in the target workpiece is detected. Target detection is extracted from the image portion of interest, i.e., the image segmentation; the image processing to the image analysis is a key step. At present, a lot of image segmentation methods, such as thresholding method, edge detection and region extraction method. In this paper, we use the thresholding method and edge detection method to detect the target workpiece.</p><p>Thresholding as the most common color distinction is a region-based image segmentation technique. Briefly, image segmentation threshold is transformed to a color image to grayscale, the first grayscale range of an image to determine the gray value threshold, then the image of the gray value of each pixel with this threshold value, and are classified according to the size of the result of the comparison, based on the threshold values of all the pixels in the image is divided into two areas.</p><p>A pair of the original image <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x26.png" xlink:type="simple"/></inline-formula> is taken to define a single threshold value <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x26.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x27.png" xlink:type="simple"/></inline-formula> of the divided</p><disp-formula id="scirp.53164-formula361"><label>(7)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/1-7900369x28.png"  xlink:type="simple"/></disp-formula><p>In the actual case, the difference between the image of the target workpiece and background brightness is small, so the threshold needs to be adjusted manually. <xref ref-type="fig" rid="fig5">Figure 5</xref> shows the use of maximum between-class va- riance method combined with manual adjustment method in Matlab to finalize the process threshold.</p><fig-group id="fig4"><label><xref ref-type="fig" rid="fig5">Figure 5</xref></label><caption><title> Threshold segmentation results. (a) When the threshold T to 80 threshold segmentation results; (b) When the threshold T to 100 threshold segmentation results.</title></caption><fig id ="fig4_1"><label>(b)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/1-7900369x29.png"/></fig><fig id ="fig4_2"><label></label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/1-7900369x30.png"/></fig></fig-group><p>From the segmentation results can be seen, when the threshold of T is 100, it’s the best segmentation, can accurate segmentation of the target range of workpiece, which proves Ostu method combined with manual adjust- ment is the most suitable way for this system.</p></sec><sec id="s5"><title>5. Determine the Centroid</title><p>In the sorting operation of the workpiece, the workpiece needs to be identified for positioning, the general centroid coordinates describing the location information of the workpiece. But the calculation method for multi- target centroid such as starting algorithms geometric center of the target group, the calculation is more com- plicated; through rows of pixels accumulating and averaging roughly centroid location, can not meet the precise positioning. According to the characteristics identified herein workpiece shape rules proposed rule graphics centroid location method [<xref ref-type="bibr" rid="scirp.53164-ref7">7</xref>] .</p><p>When the function is applied to shape analysis, suppose there are binary function:</p><disp-formula id="scirp.53164-formula362"><label>(9)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/1-7900369x31.png"  xlink:type="simple"/></disp-formula><p>Take <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x32.png" xlink:type="simple"/></inline-formula> as the moment of order. The moment for <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x32.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x33.png" xlink:type="simple"/></inline-formula> digital image<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x32.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x33.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x34.png" xlink:type="simple"/></inline-formula>, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x32.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x33.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x34.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x35.png" xlink:type="simple"/></inline-formula>is defined as:</p><disp-formula id="scirp.53164-formula363"><label>(10)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/1-7900369x36.png"  xlink:type="simple"/></disp-formula><p>0-order moment is the area of the sum of the image gray, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x37.png" xlink:type="simple"/></inline-formula>values represent object binary image, if used to standardize an order moments <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x37.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x38.png" xlink:type="simple"/></inline-formula> and<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x37.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x38.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x39.png" xlink:type="simple"/></inline-formula>, we get the coordinates of the object’s center of gravity<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x37.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x38.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x39.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x40.png" xlink:type="simple"/></inline-formula>.</p><disp-formula id="scirp.53164-formula364"><label>(11)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/1-7900369x41.png"  xlink:type="simple"/></disp-formula><p>For binary images, grayscale only 0 and 1, the focus is the centroid. Finally, the first moment <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x42.png" xlink:type="simple"/></inline-formula> and <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x42.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/1-7900369x43.png" xlink:type="simple"/></inline-formula> is divided by zero-order moments to get the coordinates of the center of mass of the object:</p><disp-formula id="scirp.53164-formula365"><label>(12)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/1-7900369x44.png"  xlink:type="simple"/></disp-formula><p>After tests it is proved that the algorithm is simple and effective and is suitable for any graphics.</p><p>In this paper, the workpiece has been recognized as a rectangular, triangular, circular or a regular shape of the workpiece. The program is written in C#, in an ideal environment, workpiece recognition results are shown in <xref ref-type="fig" rid="fig6">Figure 6</xref>.</p><p>The rule workpiece centroid recognition results of <xref ref-type="fig" rid="fig6">Figure 6</xref> demonstrates that, it is simple and efficient to adopt rule centroid locolization algorithm and is suitable for any graphic. Besides, programming is simple, re- cognition is speedy and recognition results are accurate.</p></sec><sec id="s6"><title>6. Conclusions</title><p>This paper describes the main algorithm in the industrial sorting machine vision technology used in the system, using thresholding to detect the target work area and describe the target workpiece position information com- bined centroid location method. The recognition algorithm is programmed in MATLAB environment to conduct a simulation algorithm and it is developed using C# rule artifacts recognition software. According to the results obtained, to identify the robot reaches the top of the target number of pulses required to send to the motion control card, by motion control card for controlling the motor and the drive to achieve sorting purposes.</p><p>The results show that the practical application of technical methods discussed in this article is simple and effective. The sorting system identifies the type of workpiece correct rate of 100%, error of the target location is less than 5 mm, and further validates the feasibility of the system for robot.</p><fig-group id="fig5"><label><xref ref-type="fig" rid="fig6">Figure 6</xref></label><caption><title> Rule workpiece centroid recognition results. (a) Rectangle centroid recognition results; (c) Triangle centroid recognition results; (c) Circular centroid recognition results.</title></caption><fig id ="fig5_1"><label>(b)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/1-7900369x45.png"/></fig><fig id ="fig5_2"><label>(c)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/1-7900369x46.png"/></fig><fig id ="fig5_3"><label></label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/1-7900369x47.png"/></fig></fig-group></sec></body><back><ref-list><title>References</title><ref id="scirp.53164-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">Zhuang, K.L., Wang, J.Z. and Zhou, J. (2011) Application of Machine Vision Technology in Terms of Angle Detection. Equipment Manufacturing Technology, 4, 9-11.</mixed-citation></ref><ref id="scirp.53164-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">El Masry, G., Cubero, S. and Molto, E. (2012) In-Line Sourting of Irregular Potatoes by Using Automated Computer-Based Machine Vision System. Journal of Food Engineering, 112, 60-68. 
http://dx.doi.org/10.1016/j.jfoodeng.2012.03.027</mixed-citation></ref><ref id="scirp.53164-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">Liu, Z.Y., Zhao, B. and Zou, F.S. (2012) Machine Vision Technology in the Sorting of the Workpiece. Computer Applications and Software, 29, 87-91.</mixed-citation></ref><ref id="scirp.53164-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple">Quan, H.H. and Zhang, L.P. (2007) Research on Machine Vision-Based Assembly Line Parts Recognition. Modular Machine Tool &amp; Automatic Manufacturing Technique, 12, 58-60.</mixed-citation></ref><ref id="scirp.53164-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">Forsyth, D.A. and Ponce, J. (2002) Computer Vision: A Modern Approach. Prentice Hall, New Jersey.</mixed-citation></ref><ref id="scirp.53164-ref6"><label>6</label><mixed-citation publication-type="journal" xlink:type="simple"><name name-style="western"><surname>Shapiro</surname><given-names> R. </given-names></name>,<etal>et al</etal>. (<year>1976</year>)<article-title>Direct Linear Transformation Method for Three-Dimensional Cinematography</article-title><source> Research Quarterly</source><volume> 49</volume>,<fpage> 197</fpage>-<lpage>205</lpage>.<pub-id pub-id-type="doi"></pub-id></mixed-citation></ref><ref id="scirp.53164-ref7"><label>7</label><mixed-citation publication-type="other" xlink:type="simple">Ou, X.Y., Hou, X.Z. and Zheng, K. (2012) Machine Vision Based Automatic Teaching System of Six DOF Robot. Manufacturing Automation, 34, 1-4.</mixed-citation></ref></ref-list></back></article>