Abstract:
Disclosed are a cost-effective light source device that can eliminate highlights or hotspots and reduce halo phenomenon on resistor surface and a method for reading resistor value with computer vision, in which an image of a body of a resistor is extracted through irradiation by an annular light source and reflection by a replaceable diffuse reflection hood such as paper box, paper bowl, or paper cup inside pasted with white paper and extraction by an image extraction device, followed by a series of image processing operations conducted by a control unit to calculate a disposition angle of the resistor in an image. Luminous elements on opposite axial ends of the resistor are activated, according to the disposition angle, for illumination, while luminous elements on opposite lateral sides of the resistor are shut down so that a clear color resistor image can be obtained.

Description:
(a) TECHNICAL FIELD OF THE INVENTION 
       [0001]    The present invention relates generally to a cost effective light source that can eliminate highlights or hotspots and reduce halo phenomenon on the resistor for reading resistor values with computer vision and a method thereof, and more particularly to a reading method that acquires an image of a body of a resistor and identifies and converts the color of each color bands into a corresponding color code for subsequent calculation and displaying of a resistor value and a reading device associated therewith. 
       (b) DESCRIPTION OF THE PRIOR ART 
       [0002]    Resistor color bands are provided on an electrical resistor for use in an electronic circuit for the purpose of identification of resistor value and tolerance. Conversion of the color bands to color code and resistor value can only be done by a user by recalling what the figure presented by the color code is. Previous studies indicate the following shortcomings exist: 
         [0003]    (1) Reading of resistor value is only available for four color bands and reading and identification of five color band resistor value and silver band included resistor value are not available. However, the five color band precision resistor values have also been widely used and the silver color band is commonly involved in the five color band resistor values. 
         [0004]    (2) Issues related to light reflection have not been throughout studied and overcome and thus, errors often occur in reading and identification of color bands. 
         [0005]    (3) There has been no study conducted for automatic horizontal adjustment for images of resistors that are randomly disposed inclined. 
         [0006]    (4) There has been no study conducted for analysis of color band location and color code inversion. 
         [0007]    (5) A user must loop and identify color band location on a resistor image and no full automation of color code reading is possible. 
         [0008]    (6) A user must put scanning light in alignment with the resistor body and this may be difficult for the user&#39;s hands may shake. 
         [0009]    In view of these problems, the present invention aims to provide a device and a method for reading resistor value with computer vision to allow four color bands and five color bands to be correctly read. 
       SUMMARY OF THE INVENTION 
       [0010]    The primary object of the present invention is to provide a cost-effective diffuse light source that can eliminate highlights or hotspots and reduce halo phenomenon on resistor surface and method for reading resistor value with computer vision, particularly a method that acquires an high quality image of a body of a resistor by the designed cost-effective diffuse light source and identifies and converts the color of each color band into a color code, and calculate and displays the resistor value read with computer vision. 
         [0011]    The method for reading resistor value with computer vision is such that an image of a body of a resistor is extracted through irradiation by an annular light source and reflection by a replaceable diffuse reflection hood such as paper box, paper bowl, or paper cup inside pasted with white paper and extraction by an image extraction device, followed by a series of image processing operations conducted by a control unit to calculate a disposition angle of the resistor in an image. Luminous elements on opposite axial ends of the resistor are activated, according to the disposition angle, for illumination, while luminous elements on opposite lateral sides of the resistor are shut down so that a clear color resistor image having high quality resistor image with no light reflection and low halo can be obtained for being subsequently adjusted to the horizontal and subjected to a series of processing to extract color bands. The control unit can be trained to recognize the color bands and establish the colors of the resistor body and store different files of color classifier for each 4-band, 5-band, and resistor body color database. In an actual operation of reading resistor value with computer vision, the device and the method can be applied to have the control unit calculate and recognize the resistor to be read for displaying a correct resistor value. 
         [0012]    The device for reading resistor value with computer vision comprises at least an observation table on which a resistor is positionable, an annular light source, a reflection hood, a microscope, and a control unit. 
         [0013]    The foregoing objectives and summary provide only a brief introduction to the present invention. To fully appreciate these and other objects of the present invention as well as the invention itself, all of which will become apparent to those skilled in the art, the following detailed description of the invention and the claims should be read in conjunction with the accompanying drawings. Throughout the specification and drawings identical reference numerals refer to identical or similar parts. 
         [0014]    Many other advantages and features of the present invention will become manifest to those versed in the art upon making reference to the detailed description and the accompanying sheets of drawings in which a preferred structural embodiment incorporating the principles of the present invention is shown by way of illustrative example. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0015]      FIG. 1  is a flow chart illustrating a file establishing process for resistor color according to the present invention. 
           [0016]      FIG. 2  is a flow chart illustrating a reading process according to the present invention. 
           [0017]      FIG. 3  is a side elevational view, in a sectioned form, showing an example of using a reading device of the present invention to read color bands of a resistor. 
           [0018]      FIG. 4  is a top view of the example of using the reading device of the present invention to read the color bands of the resistor. 
           [0019]      FIGS. 5-20  demonstrate resistor color file establishing and reading status diagrams according to the present invention. 
           [0020]      FIG. 21  illustrates histograms of red, green, and blue colors of resistor body image colors according to the present invention. 
           [0021]      FIG. 22  illustrates a reading status diagram of analyzing and determining if to inverse or flip over reading sequence of color bands according to the present invention. 
       
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
       [0022]    The following descriptions are exemplary embodiments only, and are not intended to limit the scope, applicability or configuration of the invention in any way. Rather, the following description provides a convenient illustration for implementing exemplary embodiments of the invention. Various changes to the described embodiments may be made in the function and arrangement of the elements described without departing from the scope of the invention as set forth in the appended claims. 
         [0023]    Referring to  FIG. 1 , in combination with  FIGS. 3-19 , which are a flow chart illustrating a resistor color file establishing process and status diagrams according to the present invention. As shown in the drawings, the present invention at least comprises an observation table  2  on which a resistor is positionable, an annular light source  3 , a replaceable paper box or paper bowl or paper cup inside pasted with white paper of diffuse reflection hood  4 , a microscope  5 , and a control unit (not shown in the drawings) and in file establishing or reading for resistor colors, a resistor  1  is positioned on the observation table  2  and through irradiation by the annular light source  3  and reflection by the replaceable diffuse reflection hood  4  and extraction and transmission of a resistor image  11  by the microscope  5  to the control unit, file establishing or reading of a resistor value can be performed. In reading a four-color colorband or a five-color colorband, a correspondence table of codes, multiplier, and tolerance of a colorband and resistance computation rules are applied to calculate a resistor value. The present invention provides a computer program based on the correspondence table and the resistance computation rules to allow the control unit to identify colors involved in a colorband and then look up the table an calculate the resistor value. The present invention establishes a system that is capable of reliably and automatically recognizes an image  11  of a resistor and to read the resistor value thereof. The four-color colorband and five-color colorband are taken as subjects of study, including: (1) illumination with cost-effective light source and acquisition of image; (2) detection of resistor direction; (3) isolation or separation of body of resistor image  11 ; (4) binarization of colorband of resistor image  11 ; (5) extraction of colorband of resistor image  11 ; (6) training and recognition of body color and colorband color of resistor image  11 ; and (7) analysis of position switching of colorband color code and inversion or flipping-over of reading color code sequence, which comprises the following steps: 
         [0024]    (1) controlling annular light source  3  and acquiring an image of a resistor  1  (see  FIGS. 3, 4, and 5 ). 
         [0025]    (2) Converting a color image of the resistor image  11  ( FIG. 5 ) into a gray-scale image and executing a binarization process (see  FIGS. 1 and 6 ), wherein the purpose of binarization of the resistor image  11  comprises two stages, of which the first stage is to detect a directional angle of the resistor  1  in the resistor image  11  and the second stage is to extract a colorband in order to obtain an excellent effect of isolating and extracting the colorband. The present invention provides an adaptive image binarization method, which provides an even better result of resistor binarization to acquire sufficient information of the resistor image  11  and effectively suppress background noise, and which involves the following equation: 
         [0000]        T   yj   =m +√{square root over ( j×Σp   i   2   /n )}
 
         [0000]    where m is the local sample mean, j is a scaling factor of yj, n is the total number of pixels in the gray image, and p i  is a pixel value of the gray-scale image. 
         [0026]    (3) executing noise removal and convex hull treatment and calculating a disposition angle of the resistor  1  in the resistor image  11  (see  FIG. 7 ), of which a process is as follows: 
         [0027]    where one or multiple blocks may be generated by the convex hull treatment of the binarized resistor image  11 , 
         [0028]    wherein in case that one single block is generated, a moment of inertia based process is used to calculate a directional angle of the single block in order to determine an angle of a center line of the block that exhibits the lowest moment of inertia: 
         [0000]    
       
         
           
             
               θ 
               rad 
             
             = 
             
               
                 1 
                 2 
               
                
               
                 
                   tan 
                   
                     - 
                     1 
                   
                 
                  
                 
                   ( 
                   
                     
                       2 
                        
                       
                           
                       
                        
                       
                         M 
                         xy 
                       
                     
                     
                       
                         M 
                         yy 
                       
                       - 
                       
                         M 
                         xx 
                       
                     
                   
                   ) 
                 
               
             
           
         
       
     
         [0000]    where M xy  is xy moment of inertia, M xx  is xx′ moment of inertia, and M yy  is yy′ moment of inertia; and 
         [0029]    wherein in case that multiple blocks are generated, a moment of inertia based process is used to calculate a directional angle of the largest one of the blocks, such that the directional angle is regarded as the directional angle of the resistor  1 ; 
         [0030]    where in the above calculation, θ rad  is of the unit of radian, and a process involving the following algorithm can be used to calculate an angle θ ar  for automatically adjusting the resistor  1  in the resistor image  11  to the horizontal is as follows: 
         [0000]      θ deg =θ rad ×360/2π
 
         [0000]      if θ deg ≦90°, then θ ar =−θ deg ,
 
         [0000]      else θ ar =−(180−θ deg )
 
         [0031]    (4) after the calculation of the disposition angle of the resistor  1 , controlling the annular light source  3  such that luminous elements  31  that are located at opposite axial ends of the resistor  1  are energized for illumination, while luminous elements  31  that are located on opposite lateral sides of the resistor  1  are de-energized and set off (see  FIG. 8 ) and then, the microscope  5  is used to extract a clear and sharp color resistor image  12  that is of no light reflection and low halo (see  FIG. 9 ). 
         [0032]    (5) automatically adjusting the image of the resistor  1  in the clear color resistor image  12  to the horizontal (see  FIG. 10 , in which the resistor that is shown is the resistor  1 ). 
         [0033]    (6) isolating or separating a body image  16  of the resistor in the clear color resistor image  12  (see  FIGS. 11-16 ), wherein the clear color resistor image  12  that has been adjusted to the horizontal is subjected to calculation of coordinates of a centroid thereof and, based on empirical rules, a y-axis range of the resistor  1  is defined and isolated by including 40 pixels above and 40 pixel below the y-axis coordinate of the centroid (see  FIGS. 11 and 12 ) and then an image erosion treatment (see  FIGS. 13 and 14 ) is applied to calculate and determine coordinates of intersection points of top and bottom boundaries of the resistor  1  in the y-axis range such that a relatively large one of the minimum x-axis coordinates of the intersection points of the top and bottom boundaries is taken as an x-axis limit of the left side of the resistor (such as the minimum shown in  FIG. 13  that is 82) and a relatively small one of the maximum x-axis coordinates of the intersection points of the top and bottom boundaries is taken as an x-axis limit of the right side of the resistor (such as the maximum shown in  FIG. 14  that is 425), whereby a resistor body image  16  as shown in  FIGS. 15 and 16  can be isolated and identified. 
         [0034]    (7) establishing and separating a resistor body color image diagram  17  (see  FIG. 17 ) having the same size as that of the resistor body image  16  and carrying the same color as that of resistor body, wherein a process adopted is as follows: computer calculating and analyzing red/green/blue histograms ( FIG. 21 ) for the resistor body image  16  ( FIG. 16 ) and counting individual pixel numbers of R (red) values, G (green) values, and B (blue) values of the resistor body image  16  and selecting the one of the R (red) values that has the greatest pixel number, the one of the G (green) values that has the greatest pixel number, and the one of the B (blue) values that has the greatest pixel number, where in the example given in  FIG. 21 , the R (red) value having the greatest pixel number is 165, the G (green) value having the greatest pixel number is 158, and the B (blue) value having the greatest pixel number is 156 and wherein the R (red) value of 165, the G (green) value of 158, and the B (blue) value of 156 are used to establish and separate a resistor body color image diagram  17  ( FIG. 17 ) that has the same size as that of the resistor body image  16  and carries a color extremely close to that of resistor body. 
         [0035]    (8) executing image differencing (subtracting) absolute value treatment on the resistor body image  16  and the resistor body color image diagram  17  so established to obtain a result color image and converting the result color image into a gray-scale image ( FIG. 18 ). 
         [0036]    (9) executing binarization treatment, where the YJ adaptive binarization process so established is applied to execute binarization treatment to generate a binarized image and calculating coordinates of a centroid of each color band ( FIG. 19 ) and extracting a color band sample according to a predetermined range of the coordinates of each centroid, wherein a process for determining the number of color bands and extracting the color bands are as follows: 
         [0037]    (I) if the number of the color bands is counted 5 for pixels of the binarized image extending upward and downward by 80 pixels from the middle, then the number of the color bands is 5; 
         [0038]    (II) otherwise the number of color bands is determined by recognizing the resistor body color, where height of the binarized colorband is taken as the first priority factor for selecting resistor color band candidate and the YJ adaptive binarization process mentioned herein provides an excellent effect of suppressing noise in order to obtain a correct result. The colorband centroid is selected, according to the number of the color bands, from the binarized image as the centroid of the color band having a relatively great color band height (see  FIG. 19 ), where the colorband sample is extracted by extending from a center taken as the centroid x-axis coordinate and the centroid y-axis coordinate calculated in step (6) toward both left side and right side by 20 pixels and towards both top and bottom sides by 80 pixels. 
         [0039]    (10) training a computer to recognize the resistor body color and the colorband colors so established and storing different files of color classifier for each 4-band, 5-band, and resistor body color of a color classifier such that the resistor body color so established and the colorband sample so extracted are used for training in a color learning phase and stored in the classifier files for the purpose for recognition in a resistor reading phase. 
         [0040]    Referring to  FIG. 2 , in combination with  FIGS. 3-20 , which are a flow chart illustrating a resistor color reading process and status diagrams according to the present invention, the resistor color reading according to the present invention comprises the following steps: 
         [0041]    (1) controlling an annular light source  3  for illumination and acquiring an image of a resistor  1  (see  FIGS. 3 and 4 ). 
         [0042]    (2) converting a color image of the image  11  of the resistor into a gray-scale image and executing binarized treatment (see  FIGS. 5 and 6 ). 
         [0043]    (3) executing noise removal and convex hull treatment and calculating a disposition angle of the resistor  1  in the resistor image  11  (see  FIG. 7 ). 
         [0044]    (4) controlling the annular light source  3  such that luminous elements  31  that are located at opposite axial ends of the resistor  1  are energized for illumination, while luminous elements  31  that are located on opposite lateral sides of the resistor  1  are de-energized and set off (see  FIG. 8 ) and then, a microscope  5  is used to extract a clear and sharp color resistor image  12  that is of no light reflection and low halo (see  FIG. 9 ). 
         [0045]    (5) automatically adjusting the clear color resistor image  12  such that the image of the resistor  1  is set to the horizontal (see  FIG. 10 , in which the resistor that is shown is the resistor  1 ). 
         [0046]    (6) isolating or separating a body image  16  of the resistor in the clear color resistor image  12  (see  FIGS. 11-16 ). 
         [0047]    (7) establishing and separating a resistor body color image diagram  17  (see  FIG. 17 ) having the same size as that of the resistor body image  16  and carrying the same color as that of resistor body, wherein a process adopted is as follows: computer calculating and analyzing red/green/blue histograms ( FIG. 21 ) for the resistor body image  16  ( FIG. 16 ) and counting individual pixel numbers of R (red) values, G (green) values, and B (blue) values of the resistor body image  16  and selecting the one of the R (red) values that has the greatest pixel number, the one of the G (green) values that has the greatest pixel number, and the one of the B (blue) values that has the greatest pixel number to establish and separate a resistor body color image diagram  17  ( FIG. 17 ) that has the same size as that of the resistor body image  16  ( FIG. 16 ) and carries a color extremely close to that of resistor body. 
         [0048]    (8) recognizing the resistor body image  16  as a four-color colorband resistor or a five-color colorband resistor. 
         [0049]    (9) executing absolute differencing treatment on the resistor body image  16  and the resistor body color image diagram  17  so established and converting a result color image into a gray-scale image ( FIG. 18 ). 
         [0050]    (10) executing binarization treatment to obtain a binarized image and calculating coordinates of a centroid of each color band ( FIG. 19 ), and extracting a colorband sample covering 20 pixels (in both leftward and rightward directions)×80 pixels (in both upward and downward directions) about the coordinates of the centroid. 
         [0051]    (11) recognizing and converting the color of each color band sample into a color code. 
         [0052]    (12) operating the control unit to read and calculate the resistor value and display a result (see  FIG. 20 ). 
         [0053]    The present invention reads the color bands by the sequence that is determined according the rule of being from the left end to the right end and the color bands or the resistors, after being extracted, are converted into the color code and the resistor value can be then calculated according to predetermined formula. When the clear color resistor image is automatically adjusted to the horizontal, the tolerance band may be on the left end or the right end and the present invention provides functions of colorband code position switching analysis and reading color code in an inversed sequence. Inversion of color code is determined according to the analysis of the following two situations: 
         [0054]    (1) if the first or second color band on the left end is recognized as a gold or silver one, then the color codes are inversed or flipped over. 
         [0055]    (2) the distance between color bands are inspected and identified (see  FIG. 22 ), where 
         [0000]    d 1L -d 2L : centroid distance between the first color band and the second color band on the left end;
 
d 1R -d 2R : centroid distance between the first color band and the second color band on the right end; and
 
a mechanism for comparison of d 1L -d 2L  and d 1R -d 2R  is activated only when the first color band and the last color band are of a color of brown, red, green, blue, purple, and grey and when d 1L -d 2L &gt;d 1R -d 2R , the reading sequence of the color band is inversed or flipped over.
 
         [0056]    The above examples are given to demonstrate the best mode of practicing the present invention, but not for imposing undue constraints to the present invention. Minor modifications and variations, without departing the essence of the present invention, are considered falling within the scope of the present invention. 
         [0057]    In summary, the present invention involves a control unit to train color bands and establish colors of a resistor body and storing different files of color classifier for each 4-band, 5-band, and resistor body color so that in reading a resistor, an image of the resistor is acquired for identifying the color of each color band for being subsequently converted into a color code, which is then calculated to obtain and display the value of the resistor. 
         [0058]    It will be understood that each of the elements described above, or two or more together may also find a useful application in other types of methods differing from the type described above. 
         [0059]    While certain novel features of this invention have been shown and described and are pointed out in the annexed claim, it is not intended to be limited to the details above, since it will be understood that various omissions, modifications, substitutions and changes in the forms and details of the device illustrated and in its operation can be made by those skilled in the art without departing in any way from the claims of the present invention.