# Patent

## Title
Miniature colorimeter

## Abstract

The invention relates to a process for discriminating the color of a surface, comprising the steps of acquiring at least a colored acquisition surface, 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 comprises the steps of 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; picking up by means of a light-receiving element the light scattered from the illuminated acquisition surface; 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 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.

## Background
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.sub.R, V.sub.G, V.sub.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 sensibility in the visible range. In such discriminators, the emission LEDs are supplied by impulse with respective supply currents I.sub.R, I.sub.G, I.sub.B, such that, at each current impulse supplied, corresponding electric signals V.sub.R, V.sub.G, V.sub.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.sub.R, V.sub.G, V.sub.B generated during normal operation of the discriminator).

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.sub.R, V.sub.G, V.sub.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 surface, comprising the steps of: previously acquired, so that said color can be recognized; 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; from the illuminated acquisition surface; intensity of the picked-up light, as the acquisition surface is being illuminated with each of the three beams; 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.sub.R, V.sub.G, V.sub.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.

Preferably, the supply current I.sub.R, I.sub.G, I.sub.B of the emission sources is controlled in the inventive process such that the electric signals V.sub.R, V.sub.G, V.sub.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.sub.R, I.sub.G, I.sub.B of the emission sources is controlled such that the electric signals V.sub.R, V.sub.G, V.sub.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 field depth 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.sub.R, V.sub.G, V.sub.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.sub.R, V.sub.G, V.sub.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.sub.R, V.sub.G, V.sub.B has its value within a predetermined range of values defined by said reference value plus/minus a predetermined tolerance margin and: V.sub.B predetermined range of current values, and repeating step a41) at each iteration.

In particular, step a41) preferably includes the following steps: source which is supplied first at a actual value equal to the highest value in a predetermined range of supply current values; generated is lower than an upper limiting value of said predetermined range of values and: than a lower limiting value of said predetermined range of values, and if so, storing the actual value of the supply current IR, IG, IB and iteratively repeating the steps from a411) for the emission source coming next in the supply sequence; predetermined factor, and iteratively repeating step a412).

Where the above-described control cannot be implemented, the supply current I.sub.R, I.sub.G, I.sub.B of the emission sources is controlled such that the electric signals V.sub.R, V.sub.G, V.sub.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.sub.R, I.sub.G, I.sub.B is different from the highest value in the predetermined range of current values and: to check if the actual value of the supply current IR, IG, IB is different from the highest value in the predetermined range of current values and: difference between the highest value in the predetermined range of current values and the actual value of the supply current IR, IG, IB and repeating the steps from a412); coming next in the supply sequence; digital signals VR, VG, VB 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 the amplification level can be raised and: iteratively repeating the steps from a411);

In this way, a high capability for discrimination of colors can be ensured even in situations where the signals generated by the light-receiving element are too weak (e.g., because originating from light colors on a far surface) or too strong (e.g., because originating from dark colors on a near surface), thereby increasing both the field depth and the precision of the color discriminating process.

Preferably, where none of the above described controls can be implemented, the supply current I.sub.R, I.sub.G, I.sub.B of the emission sources is controlled such that only two of the electric signals V.sub.R, V.sub.G, V.sub.B generated are equal to each other, within a predetermined tolerance margin, and higher than a predetermined minimum value. In particular, step a412a2) further includes the following steps: predetermined minimum value and: V.sub.G, V.sub.B as the reference value, and repeating the steps from a41).

Preferably, said first predetermined minimum value is one third the value of the smallest acceptable sum of the signal V.sub.R, V.sub.G, V.sub.B values.

If the check of step a412a2) gives a negative result, the following steps are carried out specifically: value, and signals V.sub.R, V.sub.G, V.sub.B, the actual value of that signal, and as the reference value for the remaining two signals the value of the smaller of the two actual remaining signals, and repeating the steps from a41);

Preferably, said second predetermined minimum value is one half the difference between the value of the smallest acceptable sum of the signal V.sub.R, V.sub.G, V.sub.B values and the value of the smallest of the signals V.sub.R, V.sub.G, V.sub.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.sub.R, V.sub.G, V.sub.B generated correspondingly with the aforesaid supply currents: current values IR, IG, IB; corresponding to each stored supply current IR, IG, IB; VR, VG, VB by respectively adding and subtracting to/from said arithmetical mean a predetermined error, selected to suit specific application requirements.

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: value of each signal V.sub.R, V.sub.G, V.sub.B to their sum; respectively defined as the ratio of the maximum (minimum) value of the signal V.sub.R, V.sub.G, V.sub.B considered to the sum of that maximum (minimum) value plus the minimum (maximum) values of the other two signals V.sub.R, V.sub.G, V.sub.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 recognition step b) includes the following steps: detecting surface bearing the color to be recognized; scattered from said illuminated surface; proportional to the luminous intensity of the picked-up light, as the detecting surface is being illuminated with each of the three beams; V.sub.R ', V.sub.G ', V.sub.B ' generated are equal, within a predetermined tolerance margin, to those of the electric signals V.sub.R, V.sub.G, V.sub.B acquired during step a).

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 b4) includes the following steps: generated are lower than a predetermined saturation value and that their sum is higher a predetermined minimum value and: that the color of the surface being scanned is not recognized.

Even more preferably, step b41a) further includes the following steps: signals having the highest values; equal to the ratio of the selected signal to the sum of the signals V.sub.R ', V.sub.G ', V.sub.B '; respective predetermined range of values and: indicating that the color is recognized; variables, indicating that the color of the surface being scanned 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.sub.R, V.sub.G, V.sub.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 b41) gives a negative result, a step is carried out to check if the amplification level can be varied, and the steps from b41) are repeated iteratively; recognized.

According to a second aspect, the invention relates to a process for discriminating a color range of a surface, characterized in that it comprises the following steps: color establishing one extreme of a color range to be recognized; values, a second acquisition of a second color establishing the other extreme of said color range; V.sub.B ' generated during the recognition step previously described, are the same, within a predetermined tolerance margin, as those of the electric signals V.sub.R, V.sub.G, V.sub.B acquired during the aforesaid acquisition steps.

According to a third aspect, the invention relates to a process for discriminating a plurality of colors on a surface, characterized in that it comprises the following steps: acquisitions of a plurality of colors; step; V.sub.B ' generated during the recognition steps previously described, are the same, within a predetermined tolerance margin, as those of the electric signals V.sub.R, V.sub.G, V.sub.B acquired during the aforesaid acquisition steps.

Lastly, according to a fourth aspect, the invention relates to an apparatus for discriminating the color of a surface, comprising: colors being respectively supplied with a supply current I.sub.R, I.sub.G, I.sub.B ; illuminated surface and generate an electric signal V.sub.R, V.sub.G, V.sub.B which is proportional to the luminous intensity of the picked-up light; controlling the supply current I.sub.R, I.sub.G, I.sub.B of the emission sources such that at least two of the electric signals V.sub.R, V.sub.G, V.sub.B generated are identical with each other, within a predetermined tolerance margin.

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:

FIG. 1 is a block diagram illustrating a first embodiment of an apparatus for discriminating the color of a surface according to the invention;

FIG. 2 is a flow diagram relating to a first step of a discriminating process implemented by the apparatus of FIG. 1;

FIG. 3 is a flow diagram relating to a second step of the discriminating process implemented by the apparatus of FIG. 1;

FIG. 4 is a block diagram illustrating a second embodiment of an apparatus for discriminating the color of a surface according to the invention;

FIG. 5 is a flow diagram relating to a first step of a discriminating process implemented by the apparatus of FIG. 4;

FIG. 6 is a flow diagram relating to a second step of the discriminating process implemented by the apparatus of FIG. 4.

Shown at 1 in FIGS. 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.sub.R, I.sub.G, I.sub.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.sub.R, V.sub.G, V.sub.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.sub.R, V.sub.G, V.sub.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.sub.R, I.sub.G, I.sub.B of the three emission sources 4a, 4b, 4c according to the electric signals V.sub.R, V.sub.G, V.sub.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 FIG. 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.sub.R, V.sub.G, V.sub.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.sub.R, V.sub.G, V.sub.B and controlling the supply currents I.sub.R, I.sub.G, I.sub.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.sub.R, V.sub.G, V.sub.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.sub.R, I.sub.G, I.sub.B of the emission sources 4a, 4b, 4c such that the three signals V.sub.R, V.sub.G, V.sub.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.sub.R, I.sub.G, I.sub.B of the emission sources 4a, 4b, 4c such that the three signals V.sub.R, V.sub.G, V.sub.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.sub.R, I.sub.G, I.sub.B of the emission sources 4a, 4b, 4c such that only two of the signals V.sub.R, V.sub.G, V.sub.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.sub.R, V.sub.G, V.sub.B received after said control and the values of the respective supply currents I.sub.R, I.sub.G, I.sub.B, and calculate the following reference parameters: ##EQU1##

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.sub.R ', V.sub.G ', V.sub.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 FIG. 2, the acquisition procedure provides for the initial setting of a range of values for the supply current I.sub.R, I.sub.G, I.sub.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.sub.R, I.sub.G, I.sub.B equal to the maximum value (MAX). A check is then made to see if the corresponding signal, e.g. V.sub.R, has a value within a predetermined range defined by a reference value, being for example one half the reference voltage V.sub.ref used by the converter 9 plus or minus a predetermined tolerance margin H.sub.y which may be selected, for example, according to the signal noise. In particular, during a first step, it is checked that V.sub.R is lower than the upper value (V.sub.sup =V.sub.ref /2+H.sub.y) of said range, and if so, it is checked that V.sub.R is higher than above the lower value (V.sub.inf =V.sub.ref /2-H.sub.y) in the same range.

If both checks give a positive result, the values of said signal V.sub.R and respective supply current I.sub.R are stored, and the above checks are repeated iteratively for the following signals V.sub.G and V.sub.B. Conversely, if it is V.sub.R >V.sub.supt, the actual value of the supply current I.sub.R is halved, and the above checks are repeated iteratively until V.sub.R falls within the predetermined range of values. If it is V.sub.R <V.sub.inf, a step is carried out to check if the actual value (EMISS) of the supply current I.sub.R, I.sub.G, I.sub.B equals the value (MAX) set at the start. If such check gives a negative result, the value of the supply current I.sub.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.sub.R until V.sub.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.sub.G and V.sub.B and respective supply currents I.sub.G and I.sub.B are acquired, by repeating the steps previously described for V.sub.R, and as the reference value V.sub.ric(0), the value of the smallest of the digital signals V.sub.R, V.sub.G, V.sub.B is set.

It is then checked if V.sub.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.sub.-- min) of the values of the signals V.sub.R, V.sub.G, V.sub.B ; if such check gives a positive result, the acquisition steps previously described are repeated starting with V.sub.R for the three signals V.sub.R, V.sub.G, V.sub.B, each time checking that the values of all the signals V.sub.R, V.sub.G, V.sub.B obtained are within a range of values defined as V.sub.ric(0) plus or minus the aforementioned tolerance margin H.sub.y. If, on the contrary, V.sub.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.sub.R, V.sub.G, V.sub.B is set as the reference value V.sub.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.sub.-- min) of the smallest acceptable sum of the values of the signals V.sub.R, V.sub.G, V.sub.B and the value of the signal V.sub.ric(0). If such check gives a positive result, V.sub.ric(0) is set as the reference value for the smallest signal of the digital signals V.sub.R, V.sub.G, V.sub.B, and V.sub.ric(1) is set as the reference value of the two remaining signals; thus, new reference ranges are established, similarly as above, at V.sub.ric(0) and V.sub.ric(1), respectively for the smallest of the digital signals V.sub.R, V.sub.G, V.sub.B and for the two remaining signals, and the aforementioned acquisition steps V.sub.R, V.sub.G, V.sub.B are repeated, checking that each of them lies within its respective reference range. If, on the contrary, V.sub.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 FIG. 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.sub.R, V.sub.G, V.sub.B can be received which lies within the reference range defined at the reference value V.sub.ref, so as to avoid possible saturation or excessively low levels of the components V.sub.R, V.sub.G, V.sub.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.sub.R, V.sub.G, V.sub.B received lies within the predetermined range of reference values.

With the emission levels thus determined, a plurality of measurements of V.sub.R, V.sub.G, V.sub.B are then made. Owing to noise, the measured values of V.sub.R, V.sub.G, V.sub.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:

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 Vmax, 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 the1argest 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:

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:

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:

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 FIG. 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.sub.-- 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 (sup1, sup2) and lower (inf1, inf2) limits calculated during the previous acquisition step. Specifically, the values inf1, sup1, inf2 and sup2 are:

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 FIG. 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.sub.-- 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 inf1uence 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 field depth 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

1. A process for discriminating the color of a surface, comprising the steps of: previously acquired, so that said color can be recognized; wherein the acquisition step a) comprises the following steps: 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; from the illuminated acquisition surface; intensity of the picked-up light, as the acquisition surface is being illuminated with each of the three beams; that at least two of the electric signals VR, VG, VB generated are identical with each other within a predetermined tolerance margin; and wherein the recognition step b) includes the following steps: detecting surface bearing the color to be recognized; scattered from said illuminated surface; luminous intensity of the picked-up light, as the detecting surface is being illuminated with each of the three beams; than a predetermined saturation value and that their sum is higher a predetermined minimum value and: two of the values of the electric signals VR', VG', VB' generated are equal, within a predetermined tolerance margin, to those of the electric signals VR, VG, VB acquired during step a); that the color of the surface being scanned is not recognized.

2. A process according to claim 1, wherein step b41a) further includes the following steps: highest values; equal to the ratio of the selected signal to the sum of the signals VR', VG', VB'; respective predetermined range of values and: indicating that the color is recognized; variables, indicating that the color of the surface being scanned is not recognized.

3. A process for discriminating a color range of a surface, characterized in that it comprises the following steps: establishing one extreme of a color range to be recognized; values, a second acquisition of a second color establishing the other extreme of said color range; generated during the recognition step, according to claim 1, are the same, within a predetermined tolerance margin, as those of the electric signals VR, VG, VB acquired during said acquisition steps.

4. A process for discriminating a plurality of colors on a surface, characterized in that it comprises the following steps: of a plurality of colors; step; during the recognition steps according to claim 1, are the same, within a predetermined tolerance margin, as those of the electric signals VR, VG, VB acquired during said acquisition steps.

5. A process according to claim 3, wherein the supply current IR, IG, IB of the emission sources is controlled such that only two of the electric signals VR, VG, VB generated are identical with each other, within a predetermined tolerance margin, and higher than a predetermined minimum value.

6. A process for discriminating the color of a colored surface, comprising the following steps: discriminated 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; from the illuminated acquisition surface; intensity of the picked-up light, as the acquisition surface is being illuminated with each of the three beams; that at least two of the electric signals VR, VG, VB generated are identical with each other, within a predetermined tolerance margin; current values IR, IG, IB thus controlled; discriminated with said color previously acquired, so that said color of the detecting surface can be recognized.

7. A process according to claim 6, wherein the supply current IR, IG, IB of the emission sources is controlled such that the electric signals VR, VG, VB generated are all identical with one another, within a predetermined tolerance margin.

8. A process according to claim 7, wherein the supply current IR, IG, IB of the emission sources is controlled such that the electric signals VR, VG, VB generated are all equal, within a predetermined tolerance margin, to a predetermined reference value.

9. A process according to claim 5, wherein the supply current IR, IG, IB of the emission sources is 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.

10. A process according to claim 5, wherein step a3) further includes the following steps: signal which is proportional to the intensity of the picked-up light; element;

11. A process according to claims 10, wherein the supply current IR, IG, IB of the emission sources is 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: within a predetermined range of values defined by said reference value plus/minus a predetermined tolerance margin and: predetermined range of current values, and repeating step a41) at each iteration.

12. A process according to claim 11, wherein step a41) further includes the following steps: source which is supplied, first at a actual value equal to the highest value in a predetermined range of supply current values; generated is lower than an upper limiting value of said predetermined range of values and: than a lower limiting value of said predetermined range of values, and if so, storing the actual value of the supply current IR, IG, IB and iteratively repeating the steps from a411) for the emission source coming next in the supply sequence; predetermined factor, and iteratively repeating step a412).

13. A process according to claim 12, wherein, 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 IR, IG, IB is different from the highest value in the predetermined range of current values and: difference between the highest value in the predetermined range of current values and the actual value of the supply current IR, IG, IB and repeating the steps from a412); coming next in the supply sequence; digital signals VR, VG, VB and repeating the steps from a41).

14. A process according to claim 13, wherein step a412a2) is preceded by a step of checking if the amplification of the analog electric signal can be increased and, if so, increasing by a predetermined interval the amplification of the analog electric signal and iteratively repeating the steps from a411);

15. A process according to claim 13, wherein step a412a2) further includes the following steps: predetermined minimum value and: VB as the reference value, and repeating the steps from a41).

16. A process according to claim 5, wherein if the check of step a412a2) gives a negative result, the following steps are carried out: value, and signals VR, VG, VB, the actual value of that signal, and as the reference value for the remaining two signals the value of the smaller of the two actual remaining signals, and repeating the steps from a41);

17. A process according to claim 10, wherein the supply current IR, IG, IB of the emission sources is 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 the reference voltage utilized by an analog-to-digital converter employed.

18. A process according to claim 15, wherein the first predetermined minimum value is one third the value of the smallest acceptable sum of the signals VR, VG, VB values.

19. A process according to claim 16, wherein the second predetermined minimum value is one half the difference between the value of the smallest acceptable sum of the signal VR, VG, VB values and the value of the smallest of the signals VR, VG, VB.

20. A process according to claim 12, further comprising the following steps: current values IR, IG, IB; corresponding to each stored supply current IR, IG, IB; VR, VG, VB by respectively adding and subtracting to/from said arithmetical mean a predetermined error, selected to suit specific application requirements.

21. A process according to claim 20, further comprising the following steps: value of each signal VR, VG, VB to their sum; defined as the ratio of the maximum value of the signal VR, VG, VB considered to the sum of that maximum value plus the minimum values of the other two signals VR, VG, VB.

22. A process according to claim 20, further comprising the following steps: value of each signal VR, VG, VB to their sum; defined as the ratio of the minimum value of the signal VR, VG, VB considered to the sum of that minimum value plus the maximum values of the other two signals VR, VG, VB.

23. A process according to claim 6, wherein the recognition step b) includes the following steps: detecting surface bearing the color to be recognized; scattered from said illuminated surface; luminous intensity of the picked-up light, as the detecting surface is being illuminated with each of the three beams; VG', VB' generated are equal, within a predetermined tolerance margin, to those of the electric signals VR, VG, VB acquired during step all to a5).

24. A process according to claim 23, wherein step b4) includes the following steps: than a predetermined saturation value and that their sum is higher a predetermined minimum value and: that the color of the surface being scanned is not recognized.

25. A process according to claim 24, wherein the electric signal are amplified to an amplification level and if the first of the checks of step b41) gives a negative result, a step is carried out to check if the amplification level can be lowered and: iteratively repeating the steps from b41); recognized.

26. A process according to claim 24, wherein the electric signal are amplified to an amplification level and if the second of the checks of step b41) gives a negative result, a step is carried out to check if the amplification level can be raised and: iteratively repeating the steps from b41); recognized.

27. A process according to claim 24, wherein step b41a) further includes the following steps: highest values; equal to the ratio of the selected signal to the sum of the signals VR', VG', VB'; respective predetermined range of values and: indicating that the color is recognized; variables, indicating that the color of the surface being scanned is not recognized.

28. A process for discriminating a color range of a surface, characterized in that it comprises the following steps: establishing one extreme of a color range to be recognized; values, a second acquisition of a second color establishing the other extreme of said color range; generated during the recognition step, are the same, within a predetermined tolerance margin, as those of the electric signals VR, VG, VB acquired during said acquisition steps a1) to a5).

29. A process for discriminating a plurality of colors on a surface, characterized in that it comprises the following steps: of a plurality of colors; step; during the recognition steps are the same, within a predetermined tolerance margin, as those of the electric signals VR, VG, VB acquired during said acquisition steps a1) to a5).

30. An apparatus for discriminating the color of a colored surface, comprising: colors being respectively supplied with a supply current IR, IG, IB; illuminated surface and generate an electric signal VR, VG, VB which is proportional to the luminous intensity of the picked-up light; the emission sources such that when an acquisition surface having the color to be discriminated is illuminated at least two of the electric signals VR, VG, VB generated are identical with each other, within a predetermined tolerance margin.

31. An apparatus according to claim 30, wherein the emission sources (4a, 4b, 4c) are either LEDs or1aser diodes.

32. An apparatus according to claim 30, further comprising an amplifier (8) for amplifying the analog signals generated by the light-receiving element, and an analog-to-digital converter (9) for converting said amplified signals.

33. An apparatus according to claim 32, wherein said amplifier (8) comprises three separate amplification channels, each for amplifying one of the signals VR, VG, VB.

34. An apparatus according to claim 32, 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 to suit specific application requirements.

35. A process for discriminating the color of a colored surface, comprising the following steps: discriminated 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; from the illuminated acquisition surface; the picked-up light, as the acquisition surface is being illuminated with each of the three beams and converting said electric signal into a digital signal VR, VG, VB; within a predetermined range of values defined by a reference value plus/minus a predetermined tolerance margin, and: the supply current values IR, IG, IB thus controlled and discriminated with said color previously acquired, so that said color of the detecting surface can be recognized; predetermined range of current values, and repeating step a41) at each iteration.

36. A process according to claim 35, wherein step a41) further includes the following steps: source whiqh is supplied first at a actual value equal to the highest value in a predetermined range of supply current values; generated is lower than an upper limiting value of said predetermined range of values and: than a lower limiting value of said predetermined range of values, and if so, storing the actual value of the supply current IR, IG, IB and iteratively repeating the steps from a411) for the emission source coming next in the supply sequence; predetermined factor, and iteratively repeating step a412).

37. A process according to claim 36, wherein, 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 IR, IG, IB is different from the highest value in the predetermined range of current values and: difference between the highest value in the predetermined range of current values and the actual value of the supply current IR, IG, IB and repeating the steps from a412); coming next in the supply sequence; digital signals VR, VG, VB and repeating the steps from a41).

38. A process according to claim 37, wherein step a412a2) is preceded by a step of checking if the amplification of the analog electric signal can be increased and: analog electric signal and iteratively repeating the steps from a411);

39. A process according to claim 37, wherein step a412a2) further includes the following steps: predetermined minimum value and: VB as the reference value, and repeating the steps from a41).

40. A process according to claim 39, wherein if the check of step a412a2) gives a negative result, the following steps are carried out: and signals VR, VG, VB , the actual value of that signal, and as the reference value for the remaining two signals the value of the smaller of the two actual remaining signals, and repeating the steps from a41);

41. A process according to claims 35, wherein the supply current IR, IG, IB of the emission sources is controlled such that the digital 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 the reference voltage utilized by an analog-to-digital converter employed.

42. A process according to claim 39, wherein the first predetermined minimum value is one third the value of the smallest acceptable sum of the signals VR, VG, VB values.

43. A process according to claim 40, wherein the second predetermined minimum value is one half the difference between the value of the smallest acceptable sum of the signal VR, VG, VB values and the value of the smallest of the signals VR, VG, VB.

44. A process according to claim 36, further comprising the following steps: current values IR, IG, IB; corresponding to each stored supply current IR, IG, IB; VR, VG, VB by respectively adding and subtracting to/from said arithmetical mean a predetermined error, selected to suit specific application requirements.

45. A process according to claim 44, further comprising the following steps: value of each signal VR, VG, VB to their sum; defined as the ratio of the maximum value of the signal VR, VG, VB considered to the sum of that maximum value plus the minimum values of the other two signals VR, VG, VB.

46. A process according to claim 44, further comprising the following steps: value of each signal VR, VG, VB to their sum; defined as the ratio of the minimum value of the signal VR, VG, VB considered to the sum of that minimum value plus the maximum values of the other two signals VR, VG, VB.

47. A process according to claim 35, wherein the recognition step b) includes the following steps: detecting surface bearing the color to be recognized; scattered from said illuminated surface; the picked-up light, as the detecting surface is being illuminated with each of the three beams and converting said electric signal into digital signal VR', VG', VB'; VG', VB' generated are equal, within a predetermined tolerance margin, to those of the signals VR, VG, VB acquired during step a1)-a41).

48. A process according to claim 47, wherein step b4) includes the following steps: than a predetermined saturation value and that their sum is higher a predetermired minimum value and: that the color of the surface being scanned is not recognized.

49. A process according to claim 48, wherein the electric signal are amplified to an amplification level and if the first of the checks of step b41) gives a negative result, a step is carried out to check if the amplification level can be lowered and: iteratively repeating the steps from b41); recognized.

50. A process according to claim 48, wherein the electric signal are amplified to an amplification level and if the second of the checks of step b41) gives a negative result, a step is carried out to check if the amplification level can be raised and: iteratively repeating the steps from b41); recognized.

51. A process according to claim 48, wherein step b41a) further includes the following steps: highest values; equal to the ratio of the selected signal to the sum of the signals VR', VG', VB'; respective predetermined range of values and: indicating that the color is recognized; variables, indicating that the color of the surface being scanned is not recognized.

52. A process for discriminating a color range of a surface, characterized in that it comprises the following steps: establishing one extreme of a color range to be recognized; values, a second acquisition of a second color establishing the other extreme of said color range; generated during the recognition step are the same, within a predetermined tolerance margin, as those of the electric signals VR, VG, VB acquired during said acquisition steps.

53. A process for discriminating a plurality of colors on a surface, characterized in that it comprises the following steps: of a plurality of colors; step; during the recognition steps are the same, within a predetermined tolerance margin, as those of the electric signals VR, VG, VB acquired during said acquisition steps.

54. A process for discriminating the color of a colored surface, comprising the following steps: discriminated 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; from the illuminated acquisition surface; intensity of the picked-up light, as the acquisition surface is being illuminated with each of the three beams; that at least two of the electric signals VR, VG, VB generated are identical with each other, within a predetermined tolerance margin; equal to the ratio of the selected signal to the sum of the signals VR, VG, VB; current values IR, IG, IB thus controlled: discriminated with said color previously acquired, so that said color of the detecting surface can be recognized.

55. A process according to claim 54, wherein the recognition step b) includes the following steps: detecting surface bearing the color to be recognized; scattered from said illuminated surface; luminous intensity of the picked-up light, as the detecting surface is being illuminated with each of the three beams; equal to the ratio of the selected signal to the sum of the signals VR', VG', VB'; G', B' defined are equal, within a predetermined tolerance margin, to those of the reference variable R, G, B acquired during step a1) to a5).