Process for discriminating the color of a surface and apparatus for implementing the process

Abstract: The invention relates to a process for discriminating the color of a surface, comprising the steps of: a) acquiring at least one color of a colored acquisition surface; b) comparing the color of a detecting surface with said at least one color previously acquired, so that said color can be recognized. In particular, the acquisition step a) comprises the steps of: a1) sequentially illuminating the acquisition surface with each of three light beams corresponding to three primary colors, each of said light beams being generated by a respective emission source supplied with a supply current IR, IG, IB; a2) picking up by means of a light-receiving element the light scattered from the illuminated acquisition surface; a3) generating an electric signal VR, VG, VB proportional to the luminous intensity of the picked-up light, as the acquisition surface is being illuminated with each of the three beams and a4) controlling the supply current IR, IG, IB of the emission sources such that at least two of the electric signals VR, VG, VB generated are identical with each other within a predetermined tolerance margin.

Description: This invention relates to a process for discriminating the color of a surface, and to an apparatus for implementing the process. More particularly, the invention relates to a process and an apparatus for discriminating the color of a surface by comparison with a previously acquired reference color. The invention further relates to a process for discriminating a range of colors and/or a plurality of colors on a surface. Throughout this description and the appended claims, the expression "color range" will be used to indicate a plurality of different hues of one color (e.g., for the red color, a range of variation of red hues from light red to deep red). In object sorting and handling systems, an ability to "recognize" the surface color of the objects may sometimes be useful to facilitate and speed up the object sorting and handling operations. For the purpose, several process for. discriminating the color of a surface have been proposed heretofore which all comprise substantially two basic steps, both to be carried out on the same apparatus (also referred to as the "color discriminator" hereinafter), namely: a first "acquisition" step whereby the apparatus is set, manually or automatically, for a reference color, followed by a "recognition" step whereby the color of the object surface being scanned is compared with the previously acquired reference color to check that they are the same, within an optionally adjustable tolerance margin. More particularly, the acquisition step consists of illuminating with a suitable light source a colored acquisition surface which includes the color to be recognized, and then picking up, onto a light-receiving element, light scattered from said surface so as to generate electric signals which are proportional to the luminous intensity of the picked-up light. These signals are then suitably processed to calculate and store parameters representing the color of the illuminated acquisition surface. The recognition step consists of using the same apparatus, as previously set during the acquisition step, to illuminate the surface of the object bearing the color to be discriminated and generate electric signals proportional to the luminous intensity of light scattered back from such surface. These signals are then processed to calculate parameters representing the surface color of the illuminated object; these parameters are ultimately compared with those previously stored during the acquisition step to check that they are the same within a predetermined tolerance margin, thereby to recognize the surface color of the illuminated object. For both the acquisition and recognition steps, the processing of the electric signals generated by the light-responsive element is based on the detection of the three components V R , V G , V B of the three primary colors -- red, green and blue -- emitted from the three LEDs. Among the prior color discriminators capable of implementing a process such as that above described, the so-called "solid-state" ones are of particular interest, which additionally to incorporating inexpensive small-size components, can discriminate the color of a surface regardless of the surface distance from the discriminator. Such discriminators employ, as the light sources, three separate emission LEDs, respectively for the red, green and blue colors, and as the light-receiving element,a standard photodiode or phototransistor having a sufficiently wide sensitivity in the visible range. In such discriminators, the emission LEDs are supplied by impulse with respective supply currents I R , I G , I B , such that, at each current impulse supplied, corresponding electric signals V R , V G , V B are generated by the photodiode so as that their sum is equal to a predetermined reference value (preferably, the white color). The color is then recognized by measuring the amounts of red, green and blue scattered from the surface of the object being scanned (i.e., measuring the values of the signals V R , V G , V B generated during normal operation of the discriminator). US 5,021,645 discloses a photoelectric color sensor suitable to perform a go, no-go comparison of sensed color to stored color data. The sensor is provided with a learn mode activated manually by a switch, wherein color data from a reference article presented to the sensor are stored. In application, the articles having the color to be recognised are presented in succession to the sensor for color identification. The sensor makes quantitative measurements of the red, blue and green light reflected from the articles when illuminated with suitable light source and, by a suitable algorithm, compares these color data to color data stored during learn mode. The sensor is calibrated by indivually controlling the red, green and blue pulses to provide equal red, green and blue pulses amplitudes when a white targed is viewed. A color discriminator of the above type, while substantially achieving its objective, still does not allow discrimination of those colors wherein at least one of the color components V R , V G , V B is much smaller than the two others (consider, for instance, the red, green and blue colors themselves, for which the respective color components of that color are much larger than the two others) . In this situation, the discriminator above described is little responsive to variations in the other two colors, and therefore, cannot provide accurate discrimination of the different hues of these colors. Furthermore, there are instances of one component being much smaller than the two others. Here again, the discriminator response to varying hues of that color is poor. The underlying technical problem of this invention is to provide an efficient and accurate way of discriminating any color of any surface. According to a first aspect, the invention provides a process for discriminating the color of a non-white detecting surface as claimed in claim 1. In particular, the claimed process comprises the steps of : a) acquiring the color to be discriminated by carrying out the following steps a1), a2) and a3) : - a1) sequentially illuminating a non-white acquisition surface having the color to be discriminated with a red light beam, a green light beam and a blue light beam, each of said light beams being generated by an emission source supplied with a supply current, respectively IR, IG, IB; a2) for each of the aforementioned three different light beams, receiving, by means of a light-receiving element, the light scattered from the illuminated acquisition surface, and a3) generating an electric signal proportional to the intensity of the received light, the electric signal being VR for red light, VG for green light and VB for blue light; b) acquiring the color of the non-white detecting surface by carrying out the following steps b1), b2) and b3): b1) sequentially illuminating, with the aforesaid three light beams, the non-white detecting surface having the color to be discriminated; b2) for each of the aforementioned three different light beams, receiving by means of a light-receiving element the light scattered from the illuminated detecting surface, and b3) generating an electric signal proportional to the intensity of the received light, the electric signal being VR' for red light, VG' for green light and VB' for blue light; c) comparing the color of the non-white detecting surface with the color of the non-white acquisition surface by comparing the electric signal VR', VG', VB' with the electric signal VR, VG, VB; characterized in that the acquisition step a) further comprises the step of: a4) controlling the supply currents IR, IG, IB of the emission sources such that at least two of the electric signals VR, VG, VB generated are identical with each other within a predetermined tolerance margin. Advantageously, the process of this invention allows an accurate discrimination of any color (and/or any color hue) on a surface, regardless of whether this is a color wherein one (or two) component(s) is(are) much smaller than the two others(the other), thereby overcoming the limitations of the above-described prior process related, in particular, to the impossibility to discriminate colors wherein one or two color components are much smaller than the others. As a matter of fact, by the process of this invention, a color whichever is characterized by means of a signal triplet V R , V G , V B wherein at least two signals are identical with each other; thus, colors and/or varying color hues can be discriminated in an accurate manner which would not otherwise be easily discriminated by the above-described prior process. Advantageously, the step of acquiring the color to be subsequently recognized is carried out individually for each discriminating apparatus and for each color to be discriminated. In particular, the recognition of a predetermined color is performed according to parameters representative of that color, which are suitably adjusted and stored in the same discriminating apparatus to be subsequently used for recognizing such color. This allows to overcome the problems due to aging of the optical components mounted on the discriminating apparatus and the known phenomena of spreading of certain basic operational parameters of said components, which would otherwise result in the color discriminating process being generally unreliable. Preferred embodiments of the invention are out ast in the depending claims. Preferably, the supply current I R , I G , I B of the emission sources are controlled in the inventive process such that the electric signals V R , V G , V B (i.e., the individual color components) generated are all identical with one another, within a predetermined tolerance margin. Advantageously, this enables colors wherein one (or two) of the three color components is much smaller than the others (the other) to be accurately discriminated; in addition, being the variations of each color component all equally discriminated, the different hues of a same color whichever can also be accurately discriminated. Advantageously, the supply current I R , I G , I B of the emission sources are controlled such that the electric signals V R , V G , V B generated are all equal, within a predetermined tolerance margin, to a predetermined reference value. Preferably, this reference signal is set at one half the reference voltage used by an analog-to-digital converter which is arranged to convert the analog signal generated by the light-receiving element to a digital signal for subsequent processing. This form of control advantageously allows the working depth of field of the apparatus employed to implement the inventive process to be greatly increased. This is essentially owed to the fact that the values of signals V R , V G , V B utilized are one half the highest voltage value to be generated by the light-receiving element; accordingly, the voltage generated by the light-receiving element can be increased and/or decreased to suit the amplitude of the signals V R , V G , V B generated during the recognition step, by increasing and/or decreasing the distance of the discriminating apparatus from the surface bearing the color to be recognized. This affords enhanced color discriminating capability even in those cases where the signals generated by the light-receiving element are very weak (e.g., because originating from dark colors on a far surface) and/or very strong (e.g., because originating from light colors on a near surface). Preferably, the acquisition procedure according to this invention is carried out in a simple, fast and systematic manner using a binary search algorithm for the supply currents of the three emission sources. According to this algorithm, step a4) further includes the following steps: a41) checking if each of the digital signals V R , V G , V B has its value within a predetermined range of values defined by said predetermined reference value plus/minus a predetermined tolerance margin and: a41a) if so, storing the values of said digital signals V R , V G , V B ; a41b) if not so, iteratively varying the supply current within a predetermined range of current values, and repeating step a41) at each iteration. In particular, step a41) preferably includes the following steps: a411) setting the value of the supply current of the emission source which is supplied first at a first value equal to the highest value in a predetermined range of supply current values; a412) checking if the value of the first of the signal generated first is lower than an upper limiting value of said predetermined range of values and: a412a) if so, checking that the value of said signal generated first is higher than a lower limiting value of said predetermined range of values, and if so, storing said first value of the supply current and iteratively repeating the steps from a411) for the emission source coming next in the supply sequence; a412b) if not so, reducing said first value of said supply current by a predetermined factor, and repeating step a412). Where the above-described control cannot be implemented, the supply current I R , I G , I B of the emission sources is controlled such that the electric signals V R , V G , V B generated are all equal, within a predetermined tolerance margin, to the value of the smallest among them. In particular, if the check of step a412a) gives a negative result, a step is carried out to check if the actual value of the supply current I R , I G , I B is different from the highest value in the predetermined range of current values and: if the check of step a412a) gives a negative result, a step is carried out to check if said first value of the supply current IR, IG, IB is different from said highest value in the predetermined range of supply current values and: if so, taking as the supply current value a value equal to one half the difference between said highest value in the predetermined range of current values and said first value of the supply current and repeating the steps from a412); if not so, carrying out the following steps: a412a1) iteratively repeating the steps from a411) for the emission source coming next in the supply sequence; a412a2) setting, as the reference value, the value of the smallest of said digital signals and repeating the steps from a41). According to a particularly advantageous alternative embodiment of the process of this invention, step a412a2) is preceded by a step of checking if said amplification level can be raised and: if so, raising by a predetermined interval said amplification level and iteratively repeating the steps from a411); if not so, carrying out the step a412a2). In this way, a high capability for discrimination of colors can be ensured even in situations where the signals generated by the by the light-receiving element are too weak (e.g., because originating from light colors on a far surface)ortoo strong (e.g., because originating from dark colors on a near on a near surface), thereby increasing both the depth of field and the precision of the color discriminating process. Preferably, where none of the above described controls can be implemented, the supply currents I R , I G , I B of the emission sources are controlled such that only two of the electric signals V R , V G , V B generated are higher than a predetermined minimum value and, within a predetermined tolerance margin, identied with each other. In particular, step a412a2) further includes the following steps: checking if the reference value set in step a412a2) is higher than a first predetermined minimum value and: if so, repeating the steps from a41); if not so, setting as the reference value, the value of the smallest of the two remaining signals and repeating the steps from a41). Preferably, said first predetermined minimum value is one third of the smallest value of the sum of the signal values which is considered to be acceptable, If the check of step a412a2) gives a negative result, the following steps are carried out specifically: checking if the reference value set in step a412a2) is higher than a second predetermined minimum value, and if so, setting as a reference value for the smallest of said signals the value of that signal, and as a reference value for the two remaining signals the value of the smallest of the two remaining signals, and repeating the steps from a41); if not so, indicating an error. Preferably, said second predetermined minimum value is one half the difference between the smallest value of the sum of the signals which is considered to be acceptable and the value of the smallest of the signals V R , V G , V B . Thus, the acquisition procedure above described terminates with the determination of the supply currents of the three emission sources or with an error indication. If the determination of the supply currents is successful, the process of this invention advantageously continues through the following steps of processing the electric signals V R , V G , V B generated correspondingly with the aforesaid supply currents: measuring said signals VR, VG, VB for a plurality of times, each time, using the stored supply current values IR, IG, IB, respectively; calculating an arithmetical mean of the values of the signals VR measured by using the stored supply current IR, of the signal V G measured when using the stored supply current I G , and of the signal V B measured when using the stored supply current IB; calculating the minimum and maximum limiting values of the digital signals VR, VG, VB by respectively adding and subtracting to/from said arithmetical mean a predetermined value of error, selected depending on specific application. Advantageously, this error is calculated according to the noise inherently present on the signal generated by the light-receiving element and/or introduced during the subsequent amplifying, converting, and processing steps. Even more advantageously, the error also takes account of the spread phenomena of the optical components mounted on the discriminating apparatus (which involves, for instance, variations in the incoming signal with changing temperature). Thus, a range of significant values can be defined for the signals generated by the light-receiver which effectively removes the risk of making, during the subsequent recognition step, erroneous or inaccurate discriminations as a result of the errors that affect the various steps of the process. Preferably, the process of this invention further comprises the following steps: defining three reference parameters R, G, B respectively as the ratio of the value of each signal V R , V G , V B to the sum of the three signals; calculating, for each reference parameter, an upper (lower) limit respectively defined as the ratio of the maximum (minimum) value of the signal V R , V G , V B considered to the sum of that maximum (minimum) value plus the minimum (maximum) values of the other two signals V R , V G , V B . Having thus completed the acquisition step, the process of this invention provides for a step of recognizing the previously acquired color, to be carried out on the same discriminating apparatus. Advantageously, the step c) of composing the color of the colored detecting surface with the color of the colored acquisition surface previously acquired, includes the following steps: C4) checking that at least two of the values of the electric signals V R ', V G ', V B ' generated during comparison step e) are equal, within a predetermined tolerance margin, to those of the electric signals V R , V G , V B generated during acquisition step a), and if such a check gives a positive result : c2) indicating that the colour is recognised. This check is advantageously performed only on two instead of three color components. This because the sum of the three color components is equal to a predetermined value, and therefore, with two components being known, the third is univocally determined. Preferably, step C1) includes the following steps: e1a) checking that the electric signals V R ', V G ', V B ' generated during comparison step a) are lower than a predetermined saturation value and that their sum is higher a predetermined minimum value and: e1a1) if both of said checks give a positive result, carrying out step e2); e1a2) if at least one of said checks gives a negative result, indicating that the color of the detecting surface is not recognized. Even more preferably, step e1a1) further includes the following steps: selecting, from the signals V R ', V G ', V B ', the two signals having the highest values; defining, for each of the two selected signals, a reference variable equal to the ratio of each of the selected signal to the sum of the signals V R ', V G ', V B ' ; checking if each of the reference variables above defined falls within a respective predetermined range of values and: if the above check gives a positive result for both said variables, indicating that the color of the detecting surface is recognized; if the above check gives a negative result for at least one of said variables, indicating that the color of the detecting surface is not recognized. Advantageously, said predetermined range of values for the reference variables is set by the upper and lower limits of the reference parameters calculated for the signals V R , V G , V B during the acquisition step. Thus, the color recognition is simply and rapidly effected by numerical comparison of the reference parameters calculated during the acquisition step with the reference variables calculated during the recognition step. According to another, most advantageous embodiment of the inventive process, if either the first or the second of the check provided in step c1a) gives a negative result, a step is carried out to check if the amplification level can be varied, and if so, the amplification level is changed by a predetermined interval, and the steps from c1a) are repeated; if not so, the color of the detecting surface is reported as not recognized. In an embodiment of the process of the invention, the color acquired during steps a1) to a4) is a first color representing a first color hue of the color to be discriminated, and the process further comprises the following steps before to carry out steps b1) to b3) and c): i) storing the supply current values determined during steps a1) to a4) ; ii) performing, according to step a1) to a3) and using the supply current values stored in step i), a second acquisition of a second color representing a second color hue of the color to be discriminated; wherein the electric signal VR, VG and VB of step c) are representative of the electric signals acquired during previous acquisition steps a1) to a4) and ii) and such signals VR, VG and VB are compared with signal VR', VG', VB' acquired during steps b1) to b3) to check that they are the same, within a predetermined tolerance margin. According to a second aspect, the invention relates to an equipment for discriminating the color of a non-white detecting surface, comprising: a discriminating apparatus and a non-white aquisition surface having the color to be discriminated, wherein the discriminating apparatus comprises a first emission source supplied with a supply current IR and arranged to illuminate the surface with red light; a second emission source supplied with a supply current IG and arranged to illuminate the surface with green light; a third emission source supplied with a supply current IB and arranged to illuminate the surface with blue light; a light-receiving element adapted to receive light scattered from the illuminated surface and generate an electric signal which is proportional to the luminous intensity of the received light, the electric signal being VR for red light, VG for green light and VB for blue light; characterized in that the apparatus further comprises a microcontroller assembly arranged to control the supply current IR, IG, IB of the emission sources in such a way that at least two of the electric signals VR, VG, VB generated are identical with each other, within a predetermined tolerance margin when said non-white acquisition surface is illuminated. Further features and advantages of the invention will be more clearly apparent from the following detailed description of a preferred embodiment thereof, given with reference to the accompanying drawings. In the drawings: Figure 1 is a block diagram illustrating a first embodiment of an apparatus for discriminating the color of a surface according to the invention; Figure 2 is a flow diagram relating to a first step of a discriminating process implemented by the apparatus of Figure 1; Figure 3 is a flow diagram relating to a second step of the discriminating process implemented by the apparatus of Figure 1; Figure 4 is a block diagram illustrating a second embodiment of an apparatus for discriminating the color of a surface according to the invention; Figure 5 is a flow diagram relating to a first step of a discriminating process implemented by the apparatus of Figure 4; Figure 6 is a flow diagram relating to a second step of the discriminating process implemented by the apparatus of Figure 4. Shown at 1 in Figures 1 and 4 is an apparatus for discriminating the color of a detecting surface 2 of an object 3. The apparatus 1 comprises an emission assembly 1a for emitting three light beams corresponding to three primary colors, i.e. red, green and blue, and a pick-up assembly 1b for picking up light scattered from the surface 2 when illuminated with said light beams. The emission assembly 1a includes three emission sources 4a, 4b, 4c for the above three light beams. In the embodiment shown in the above figures, the three emission sources 4a, 4b, 4c are in particular three separate LEDs, respectively of red, green and blue color, which are supplied with respective supply currents I R , I G , I B through respective power supply circuits 5a, 5b, 5c, each connected to a respective current generator 6a, 6b, 6c. Alternatively, the emission sources 4a, 4b, 4c could be three laser diodes of red, green and blue color. The pick-up assembly 1b includes a light-receiving element 7, such as a photodiode, operative to pick up scattered light from the illuminated surface 2 and generate an electric signal V R , V G , V B which is proportional to the luminous intensity of the picked-up light. The light-receiving element 7 is operatively connected in series to an amplifier 8 of the electric signals V R , V G , V B which is itself connected to an analog-to-digital converter 9 for the amplified signal. A microcontroller assembly 10 is operatively interposed between the pick-up assembly 1b and the emission assembly 1a for controlling the supply currents I R , I G , I B of the three emission sources 4a, 4b, 4c according to the electric signals V R , V G , V B coming from the pick-up assembly 1b. In particular, the microcontroller assembly 10 is connected, with an input section thereof, to the analog-to-digital converter 9 and, with an output section, to the three current generators 6a, 6b, 6c. In the embodiment shown in Figure 4, the microcontroller assembly 10 is connected in series, with another output section thereof, to the amplifier 8 of the pick-up assembly 1b for the scattered light from the surface 2. The amplifier 8 is here a variable type of amplifier, that is one capable of varying, on command from the microprocessor 10, the amplification level of the electric signal generated by the light receiver 7. In a first alternative embodiment of the apparatus according to the invention (not shown), the amplifier 8 is substituted with three different amplification channels, one for each of the electric signals V R , V G , V B . In a second alternative embodiment of the apparatus according to the invention (not shown), the apparatus 1 has no analog-to-digital converter 9 and includes a circuit for measuring the electric signals V R , V G , V B and controlling the supply currents I R , I G , I B which operates by processing analog signals. In operation, the apparatus 1 is set, during a first acquisition step, for storing parameters representing a color to be subsequently recognized. During a subsequent recognition step, the parameters representing the color of the surface 2 of the object 3 being scanned are compared with those acquired during the previous step, thereby to discriminate the color of the surface 2. In particular, during the first acquisition step, the apparatus 1 is placed in front of an acquisition surface bearing the color to be acquired. This surface is illuminated sequentially with each of the three light beams from the emission sources 4a, 4b, 4c; scattered light is picked up by the light-receiving element 7 to generate, accordingly, an analog electric signal V R , V G , V B which is proportional to the luminous intensity of the picked-up light. This electric signal is then amplified, converted to a digital signal, and delivered to the microcontroller assembly 10. In particular, the microcontroller assembly 10 controls the supply current I R , I G , I B of the emission sources 4a, 4b, 4c such that the three signals V R , V G , V B received are all equal, within a predetermined tolerance margin, to a predetermined reference value. Alternatively, where this control is impracticable, the microcontroller assembly 10 could control the supply current I R , I G , I B of the emission sources 4a, 4b, 4c such that the three signals V R , V G , V B received are all equal, within a predetermined tolerance margin, to the smallest among them. Alternatively, where both of the above controls are impracticable, the microcontroller assembly 10 could control the supply current I R , I G , I B of the emission sources 4a, 4b, 4c such that only two of the signals V R , V G , V B having the highest values are identical, within a predetermined tolerance margin. In either case and regardless of the type of control applied, the microcontroller assembly 10 will store the values of the signals V R , V G , V B received after said control and the values of the respective supply currents I R , I G , I B , and calculate the following reference parameters: R = V R V R +V G +V B G = V G V R +V G +V B B = V B V R +V G +V B The above parameters are stored up. During the subsequent recognition step, the apparatus 1 is placed in front of a detecting surface 2 bearing the color to be discriminated. The apparatus sequentially illuminates said surface 2 with the three light beams from the emission sources 4a, 4b, 4c, and similarly as in the acquisition step, electric signals V R ', V G ', V B ' are generated which are proportional to the luminous intensity of the light scattered from the surface 2 and picked up in the light-receiving element 7. Here again, reference variables R', G', B' are calculated and compared with the parameters R, G, B previously calculated during the acquisition step to check if they match within a predetermined tolerance margin, and ultimately recognize the color of the surface 2. The process of this invention for discriminating the color of the surface 2 will now be explained in detail. Referring to Figure 2, the acquisition procedure provides for the initial setting of a range of values for the supply current I R , I G , I B of the emission sources 4a, 4b, 4c to lie between a minimum (BASE) value initially set at zero and a maximum (DELTA) value initially set at a maximum value (MAX); the apparatus 1 is then controlled to supply one of the current generators 6a, 6b, 6c with a actual value (EMISS) of the supply current I R , I G , I B equal to the maximum value (MAX). A check is then made to see if the corresponding signal, e.g. V R , has a value within a predetermined range defined by a reference value, being for example one half the reference voltage V ref used by the converter 9 plus or minus a predetermined tolerance margin H y which may be selected, for example, according to the signal noise. In particular, during a first step, it is checked that V R is lower than the upper value (V sup =V ref /2+H y ) of said range, and if so, it is checked that V R is higher than above the lower value (V inf =V ref /2-H y ) in the same range. If both checks give a positive result, the values of said signal V R and respective supply current I R are stored, and the above checks are repeated iteratively for the following signals V G and V B . Conversely, if it is V R >V sup , the actual value of the supply current I R is halved, and the above checks are repeated iteratively until V R falls within the predetermined range of values. If it is V R <V inf , a step is carried out to check if the actual value (EMISS) of the supply current I R , I G , I B equals the value (MAX) set at the start. If such check gives a negative result, the value of the supply current I R is updated by setting, as the actual value (EMISS), the previously defined value (BASE), and as the value (DELTA), a value equal to one half the previously set value (DELTA), and the comparison is repeated for V R until V R falls within the predetermined range of values. On the contrary, if (EMISS)=(MAX), since it would be no longer possible to raise the actual value (EMISS) of the supply current, the values of the signals V G and V B and respective supply currents I G and I B are acquired, by repeating the steps previously described for V R , and as the reference value Vric(0), the value of the smallest of the digital signals V R , V G , V B is set. It is then checked if V ric(0) is equal to or higher than a first predetermined minimum value (Vmin), for example equal to one third the value of the smallest acceptable sum (Den_min) of the values of the signals V R , V G , V B ; if such check gives a positive result, the acquisition steps previously described are repeated starting with V R for the three signals V R , V G , V B , each time checking that the values of all the signals V R , V G , V B obtained are within a range of values defined as V ric(0) , plus or minus the aforementioned tolerance margin H y . If, on the contrary, V ric(0) is found to be lower than Vmin, a decision is made to abandon the attempt to equalize all three of the signals from the three emissions, in particular accepting that one of them is different, and an equalization of the two others is attempted if they are higher than a predetermined minimum. In particular, the value of the smallest signal between the remaining two signals V R , V G , V B is set as the reference value V ric(1) , and it is checked if the reference value thus set is equal to or higher than a second minimum value equal, for example, to one half the difference between the value (Den_min) of the smallest acceptable sum of the values of the signals V R , V G , V B and the value of the signal V ric(0) . If such check gives a positive result, V ric(0) is set as the reference value for the smallest signal of the digital signals V R , V G , V B , and V ric(1) is set as the reference value of the two remaining signals; thus, new reference ranges are established, similarly as above, at V ric(0) and V ric(1) , respectively for the smallest of the digital signals V R , V G , V B and for the two remaining signals, and the aforementioned acquisition steps V R , V G , V B are repeated, checking that each of them lies within its respective reference range. If, on the contrary, V ric(1) is found smaller than said second minimum value, the acquisition procedure is terminated with an error indication. According to the embodiment shown in Figure 5, where the apparatus 1 is equipped with a variable type of amplifier, the acquisition procedure begins with the setting of a minimum amplification level, to be raised iteratively by one prefixed interval in the event that no signal V R , V G , V B can be received which lies within the reference range defined at the reference value V ref , so as to avoid possible saturation or excessively low levels of the components V R , V G , V B . The first step of the acquisition procedure described above may alternatively, be carried out simultaneously for the three emissions; in any case, this procedure would be terminated by an error indication, or preferably, by determining and storing the three supply current values of the LEDs by which each signal V R , V G , V B received lies within the predetermined range of reference values. With the emission levels thus determined, a plurality of measurements of V R , V G , V B are then made. Owing to noise, the measured values of V R , V G , V B would not always be the same, but they vary. An arithmetical mean of the values received at each emission can then be calculated, whereby minimum and maximum limits of such values can be calculated by respectively adding to and subtracting from said arithmetical mean a predetermined error selected to suit specific application requirements(e.g., taking account of the error from conversion, noise, etc.). At this point, the reference parameters R, G, B are calculated, and upper and lower limits are calculated for each of them using the following formulae: R_sup = VRmax/(VRmax + VGmin + VBmin) R_inf = VRmin/(VRmin + VGmax + VBmax) G_sup = VGmax/(VRmin + VGmax + VBmin) G_inf = VGmin/(VRmax + VGmin + VBmax) B_sup = VBmax/(VRmin + VGmin + VBmax) B_inf = VBmin/(VRmax + VGmax + VBmin). The above reference parameters are stored up. In this way, during the following "recognition" step, no wrong recognition will be made because of the error affecting each conversion (error on the analog signal and converter error). Furthermore, an addition tolerance margin may be introduced (for instance, to avoid errors from variations in the received signal due to temperature, etc.) by multiplying the values VRmax, VGmax and VBmax by a factor (1+Toll), where Toll=2.5%, for example, and the values VRmin, VGmin and VBmin by a factor (1-Toll), before determining the upper and lower limits of VR, VG, VB. Also, to avoid having the parameters R, G, B affected by a too large error (which would harm the color discrimination accuracy), the sum of the three signals VR, VG, VB is imposed higher than a certain value given by the ratio of the error affecting the received signal (converter error and noise) to the largest error that can be accepted in conformity with the color discrimination accuracy sought. Where a plurality of colors, rather than a single color, are to be discriminated, the procedure described hereinabove would be repeated sequentially for all the colors to be subsequently recognized, each time storing the respective triplets of supply currents IR, IG, IB determined. Lastly, where a color range, i.e. a plurality of different hues of a predetermined color, are to be acquired, the acquisition procedure comprises two discrete training steps. During a first step, the same procedure for color acquisition as described above is followed, whereby one of the two extremes of the color range to be recognized is determined. The values VRmax1, VGmax1, VBmax1 and VRmin1, VGmin1, VBmin1 relating to this first step are then defined, and on their basis, the following reference parameters are calculated: R_sup1 = VRmax1/(VRmax1 + VGmin1 + VBmin1) R_inf1 = VRmin1/(VRmin1 + VGmax1 + VBmax1) G_sup1 = VGmax1/(VRmin1 + VGmax1 + VBmin1) G_inf1 = VGmin1/(VRmax1 + VGmin1 + VBmax1) B_sup1 = VBmax1/(VRmin1 + VGmin1 + VBmax1) B_inf1 = VBmin1/(VRmax1 + VGmax1 + VBmin1). At this point, without changing the supply current values determined during the first training step, a second acquisition is carried out for the other extreme of the color range to be recognized. Thus, the values VRmax2, VGmax2, VBmax2 and VRmin2, VGmin2, VBmin2 relating to this second step are defined, and it is checked that the maximum values do not lie next to the converter end-of-scale (for example, lower than NFS-3, where NFS is the highest value that the converter can provide, namely 255 for an 8-bit converter, 511 for a 9-bit converter, etc.), and that the sum of the signals is higher than the lowest acceptable value. If these checks give a positive result, the following reference parameters are calculated: R_sup2 = VRmax/(VRmax + VGmin + VBmin) R_inf2 = VRmin/(VRmin + VGmax + VBmax) G_sup2 = VGmax/(VRmin + VGmax + VBmin) G_inf2 = VGmin/(VRmax + VGmin + VBmax) B_sup2 = VBmax/(VRmin + VGmin + VBmax) B_inf2 = VBmin/(VRmax + VGmax + VBmin). Thereafter, as the upper and lower limits of the parameters representing the color range to be recognized, the maximum and minimum values of the parameters just calculated are respectively selected, namely: R_sup = maximum {R_sup1, R_sup2} R_inf = minimum {R_inf1, R_inf2} G_sup = maximum {G_sup1, G_sup2} G_inf = minimum {G_inf1, G_inf2} B_sup = maximum {B_sup1, B_sup2} B_inf = minimum {B_inf1, B_inf2}. On completion of the acquisition step, the apparatus 1 of this invention will be able to recognize the color (and/or colors, or color range) acquired. In particular, according to the recognition procedure shown in Figure 3, variables representing the color to be recognized are determined, similar as in the acquisition procedure. These variables are calculated on the basis of the signals VR', VG', VB' received at the light-receiving element 7 when the surface 2 bearing the color to be recognized is illuminated. Each one of the signals VR', VG', VB' is compared with a saturation value equal, for example, to NFS-Hy, in order to check that they are lower said saturation value, and that their sum is higher than a predetermined minimum value equal, for example, to the value Den_min. If both checks give a positive result, the two signals NUM1 and NUM2 having the highest values are selected among the signals VR', VG', VB', and for each selected signal, a reference variable Q1 and Q2 is defined which equals the ratio of the selected signal to the sum of the signals VR', VG', VB'. It is then checked that each of the reference variables Q1, Q2 is contained within a range of values defined by the upper (supl, sup2) and lower (infl, inf2) limits calculated during the previous acquisition step. Specifically, the values inf1, sup1, inf2 and sup2 are: if NUM1 is VR', then sup1=R_sup and inf1=R_inf if NUM1 is VG', then sup1=G_sup and inf1=G_inf if NUM1 is VB', then sup1=B_sup and inf1=B_inf if NUM2 is VR', then sup2=R_sup and inf2=R_inf if NUM2 is VG', then sup2=G_sup and inf2=G_inf if NUM2 is VB', then sup2=B_sup and inf1=B_inf. If all of the above checks give a positive result, the procedure is terminated with an indication of color recognition. If, on the contrary, at least one of the above checks gives a negative result, the procedure is terminated with an indication of color non-recognition. According to the embodiment shown in Figure 6, where the apparatus 1 is equipped with a variable type of amplifier, the recognition procedure would include the steps of lowering the amplification level of the signals VR', VG', VB' if one of said signals is higher than said saturation value. NFS-Hy, or raising it if the sum of the signals VR', VG', VB' is lower than the predetermined minimum value Den_min, thereby to prevent possible saturation or excessively low levels of the components VR', VG', VB'. This is possible because a variation in the amplifier gain would change the values of VR', VG', VB', but does not influence the calculation of said color-representing variables. In an alternative embodiment of the inventive process, all of the above steps can be advantageously carried out by respectively utilizing the parameters R. G, B instead of the signals VR, VG, VB in the acquisition procedure and the variables R', G', B' instead of the signals VR', VG', VB' in the recognition procedure. In this way, the color-discriminating operation can be made independent of the reading distance (distance of the apparatus from the detecting surface), which distance would affect the values of the individual signals VR, VG, VB and VR', VG', VB', but not the result of the ratio R, G, B and R', G', B'. The process of this invention, as above described, affords a number of advantages, among which are those listed here below. First of all, it provides an accurate discrimination of any color (and/or any color hue and/or plurality of different colors) on a surface, regardless of whether it corresponds to a primary color. Also, the process of this invention is unconditioned by either aging phenomena of the optical components mounted on the discriminating apparatus or spread phenomena of the basic operational parameters of such components. Further, the process of this invention allows a substantial increase in the working depth of field of the apparatus implementing the process and a considerable increase in color-discriminating capability, even where the signals generated by the light-receiving element are very weak (for instance, because originating from dark colors on a far surface) and/or very strong (for instance, because originating from light colors on a near surface).

Claims: A process for discriminating the color of a non-white detecting surface, comprising the steps of: a) acquiring the color to be discriminated by carrying out the following steps a1), a2) and a3): - al) sequentially illuminating a non-white acquisition surface having the color to be discriminated with a red light beam, a green light beam and a blue light beam, each of said light beams being generated by an emission source supplied with a supply current, respectively IR, IG, IB; a2) for each of the aforementioned three different light beams, receiving, by means of a light-receiving element, the light scattered from the illuminated acquisition surface, and a3) generating an electric signal proportional to the intensity of the received light, the electric signal being VR for red light, VG for green light and VB for blue light; b) acquiring the color of the non-white detecting surface by carrying out the following steps b1), b2) and b3): bl) sequentially illuminating, with the aforesaid three light beams, the non-white detecting surface having the color to be discriminated; b2) for each of the aforementioned three different light beams, receiving by means of a light-receiving element the light scattered from the illuminated detecting surface, and b3) generating an electric signal proportional to the intensity of the received light, the electric signal being VR' for red light, VG' for green light and VB' for blue light; c) comparing the color of the non-white detecting surface with the color of the non-white acquisition surface by comparing the electric signal VR', VG', VB' with the electric signal VR, VG, VB; characterized in that the acquisition step a) further comprises the step of: a4) controlling the supply currents IR, IG, IB of the emission sources such that at least two of the electric signals VR, VG, VB generated are identical with each other within a predetermined tolerance margin. A process according to claim 1, wherein the supply currents IR, IG, IB of the emission sources are controlled such that the electric signals VR, VG, VB generated are all identical with one another, within a predetermined tolerance margin. A process according to claim 2, wherein the supply currents IR, IG, IB of the emission sources are controlled such that the electric signals VR, VG, VB generated are all equal, within a predetermined tolerance margin, to a predetermined reference value. A process according to claim 2, wherein the supply currents IR, IG, IB of the emission sources are controlled such that the electric signals VR, VG, VB generated are all equal, within a predetermined tolerance margin, to the value of the smallest of said signals. A process according to claim 1, wherein the supply currents IR, IG, IB of the emission sources are controlled such that only two of the electric signals VR, VG, VB generated are higher than a predetermined minimum value, and, within a predetermined tolerance, margin, identical with each other. A process according to claim 1, wherein step a3) further includes the following steps: a31) generating, within the light-receiving element, an analog electric signal which is proportional to the intensity of the received light, the analog electric signal being a first one for red light, a second one for green light and a third one for blue light; a31) amplifying, to a predetermined amplifying level, the analog electric signals generated by the light-receiving element; a32) converting, by means of an analog-to-digital converter, the amplified analog signals to digital signals VR, VG, VB. A process according to claim 6, wherein the supply currents IR, IG, IB of the emission sources are controlled such that the electric signals VR, VG, VB generated are all equal, within a predetermined tolerance margin, to a predetermined reference value, and wherein step a4) further includes the following steps: a41) checking if each of the digital signals VR, VG, VB has its value within a predetermined range of values defined by said predetermined reference value plus/minus a predetermined tolerance margin and: a41a) if so, storing the values of said digital signals VR, VG, VB; a41b) if not so, iteratively varying the supply current within a predetermined range of current values, and repeating step a41) at each iteration. A process according to claim 7, wherein step a41) further includes the following steps: a411) setting the value of the supply current of the emission source which is supplied first at a first value equal to the highest value in a predetermined range of supply current values; a412) checking if the value of the signal generated first is lower than an upper limiting value of said predetermined range of values and: a412a) if so, checking that the value of said signal generated first is higher than a lower limiting value of said predetermined range of values, and if so, storing said first value of the supply current and iteratively repeating the steps from a411) for the emission source coming next in the supply sequence; a412b) if not so, reducing said first value of said supply current by a predetermined factor, and repeating step a412). A process according to claim 8, wherein, if the check of step a412a) gives a negative result, a step is carried out to check if said first value of the supply current IR, IG, IB is different from said highest value in the predetermined range of supply current values and: if so, taking as the supply current value a value equal to one half the difference between said highest value in the predetermined range of current values and said first value of the supply current and repeating the steps from a412); if not so, carrying out the following steps: a412a1) iteratively repeating the steps from a411) for the emission source coming next in the supply sequence; a412a2) setting, as the reference value, the value of the smallest of said digital signals and repeating the steps from a41). A process according to claim 9, wherein step a412a2) is preceded by a step of checking if said amplification level can be raised and: if so, raising by a predetermined interval said amplification level and iteratively repeating the steps from a411); if not so, carrying out the step a412a2). A process according to claim 9, wherein step a412a2) further includes the following steps: checking if the reference value set in step a412a2) is higher than a first predetermined minimum value and: if so, repeating the steps from a41); if not so, setting, as the reference value, the value of the smallest of the two remaining signals, and repeating the steps from a41). A process according to Claim 11, wherein if the check of step a412a2) gives a negative result, the following steps are carried out: checking if the reference value set in step a412a2) is higher than a second predetermined minimum value, and if so, setting, as a reference value for the smallest of said signals, the value of such a signal, and as a reference value for the two remaining signals, the value of the smallest of the two remaining signals, and repeating the steps from a41); if not so, indicating an error. A process according to claim 6, wherein the supply currents IR, IG, IB of the emission sources are controlled such that the electric signals VR, VG, VB generated are all equal, within a predetermined tolerance margin, to a predetermined reference value, and wherein the reference value is defined as one half a reference voltage utilized by the analog-to-digital converter employed. A process according to claim 11, wherein the first predetermined minimum value is one third of the smallest value of the sum of the signals values which is considered to be acceptable. A process according to Claim 12, wherein the second predetermined minimum value is one half the difference between the smallest value of the sum of the signal value which is considered to be acceptable and the value of the smallest of the signals VR, VG, VB. A process according to claim 8, further comprising the following steps: measuring said signals VR, VG, VB for a plurality of times, each time using the stored supply current values IR, IG, IB, respectively; calculating an arithmetical mean of the values of the signals VR measured by using the stored supply current IR, of the signals VG measured by using the stored supply current IG and of the signals VB measured by using the stored supply current IB; calculating the minimum and maximum limiting values of the digital signals VR, VG, VB by respectively adding and subtracting to/from said arithmetical mean a predetermined value of error, selected depending on the specific application. A process according to claim 16, further comprising the following steps: defining three reference parameters R, G, B respectively as the ratio of the value of each signal VR, VG, VB to the sum of the three signals; calculating, for each reference parameter, an upper (lower) limit respectively defined as the ratio of the maximum (minimum) value of the signal VR, VG, VB considered to the sum of that maximum (minimum) value plus the minimum (maximum) values of the other two signals VR, VG, VB. A process according to any of claims 1 to 16, further comprising the following steps: defining reference parameters R, G, B respectively as the ratio of the value of each signal VR, VG, VB to the sum of the three signals; using the parameters R, G, B in any of the steps of claims 1 to 16, instead of VR, VG, VB, respectively. A process according to any of the preceding claims,. wherein the step c) of comparing the color of the non-white detecting surface with the color of the non-white acquisition surface previously acquired further includes the following step: c1) checking that at least two of the values of the electric signals VR', VG', VB' generated during comparison step c) are equal, within a predetermined tolerance margin, to those of the electric signals VR, VG, VB generated during acquisition step a) and, if such a check gives a positive result: c2) indicating that the color is recognised. A process according to Claim 19, wherein step cl) includes the following steps: c1a) checking that the electric signals VR', VG', VB' generated during comparison step c) are lower than a predetermined saturation value and that their sum is higher than a predetermined minimum value and: cla1) if both of said checks give a positive result, carrying out step c2); cla2) if at least one of said checks gives a negative result, indicating that the color of the detecting surface is not recognized. A process according to Claim 20 when depending on claim 19 and claim 6, wherein, if the first (second) of the checks of step c1a) gives a negative result, a step is carried out to check if the amplification level can be lowered (raised) and: if so, lowering (raising) said amplification level by a predetermined interval and repeating the steps from c1a); it not so, indicating that the color of the detecting surface is not recognized. A process according to any of claims 19 to 21, further comprising the following steps: defining, for each of the three signal VR', VG', VB' generated during comparison step c), a reference variable R', G', B' equal to the ratio of the each of said signals to the sum of the three signals VR', VG', VB'; using R', G', B' in the steps of Claims 19 to 21 instead of VR', VG', VB'. A process according to claim 20, wherein step c1a) further includes the following steps: selecting, from the signals VR', VG', VB', the two signals having the highest values; defining, for each of the two selected signals, a reference variable equal to the ratio of each of the selected signal to the sum of the signals VR', VG', VB'; checking if each of the reference variables above defined falls within a respective predetermined range of values and: if the above check gives a positive result for both said variables, indicating that the color of the detecting surface is recognized; if the above check gives a negative result for at least one of said variables, indicating that the color of the detecting surface is not recognized. A process according to claim 1, wherein the color acquired during steps a1) to a4) is a first color representing a first color hue of the color to be discriminated, and further comprising the following steps prior to steps b1) to b3) and c) : i) storing the supply current values determined during steps a1) to a4); ii) performing, according to step a1) to a3) and using the supply current values stored in step i), a second acquisition of a second color representing a second color hue of the color to be discriminated; wherein the electric signal VR, VG and VB of step c) are representative of the electric signals acquired during previous acquisition steps a1) to a4) and ii) and such signals VR, VG and VB are compared with signal VR', VG', VB' acquired during steps b1) to b3) to check that they are the same, within a predetermined tolerance margin. Equipment for discriminating the color of a non-white detecting surface, comprising a discriminating apparatus and a non-white acquisition surface having the color to be discriminated, wherein the discriminating apparatus comprises: a first emission source (4a) supplied with a supply current IR and arranged to illuminate the surface with red light; a second emission source (4b) supplied with a supply current IG and arranged to illuminate the surface with green light; a third emission source supplied (4c) with a supply current IB and arranged to illuminate the surface with blue light; a light-receiving element (7) adapted to receive light scattered from the illuminated surface (2) and generate an electric signal which is proportional to the luminous intensity of the received light, the electric signal being VR for red light, VG for green light and VB for blue light; characterized in that the apparatus further comprises a microcontroller assembly (10) arranged to control the supply current IR, IG, IB of the emission sources (4a,4b,4c) in such a way that at least two of the electric signals VR, VG, VB generated are identical with each other within a predetermined tolerance margin when said non-white acquiqition surface is illuminated An equipment according to claim 25, wherein the emission sources (4a,4b,4c) are either LEDs or laser diodes. An equipment according to claim 25, further comprising an amplifier (8) for amplifying, to a predetermined amplification level, the signals generated by the light-receiving element, and an analog-to-digital converter (9) . for converting said amplified signals. An equipment according to claim 27, wherein said amplifier (8) comprises three separate amplification channels, each for amplifying one of the signals VR, VG, VB. An equipment according to claim 27, wherein the amplifier (8) is operatively associated with the microcontroller assembly (10) so that the amplification level of the signals VR, VG, VB can be varied depending on the specific application.

Inventors: RIGHI GIANFRANCO, TAMANTI MARIA LISA, RIGHI, GIANFRANCO, TAMANTI, MARIA LISA
Applicants: DATASENSOR S P A, DATASENSOR S.P.A.
Application year: 1998
Main classification: G01N21
IPC codes: G01J1, G01J3, G01N21