Mode selection method and device of color sensor and color sensor

By calculating the amount of color signal at different locations of the color sensor, the appropriate detection mode is automatically selected, solving the problem of reliance on operator experience and improving the detection accuracy and reliability of the color sensor.

CN121702544APending Publication Date: 2026-03-20OMRON SHANGHAI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511972826.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-24
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

The mode selection of a color sensor is highly dependent on the operator's experience and judgment, which may lead to incorrect mode selection and malfunctioning output, especially for inexperienced operators.

Method used

By acquiring the color signal quantities at different positions of the reference object, calculating the normalized difference (ΔSc) and the signal quantity difference (ΔSr), and automatically selecting the contrast mode or color mode, it is determined whether the color signal quantities of the object to be detected are the same color.

Benefits of technology

It reduces labor costs, improves the accuracy and reliability of testing, and effectively avoids misjudgments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121702544A_ABST
    Figure CN121702544A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a mode selection method and device of a color sensor and the color sensor. The method comprises the following steps: acquiring a first color semaphore at a first position of a reference object and a second color semaphore at a second position of the reference object; calculating a normalized difference value related to a semaphore proportion of each color channel and a semaphore difference value related to a difference value corresponding to each color channel based on the first color semaphore and the second color semaphore; according to the normalized difference value and the semaphore difference value, a contrast mode or a color mode is selected, and the contrast mode and the color mode are used for judging whether the color semaphore of the object to be detected and the first color semaphore correspond to the same color or not. Therefore, the appropriate detection mode of the color sensor can be automatically selected according to the distribution characteristics of the colors in the actual detection scene, the labor cost is reduced, the detection accuracy and reliability are improved, and misjudgment is effectively avoided.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the field of color sensors, and in particular to a mode selection method and device for a color sensor and a color sensor. BACKGROUND

[0002] A color sensor is a sensing element based on the principle of photoelectric conversion. It detects the reflected light or transmitted light of a target object and compares the color characteristics thereof with a "teaching color" to achieve color recognition and judgment.

[0003] In order to better adapt to changing field conditions, a color sensor usually has a teaching function, which learns a reference color in advance to achieve judgment of the color of a target object. Currently, a two-point teaching method is widely used. First, the color of a target object is collected as a reference, and then the color of a background or other contrast color is collected as a reference. The judgment threshold is determined by the two colors collected, so that the color sensor can determine whether the color of the target object collected during actual execution is consistent with the color of the target object taught.

[0004] To adapt to diversified application scenarios, a color sensor usually provides two typical detection modes:

[0005] (1) Color mode: suitable for occasions where the color difference is obvious, but the position, distance or angle of the target object changes greatly;

[0006] (2) Contrast mode: suitable for occasions where the color difference is small, but the detection distance and angle are relatively stable.

[0007] In actual applications, reasonable selection of detection modes according to specific scenarios can significantly improve the detection accuracy and reliability of color sensors in different application scenarios.

[0008] It should be noted that the above introduction to the technical background is only to facilitate a clear and complete description of the technical solutions of the present application, and to facilitate the understanding of those skilled in the art. The above technical solutions cannot be considered as known to those skilled in the art merely because they are described in the background section of the present application. SUMMARY

[0009] The inventors have found that the mode selection of a color sensor is highly dependent on the experience of an operator, and therefore, for inexperienced operators, there may be a problem of selecting an incorrect mode and causing an output error. Even experienced operators may also have problems with mode selection. Therefore, how to automatically select the mode of a color sensor to avoid output errors and reduce labor costs is a problem to be solved.

[0010] To solve at least one of the above technical problems or other similar problems, embodiments of the present application provide a color sensor mode selection method, a color sensor mode selection device, and a color sensor.

[0011] According to a first aspect of embodiments of the present application, a color sensor mode selection method is provided, the method comprising:

[0012] obtaining a first color signal amount at a first position of a reference object and a second color signal amount at a second position of the reference object;

[0013] calculating a normalized difference value (ΔSc) related to a signal amount ratio of each color channel and calculating a signal amount difference value (ΔSr) related to a difference value of each color channel based on the first color signal amount and the second color signal amount; and

[0014] selecting a contrast mode or a color mode according to the normalized difference value (ΔSc) and the signal amount difference value (ΔSr), wherein the contrast mode and the color mode are used to determine whether a color signal amount of an object to be detected corresponds to the same color as the first color signal amount.

[0015] In some embodiments, selecting the contrast mode or the color mode according to the normalized difference value (ΔSc) and the signal amount difference value (ΔSr) comprises:

[0016] determining whether the color mode and the contrast mode are available according to a first comparison result of the normalized difference value (ΔSc) and a color mode signal fluctuation amount (HYScolor) and a second comparison result of the signal amount difference value (ΔSr) and a contrast mode signal fluctuation amount (HYScontrast); and

[0017] selecting the contrast mode or the color mode according to the determination result of whether the color mode and the contrast mode are available.

[0018] In some embodiments, the color mode is selected when the color mode is available; or

[0019] the contrast mode is selected when the color mode is not available and the contrast mode is available; or

[0020] when neither the color mode nor the contrast mode is available, the contrast mode or the color mode is selected according to a relationship between the normalized difference value (ΔSc) and the signal amount difference value (ΔSr).

[0021] In some embodiments, selecting the contrast mode or the color mode according to the relationship between the normalized difference value (ΔSc) and the signal amount difference value (ΔSr) comprises:

[0022] The normalized difference (ΔSc) is multiplied by the first weight to obtain the first value;

[0023] Compare the first value with the magnitude of the semaphore difference (ΔSr); and

[0024] If the first value is not less than the signal difference (ΔSr), the contrast mode is selected; if the first value is less than the signal difference (ΔSr), the color mode is selected.

[0025] In some embodiments, the first weight is greater than 1.

[0026] In some embodiments, calculating the normalized difference (ΔSc) includes:

[0027] Calculate the first proportion of the signal quantity of each channel in the first color signal quantity;

[0028] Calculate the second proportional value of the signal quantity of each channel in the second color signal quantity;

[0029] Calculate the sum of the absolute values ​​of the differences between the first ratio value and the second ratio value of the signal quantities of each channel corresponding to the first color signal quantity and the second color signal quantity; and

[0030] The sum of the absolute values ​​of the differences is normalized to obtain the normalized difference (ΔSc).

[0031] In some embodiments, calculating the semaphore difference (ΔSr) includes:

[0032] Calculate the difference between the signal quantities of each channel corresponding to the first color signal quantity and the second color signal quantity, and obtain the signal quantity difference (ΔSr) based on the maximum value of the difference.

[0033] According to a second aspect of the embodiments of this application, a mode selection device for a color sensor is provided, the device comprising:

[0034] The acquisition unit acquires a first color signal at a first position of the reference object and a second color signal at a second position of the reference object;

[0035] The calculation unit calculates a normalized difference (ΔSc) related to the signal ratio of each color channel and a signal difference (ΔSr) related to the difference between the corresponding color channels, based on the first color signal and the second color signal; and

[0036] selecting a contrast mode or a color mode according to the normalized difference (ΔSc) and the signal quantity difference (ΔSr), wherein the contrast mode and the color mode are used to determine whether the color signal quantity of the to-be-detected object and the first color signal quantity correspond to the same color.

[0037] In some embodiments, the selecting unit selects the contrast mode or the color mode according to the normalized difference (ΔSc) and the signal quantity difference (ΔSr), including:

[0038] determining whether the color mode and the contrast mode are available according to a first comparison result of the normalized difference (ΔSc) and a color mode signal fluctuation quantity (HYScolor) and a second comparison result of the signal quantity difference (ΔSr) and a contrast mode signal fluctuation quantity (HYS 对比度 ).

[0039] selecting the contrast mode or the color mode according to the determination result of whether the color mode and the contrast mode are available.

[0040] According to a third aspect of the embodiments of the present application, a color sensor is provided, including the mode selection device of the color sensor according to any one of the above.

[0041] According to a fourth aspect of the embodiments of the present application, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the mode selection method of the color sensor according to any one of the above.

[0042] One of the beneficial effects of the embodiments of the present application is that: by calculating the normalized difference (ΔSc) related to the signal quantity proportion of each color channel and calculating the signal quantity difference (ΔSr) related to the difference of each color channel through the first color signal quantity at the first position of the reference object and the second color signal quantity at the second position of the reference object, and determining whether to select the contrast mode or the color mode according to the normalized difference (ΔSc) and the signal quantity difference (ΔSr), the appropriate detection mode of the color sensor can be automatically selected according to the color distribution characteristics in the actual detection scene, the labor cost is reduced, the detection accuracy and reliability are improved, and false judgments are effectively avoided.

[0043] Specific implementations of the embodiments of the present application are disclosed in detail in the following description and accompanying drawings, indicating the ways in which the principles of the embodiments of the present application can be employed. It should be understood that the embodiments of the present application are not limited in scope by the number of embodiments described, since the scope of embodiments of the present application is measured by the claims. BRIEF DESCRIPTION OF DRAWINGS

[0044] Elements and features depicted in one drawing or embodiment of the application can be combined with elements and features depicted in one or more other drawings or embodiments. Also, in the drawings, like reference numerals designate corresponding parts throughout the several views, and can be used to designate corresponding parts in more than one embodiment.

[0045] The accompanying drawings are included to provide a further understanding of embodiments of the application, and are incorporated in and constitute a part of this specification, illustrate embodiments of the application, and together with the description serve to explain the principles of the application. It is to be understood that other embodiments can be taken without departing from the spirit of the application, and that the drawings are, therefore, to be regarded as illustrative rather than restrictive.

[0046] Figure 1 is a schematic diagram of a detection mode of a color sensor of an embodiment of the application;

[0047] Figure 2 is an example diagram of a teaching phase of a color sensor of an embodiment of the application;

[0048] Figure 3 is a schematic diagram of a mode selection method of a color sensor of an embodiment of the application;

[0049] Figure 4 is a schematic diagram of a method of calculating a normalized difference value (ΔSc) of an embodiment of the application;

[0050] Figure 5 is a schematic diagram of a method of selecting a contrast mode or a color mode according to a relationship between a normalized difference value (ΔSc) and a signal quantity difference value (ΔSr) of an embodiment of the application;

[0051] Figure 6 is another schematic diagram of a method of selecting a contrast mode or a color mode according to a relationship between a normalized difference value (ΔSc) and a signal quantity difference value (ΔSr) of an embodiment of the application;

[0052] Figure 7 is a flowchart of a mode selection of a color sensor of an embodiment of the application;

[0053] Figure 8 is a schematic diagram of a mode selection device of a color sensor of an embodiment of the application;

[0054] Figure 9 is a schematic diagram of a color sensor of an embodiment of the application;

[0055] Figure 10 is a flowchart of a detection mode selection of a color sensor of an embodiment of the application. DETAILED DESCRIPTION

[0056] The foregoing and other features of the present embodiments will become apparent to those skilled in the art upon consideration of the following description of specific embodiments of the application, taken in conjunction with the accompanying drawings. In the description of embodiments of the application, specific terminology is employed for the sake of clarity. However, the application is not intended to be limited to the specific embodiments described, but rather, is intended to include all modifications, equivalents, and alternatives that fall within the scope of the appended claims.

[0057] In the present embodiments, the terms "first", "second", and the like are used to distinguish different elements from one another, but do not indicate spatial or temporal order or precedence or the like, and these elements should not be limited by these terms. The term "and / or" includes any one or more of the associated listed terms, as well as all combinations of the associated listed terms. The terms "comprise", "include", "have", and the like mean that the stated feature, element, component, or the like is present, but do not preclude the presence or addition of one or more other features, elements, components, or the like.

[0058] In the present embodiments, the singular forms "a", "an", and "the" include plural referents unless the context clearly dictates otherwise. The term "the" should be construed to mean "at least one" or "one or more" unless context clearly indicates otherwise. The term "based on" should be interpreted as "based, at least in part, on" unless context clearly indicates otherwise.

[0059] Features described and / or illustrated with respect to one implementation can be used in the same or similar manner in one or more other implementations, in combination with or in place of features in other implementations, or in place of or in addition to features described or illustrated with respect to other implementations. The term "comprise" or "comprises" as used herein indicates the presence of the stated feature, integer, step, or component but does not preclude the presence or addition of one or more other features, integers, steps, components, or groups thereof.

[0060] Figure 1 is a schematic diagram of a detection mode of a color sensor of the present embodiments, as Figure 1 The color sensor in the present embodiments has two detection modes, a contrast mode and a color mode, as shown in

[0061] In the color mode, the color of the object to be detected is determined by analyzing the proportional relationship between the color signal components, i.e., by determining the consistency of the color signal components and comparing the consistency with a consistency threshold, to determine whether the color of the object to be detected is the "teaching color" (also referred to as the "color at the first position"). In the color mode, when the consistency of the color of the object to be detected is higher than the consistency threshold, it is determined that the color of the object to be detected is the same as the "teaching color", and the color sensor can output a first signal (e.g., ON); when the consistency of the color of the object to be detected is lower than the consistency threshold, it is determined that the color of the object to be detected is different from the "teaching color", and the color sensor can output OFF. In this way, the influence of the angle and distance on the detection result can be avoided.

[0062] In the contrast mode, the component with the largest change in the color signal is used as the determination reference, and the color is determined by using the characteristic that the color signal attenuates with the angle and distance, i.e., by comparing the color signal with a light intensity threshold to determine whether the color of the object to be detected is the "teaching color". In the contrast mode, when the light intensity (also referred to as the color signal) at the object to be detected is higher than the light intensity threshold, it is determined that the color of the object to be detected is the same as the "teaching color", and the color sensor can output a first signal (e.g., ON); when the light intensity at the object to be detected is lower than the light intensity threshold, it is determined that the color of the object to be detected is different from the "teaching color", and the color sensor can output OFF. In this way, the light and dark changes of similar colors can be distinguished, and it can be determined whether the colors are the same.

[0063] Therefore, the contrast mode is suitable for occasions where the colors are similar but the light and dark changes are large, and the color mode is suitable for occasions where the properties (such as the hue) of the colors themselves change greatly. In addition, in a scene where the total color signal is small, the same detection fluctuation can cause a large change in the proportional relationship between the color signal components, thereby easily causing a false judgment in the color mode. In this case, the contrast mode is usually more robust.

[0064] The threshold of the detection mode of the color sensor is determined in the teaching stage, and the color sensor usually uses two-point teaching to determine the determination threshold corresponding to the detection mode. Figure 2 is an example diagram of the teaching stage of the color sensor of the embodiment of the present application, as Figure 2As shown, the color sensor acquires color signal amounts at a first teaching point position (also referred to as "first position") and a second teaching point position (also referred to as "second position") of a reference object respectively, wherein the color at the first teaching point position is the target color, and the color at the second teaching point position is the background color relative to the color at the first teaching point position. In the contrast mode, the color sensor determines a light receiving amount threshold based on the two acquired color signal amounts, for example, determines the light receiving amount threshold based on the average of the two color signal amounts, so that in the subsequent contrast mode detection, whether the acquired color is the target color can be determined by the light receiving amount threshold; in the color mode, the color sensor determines the consistency degree corresponding to the two color signal amounts based on the two acquired color signal amounts, and then determines a consistency degree threshold, for example, determines the consistency degree threshold based on the average of the consistency degrees corresponding to the two color signal amounts, so that in the subsequent color mode detection, whether the acquired color is the target color can be determined by the consistency degree threshold.

[0065] After the teaching phase is completed, the color sensor can enter the detection phase, that is, using the color mode or the contrast mode to determine whether the color signal amount of the to-be-detected object and the teaching color (for example, the color signal amount at the first position) correspond to the same color. The working principle of the color sensor in the detection phase can refer to the above description of the color mode and the contrast mode. Figure 1

[0066] The above illustrates the two detection modes of the color sensor, and the mode selection method of the color sensor of the embodiment of the present application is further described below.

[0067] Figure 3 is a schematic diagram of the mode selection method of the color sensor of the embodiment of the present application, as shown in the figure, the method comprises: Figure 3

[0068] 301, acquiring a first color signal amount at a first position of a reference object and a second color signal amount at a second position of the reference object;

[0069] 302, calculating a normalized difference value (ΔSc) related to the signal amount proportion of each color channel and calculating a signal amount difference value (ΔSr) related to the difference value of each color channel based on the first color signal amount and the second color signal amount;

[0070] 303, selecting a contrast mode or a color mode according to the normalized difference value (ΔSc) and the signal amount difference value (ΔSr), wherein the contrast mode and the color mode are used to determine whether the color signal amount of a to-be-detected object and the first color signal amount correspond to the same color.

[0071] It is worth noting that the above-mentioned figures are schematic diagrams, and the actual color sensor may Figure 3 ​​The embodiments of the present application are only illustrative, but the present application is not limited thereto. For example, the above-mentioned steps can be executed simultaneously or in sequence, the execution order between the operations can be adjusted appropriately, and some operations can be added or removed. Those skilled in the art can make appropriate modifications based on the above description, and the present application is not limited to the above-mentioned description. Figure 3

[0072] In some embodiments of the present application, the first position can be a first teaching point position of the reference object, for example, the position of the target color; and the second position can be a second teaching point position, for example, the position of the background color. The description of the first position and the second position can refer to the foregoing description of the present application.

[0073] In the embodiments of the present application, by obtaining the color signal amounts at two different positions of the reference object, the normalized difference value (ΔSc) related to the signal amount proportion of each color channel and the signal amount difference value (ΔSr) related to the difference value of each color channel corresponding to the two positions are determined, and then the contrast mode or the color mode is automatically selected. In this way, the appropriate detection mode of the color sensor can be automatically selected in the teaching stage of the color sensor according to the distribution characteristics of the colors in the actual detection scene, the labor cost is reduced, the accuracy and reliability of the detection in the detection stage of the color sensor are improved, and false judgments are effectively avoided.

[0074] In some embodiments, the first color signal amount and the second color signal amount output by the color sensor can be RGB (red, green and blue) signal amounts, or YUV (luminance and chrominance) signal amounts, or HSV (hue, saturation and luminance) signal amounts, etc., and the present application is not limited thereto.

[0075] The following is described by taking the RGB signal amount output by the color sensor as an example.

[0076] Figure 4 is a schematic diagram of the method for calculating the normalized difference value (ΔSc) in the embodiments of the present application, which is used to realize the calculation of the normalized difference value (ΔSc) in the operation 302 described above. As shown in some embodiments, the normalized difference value (ΔSc) related to the signal amount proportion of each color channel is calculated based on the first color signal amount and the second color signal amount, which includes: Figure 4

[0077] 401, calculating a first proportion value of the signal amount of each channel in the first color signal amount and a second proportion value of the signal amount of each channel in the second color signal amount;

[0078] ​​402, calculating the sum of absolute values of the difference between the first ratio value and the second ratio value of the signal amount of each channel corresponding to the first color signal amount and the second color signal amount;

[0079] 403, performing a normalization calculation on the sum of absolute values of the difference to obtain the normalized difference (ΔSc).

[0080] Specifically, in operation 401, the first ratio value of the signal amount of each channel in the first color signal amount is calculated according to the second value, and the second ratio value of the signal amount of each channel in the second color signal amount is calculated according to the second value.

[0081] For example, the second value is 1000, and the first ratio value is calculated according to the following formulas (1)~(3):

[0082] R1n = (R1 * 1000) / (R1 + G1 + B1) (1)

[0083] G1n = (G1 * 1000) / (R1 + G1 + B1) (2)

[0084] B1n = (B1 * 1000) / (R1 + G1 + B1) (3)

[0085] For example, the second value is 1000, and the second ratio value is calculated according to the following formulas (4)~(6):

[0086] R2n = (R2 * 1000) / (R2 + G2 + B2) (4)

[0087] G2n = (G2 * 1000) / (R2 + G2 + B2) (5)

[0088] B2n = (B2 * 1000) / (R2 + G2 + B2) (6)

[0089] Wherein:

[0090] R1 represents the signal amount corresponding to the red channel in the RGB signal amount at the first position of the reference object, G1 represents the signal amount corresponding to the green channel in the RGB signal amount at the first position of the reference object, and B1 represents the signal amount corresponding to the blue channel in the RGB signal amount at the first position of the reference object;

[0091] R2 represents a signal amount corresponding to a red channel in an RGB signal amount at the second position of the reference object, G2 represents a signal amount corresponding to a green channel in the RGB signal amount at the second position of the reference object, and B2 represents a signal amount corresponding to a blue channel in the RGB signal amount at the second position of the reference object;

[0092] R1n represents a first proportional value of a signal amount corresponding to a red channel in an RGB signal amount at the first position of the reference object, G1n represents a first proportional value of a signal amount corresponding to a green channel in the RGB signal amount at the first position of the reference object, B1n represents a first proportional value of a signal amount corresponding to a blue channel in the RGB signal amount at the first position of the reference object, R2n represents a second proportional value of a signal amount corresponding to a red channel in the RGB signal amount at the second position of the reference object, G2n represents a second proportional value of a signal amount corresponding to a green channel in the RGB signal amount at the second position of the reference object, and B2n represents a second proportional value of a signal amount corresponding to a blue channel in the RGB signal amount at the second position of the reference object.

[0093] In some embodiments, the second value can be set by an operator according to experience, or preset when the color sensor is manufactured, or determined according to the first color signal amount and / or the second color signal amount, or other color signal amounts, and the application is not limited thereto.

[0094] After R1n, G1n, B1n, R2n, G2n, and B2n are calculated, in operation 402, the sum of absolute values of differences between the first proportional value and the second proportional value of the signal amount of each channel corresponding to the first color signal amount and the second color signal amount is calculated according to formula (7) as follows:

[0095] ΔC = |R2n – R1n| + |G2n – G1n| + |B2n – B1n| (7)

[0096] And, in operation 403, ΔC is normalized to obtain a normalized difference (ΔSc) according to formula (8) as follows:

[0097] ΔSc = ΔC * Max(R1+G1+B1, R2+G2+B2) / 1000 (8)

[0098] Thus, the normalized difference (ΔSc) related to the proportion of the signal amount of each color channel can be calculated.

[0099] In some embodiments of operation 302, calculating the signal quantity difference (ΔSr) related to the difference of each color channel based on the first color signal quantity and the second color signal quantity comprises: calculating the difference of the signal quantity of each channel corresponding to the first color signal quantity and the second color signal quantity, and obtaining the signal quantity difference (ΔSr) according to the maximum value of the difference.

[0100] Specifically, the signal quantity difference ΔSr is calculated according to the following formula (9):

[0101] ΔSr = Max(|R1–R2|, |G1–G2|, |B1–B2|) (9)

[0102] Wherein, R1 represents the signal quantity corresponding to the red channel in the RGB signal quantity at the first position of the reference object, G1 represents the signal quantity corresponding to the green channel in the RGB signal quantity at the first position of the reference object, B1 represents the signal quantity corresponding to the blue channel in the RGB signal quantity at the first position of the reference object, R2 represents the signal quantity corresponding to the red channel in the RGB signal quantity at the second position of the reference object, G2 represents the signal quantity corresponding to the green channel in the RGB signal quantity at the second position of the reference object, B2 represents the signal quantity corresponding to the blue channel in the RGB signal quantity at the second position of the reference object, and ΔSr represents the signal quantity difference.

[0103] Therefore, the signal quantity difference (ΔSr) can be determined according to the maximum value of the difference of the signal quantity of each channel corresponding to the first color signal quantity at the first position and the second color signal quantity at the second position.

[0104] After determining the calculation method of the normalized difference (ΔSc) and the signal quantity difference (ΔSr), the contrast mode or the color mode is selected according to the normalized difference (ΔSc) and the signal quantity difference (ΔSr).

[0105] In some embodiments of operation 303, selecting the contrast mode or the color mode according to the normalized difference (ΔSc) and the signal quantity difference (ΔSr) comprises:

[0106] Operation 3031, judging whether the color mode and the contrast mode are available according to the first comparison result of the normalized difference (ΔSc) and the color mode signal fluctuation quantity (HYScolor) and the second comparison result of the signal quantity difference (ΔSr) and the contrast mode signal fluctuation quantity (HYS 对比度 ).

[0107] Operation 3032, selecting the contrast mode or the color mode according to the judgment result of whether the color mode and the contrast mode are available.

[0108] Specifically, the first comparison result is determined according to the following formula (10):

[0109] ΔSc > HYScolor (10)

[0110] wherein ΔSc is determined according to the aforementioned method; and HYScolor is a color mode signal fluctuation amount.

[0111] For example, in the case of satisfying the aforementioned formula (10), the first comparison result is "color mode available", otherwise, the first comparison result is "color mode unavailable".

[0112] When the color sensor uses the color mode: when the consistency degree of the color of the to-be-detected object is higher than the consistency degree threshold by HYScolor, it is determined that the color of the to-be-detected object is the same as the "teaching color", and the color sensor can output an ON signal; or when the consistency degree of the color of the to-be-detected object is lower than the consistency degree threshold by HYScolor, it is determined that the color of the to-be-detected object is different from the "teaching color", and the color sensor can output an OFF signal. In the color mode, the color mode signal fluctuation amount HYScolor can avoid the output signal of the color sensor from frequently jumping due to the fluctuation of the light signal.

[0113] In some embodiments, the color mode signal fluctuation amount can be set by an operator according to experience, or be preset when the color sensor is shipped, or be determined according to the first color signal amount and / or the second color signal amount, or other color signal amounts, and the present application is not limited thereto.

[0114] Specifically, the second comparison result is determined according to the following formula (11):

[0115] ΔSr > HYS 对比度 (11)

[0116] wherein ΔSr is determined according to the aforementioned method; and HYS 对比度 is a contrast mode signal fluctuation amount;

[0117] For example, in the case of satisfying the aforementioned formula (11), the second comparison result is "contrast mode available", otherwise, the second comparison result is "contrast mode unavailable".

[0118] When the color sensor uses the contrast mode: when the light receiving amount of the to-be-detected object is higher than the light receiving amount threshold by HYS 对比度 , it is determined that the color of the to-be-detected object is the same as the "teaching color", and the color sensor can output an ON signal; or when the light receiving amount of the to-be-detected object is lower than the light receiving amount threshold by HYS 对比度When the color of the to-be-detected object is determined to be different from the "teaching color", the color sensor can output an OFF signal. In the contrast mode, the contrast mode signal fluctuation amount HYS 对比度 The fluctuation of the light receiving signal can be avoided, and the output signal of the color sensor can be prevented from frequently jumping.

[0119] In some embodiments, the contrast mode signal fluctuation amount can be set by an operator according to experience, or preset when the color sensor is manufactured, or determined according to the first color signal amount and / or the second color signal amount, or other color signal amounts, and the present application is not limited thereto.

[0120] After the above operation 3031 determines the color mode and the contrast mode, operation 3032 selects the contrast mode or the color mode according to the determination result of whether the color mode and the contrast mode are available.

[0121] In some embodiments of operation 3032, when the color mode is available, the color mode is selected; or when the color mode is not available and the contrast mode is available, the contrast mode is selected; or when the color mode and the contrast mode are not available, the contrast mode or the color mode is selected according to the relationship between the normalized difference (ΔSc) and the signal amount difference (ΔSr).

[0122] Therefore, the color mode is given priority to be used, because the color mode has better characteristics of offsetting the change in distance angle.

[0123] For example, Table 1 shows a method of selecting the contrast mode or the color mode in some embodiments of operation 3032 of the present application:

[0124] Table 1

[0125]

[0126] For example, as shown in the first and second rows of Table 1, when the color mode is available, the color mode is selected;

[0127] For example, as shown in the third row of Table 1, when the color mode is not available and the contrast mode is available, the contrast mode is selected;

[0128] For example, for "selecting the contrast mode or the color mode according to the relationship between the normalized difference (ΔSc) and the signal amount difference (ΔSr)", the last row of Table 1, the following is described in detail: Figure 5 is a schematic diagram of a method of selecting the contrast mode or the color mode according to the relationship between the normalized difference (ΔSc) and the signal amount difference (ΔSr) in an embodiment of the present application, and is used to realize the selection result of the last row of Table 1.

[0129] As Figure 5 shown in some embodiments, according to the relationship between the normalized difference value (ΔSc) and the signal quantity difference value (ΔSr), the contrast mode or the color mode is selected, including:

[0130] 501, multiplying the normalized difference value (ΔSc) by a first weight to obtain a first value;

[0131] 502, comparing the first value with the signal quantity difference value (ΔSr);

[0132] 503, in the case that the first value is not less than the signal quantity difference value (ΔSr), selecting the contrast mode, and in the case that the first value is less than the signal quantity difference value (ΔSr), selecting the color mode.

[0133] In some embodiments, the first weight is greater than 1.

[0134] Specifically, in operation 501 and operation 502, after ΔSc is multiplied by the first weight (weight), and in operation 503, ΔSc is compared with ΔSr again, for example,

[0135] In the case of ΔSc* weight ≥ ΔSr, the color mode is selected;

[0136] In the case of ΔSc* weight < ΔSr, the contrast mode is selected;

[0137] Wherein, weight>1.

[0138] Figure 6 is another schematic diagram of the method for selecting the contrast mode or the color mode according to the relationship between the normalized difference value (ΔSc) and the signal quantity difference value (ΔSr) in the embodiments of the present application, and is different from Figure 5 . As Figure 6 shown in some embodiments, according to the relationship between the normalized difference value (ΔSc) and the signal quantity difference value (ΔSr), the contrast mode or the color mode is selected, including:

[0139] 601, multiplying the signal quantity difference value (ΔSr) by a second weight to obtain a third value;

[0140] 602, comparing the third value with the normalized difference value (ΔSc);

[0141] 603, in the case that the third value is not greater than the signal quantity difference value (ΔSr), selecting the contrast mode, and in the case that the third value is greater than the signal quantity difference value (ΔSr), selecting the color mode.

[0142] In some embodiments, the second weight is less than 1.

[0143] Specifically, in operation 601 and operation 602, ΔSr is multiplied by a second weight (weight’), and in operation 603, is compared with ΔSc, for example:

[0144] In the case of ΔSr* weight’ ≤ ΔSc, the color mode is selected;

[0145] In the case of ΔSr* weight’ > ΔSc, the contrast mode is selected;

[0146] Wherein, weight’<1.

[0147] Thus, considering that the color mode is better at offsetting the change in distance angle, the color mode can be given priority.

[0148] In some embodiments, the specific values of the first weight and the second weight can be set by an operator according to experience, or be preset by the factory, or be determined according to the first color signal quantity and / or the second color signal quantity, or other color signal quantities, and the present application is not limited thereto.

[0149] The following further describes the flow of mode selection of the color sensor.

[0150] Figure 7 is a flowchart of the mode selection of the color sensor according to an embodiment of the present application, as shown in Figure 7 .

[0151] 700, obtaining a first color signal quantity at a first position of a reference object and a second color signal quantity at a second position of the reference object;

[0152] 701, judging whether the total quantity of the first color signal quantity and the total quantity of the second color signal quantity are both less than a first threshold value, in the case that the total quantity of the first color signal quantity and the total quantity of the second color signal quantity are both less than the first threshold value, performing step 707 (i.e., selecting the contrast mode), otherwise (i.e., at least one of the total quantity of the first color signal quantity and the total quantity of the second color signal quantity is greater than or equal to the first threshold value) performing step 702;

[0153] In operation 701, the total quantity of the first color signal quantity may, for example, be the sum of the absolute values of the channel signal quantities of the first color signal quantity, or the sum of the squares of the channel signal quantities of the first color signal quantity, or other calculation manners, and the total quantity of the second color signal quantity may, for example, be the sum of the absolute values of the channel signal quantities of the second color signal quantity, or the sum of the squares of the channel signal quantities of the second color signal quantity, or other calculation manners;

[0154] The first threshold may be set by the operator based on experience, or preset by the factory, or determined based on the first color signal quantity and / or the second color signal quantity, or other color signal quantities; this application is not limited thereto.

[0155] 702, Based on the first color signal and the second color signal, calculate the normalized difference (ΔSc) related to the signal ratio of each color channel and calculate the signal difference (ΔSr) related to the difference of each color channel.

[0156] 703. Compare the normalized difference (ΔSc) with the first comparison result of the color mode signal fluctuation (HYScolor). If ΔSc > HYScolor (the first comparison result is available), proceed to step 708; otherwise, proceed to step 704.

[0157] 704, Compare the signal difference (ΔSr) with the contrast mode signal fluctuation (HYS). 对比度 The second comparison result is that when ΔSr > HYS 对比度 If the second comparison result is available, proceed to step 707; otherwise, proceed to step 705.

[0158] 705, multiply the normalized difference (ΔSc) by the first weight to obtain the first value;

[0159] 706. Compare the first value with the semaphore difference (ΔSr). If the first value is not less than the semaphore difference (ΔSr), proceed to 707; if the first value is less than the semaphore difference (ΔSr), proceed to 708.

[0160] 707, Select Contrast Mode;

[0161] 708, Select color mode.

[0162] It is worth noting that the above appendix Figure 7 The embodiments of this application have only been illustrated schematically, and the application is not limited thereto. For example, some of the above steps can be performed simultaneously or in a specific order, and the execution order between the various operations can be appropriately adjusted. Furthermore, other operations can be added or some operations can be removed. Those skilled in the art can make appropriate modifications based on the above description, and are not limited to the above-described embodiments. Figure 7 The records.

[0163] The above illustrative description illustrates the mode selection method of the color sensor according to the embodiments of this application. The following illustrative description illustrates the mode selection device of the color sensor according to the embodiments of this application, and the description of the same content as the foregoing embodiments is omitted.

[0164] Figure 8 is a schematic diagram of a mode selection device of a color sensor according to an embodiment of the present application, as Figure 8 shown, the mode selection device 800 of the color sensor comprises an acquisition unit 801, a calculation unit 802 and a selection unit 803.

[0165] The acquisition unit 801 acquires a first color signal amount at a first position of a reference object and a second color signal amount at a second position of the reference object; the calculation unit 802 calculates a normalized difference value (ΔSc) related to the signal amount proportion of each color channel and a signal amount difference value (ΔSr) related to the difference value of each color channel based on the first color signal amount and the second color signal amount; and the selection unit 803 selects a contrast mode or a color mode according to the normalized difference value (ΔSc) and the signal amount difference value (ΔSr), wherein the contrast mode and the color mode are used to determine whether the color signal amount of an object to be detected corresponds to the same color as the first color signal amount.

[0166] Thus, the mode selection device of the color sensor can automatically select a suitable detection mode of the color sensor according to the distribution characteristics of the color in the actual detection scene, reduce the labor cost, improve the detection accuracy and reliability, and effectively avoid misjudgment.

[0167] For specific descriptions of the units of the mode selection device 800, reference can be made to the descriptions of the steps of the mode selection method in Figure 3 , which will not be repeated here.

[0168] The present application also provides a color sensor. Figure 9 is a schematic diagram of a color sensor according to an embodiment of the present application.

[0169] As Figure 9 shown, the color sensor 900 can comprise a photoelectric conversion module 901, a memory 902 and a processor (for example, a central processing unit CPU) 903; the memory 903 is coupled to the central processing unit 902.

[0170] The photoelectric conversion module 901 converts the collected light signal into an electrical signal (for example, a digital signal) that can be processed by the processor 902, the memory 902 can store various data, also store the program of information processing, and execute the program under the control of the processor 902. It is worth noting that the color sensor 900 does not necessarily have to include all the components shown in Figure 9 ; in addition, the color sensor 900 can also include Figure 9The color sensor 900 can further include a light projecting unit (not shown) for projecting light generated by a light source (e.g., a light emitting diode) to the object to be detected, in addition to the components not shown in the figure.

[0171] In some embodiments, the processor 902 is configured to perform the mode selection method of the color sensor as described above (e.g., as shown in Figure 1 For example, the processor 902 is configured to perform the following operations: obtaining a first color signal amount of a color at a first position of a reference object and a second color signal amount of a color at a second position of the reference object; calculating a normalized difference value (ΔSc) related to the signal amount ratio of each color channel and calculating a signal amount difference value (ΔSr) related to the difference value of each color channel based on the first color signal amount and the second color signal amount; and selecting a contrast mode or a color mode according to the normalized difference value (ΔSc) and the signal amount difference value (ΔSr), wherein the contrast mode and the color mode are used to determine whether the color signal amount of the object to be detected corresponds to the same color as the first color signal amount.

[0172] Figure 10 A flowchart of the color sensor selecting a detection mode according to an embodiment of the present application is shown in Figure 10 The flowchart includes the following steps:

[0173] In the teaching stage, in step 1001, the operator specifies the color at the first position (also referred to as the first teaching point) of the reference object as the target color and the color at the second position (also referred to as the second teaching point) of the reference object as the background color by pressing the keys twice.

[0174] In step 1003, the memory 902 stores the first color signal amount of the color at the first position for subsequent calling in the detection process; in addition, the memory 902 also stores the second color signal amount of the color at the second position, or the consistency threshold value and / or the light receiving amount threshold value calculated by the processor 903.

[0175] In step 1004, based on the first color signal amount of the color at the first position and the second color signal amount of the color at the second position, the processor 903 performs the mode selection method of the color sensor as described above (e.g., as shown in Figure 3 The detection mode is automatically selected, and thus the appropriate detection mode in the current scene, i.e., the color mode or the contrast mode, is determined.

[0176] After the detection mode of the current scene is determined, the detection phase is entered, and in step 1005, the color sensor 900 collects the light receiving signal (for example, the RGB signal) of the object to be detected, and then determines the color signal amount of the object to be detected (step 1009);

[0177] In step 1010, the processor 903 determines whether the color of the object to be detected is the color at the first position based on the selected detection mode and outputs the determination result in step 1009.

[0178] For example, when the detection mode is the color mode, the processor 903 calculates the consistency threshold value based on the consistency corresponding to the color at the first position and the consistency corresponding to the color at the second position, and determines whether the color of the object to be detected is the color at the first position based on the consistency threshold value. When the consistency of the color of the object to be detected is higher than the consistency threshold value, ON is output, that is, it is considered that the color of the object to be detected and the color at the first position are the same color; when the consistency of the color of the object to be detected is lower than the consistency threshold value, OFF is output, that is, it is considered that the color of the object to be detected and the color at the first position are two different colors.

[0179] For another example, when the detection mode is the contrast mode, the processor 903 calculates the light receiving amount threshold value based on the first color signal amount at the first position and the second color signal amount at the second position, and determines whether the color of the object to be detected is the color at the first position based on the light receiving amount threshold value. When the color signal amount of the object to be detected is higher than the light receiving amount threshold value, ON is output, that is, it is considered that the color of the object to be detected and the color at the first position are the same color; when the color signal amount of the object to be detected is lower than the light receiving amount threshold value, OFF is output, that is, it is considered that the color of the object to be detected and the color at the first position are two different colors. In this way, the color sensor 900 completes the whole process from adaptive selection of the mode to accurate judgment of the color.

[0180] The above embodiments are only exemplary, but the present application is not limited thereto, and appropriate modifications can be made on the basis of the above embodiments. For example, the above embodiments can be used alone, or one or more of the above embodiments can be combined.

[0181] It should be noted that the above only describes the components or modules related to the present application, but the present application is not limited thereto. The menu navigation device of the present application can also include other components or modules, and the specific content of these components or modules can be referred to related technologies.

[0182] For simplicity, only the connection relationship or signal direction between each component or module is exemplarily shown in the above figures, but it should be understood by those skilled in the art that various related technologies such as bus connection can be adopted. Each component or module described above can be implemented by hardware facilities such as processors, memories, etc.; the embodiments of the present application are not limited thereto.

[0183] The embodiments of the present application further provide a storage medium storing a computer readable program, wherein the computer readable program causes a computer to execute the mode selection method of the color sensor in the electronic device as described in the foregoing embodiments.

[0184] The apparatus and method described above can be implemented by hardware, or by hardware in combination with software. The present application relates to a computer readable program which, when executed by a logic component, causes the logic component to implement the apparatus or constituent components described above, or causes the logic component to implement the various methods or steps described above. The present application also relates to a storage medium for storing the above program, such as a hard disk, a magnetic disk, an optical disk, a DVD, a flash memory, etc.

[0185] The method / apparatus described in combination with the embodiments of the present application can be directly embodied as hardware, a software module executed by a processor, or a combination of the two. For example, one or more of the functional block diagrams shown in the figures and / or a combination of one or more of the functional block diagrams can correspond to each software module of a computer program flow, or to each hardware module. These software modules can correspond to each step shown in the figures, respectively. These hardware modules can be implemented by, for example, fixing the software modules with a field programmable gate array (FPGA).

[0186] The software modules can be located in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a mobile disk, a CD-ROM, or any other form of storage medium known in the art. A storage medium can be coupled to a processor, so that the processor can read information from the storage medium and write information to the storage medium; or the storage medium can be an integral part of the processor. The processor and the storage medium can be located in an ASIC. The software modules can be stored in a memory of the mobile terminal, or in a memory card which can be inserted into the mobile terminal. For example, if the device (such as a mobile terminal) uses a MEGA-SIM card or a large-capacity flash memory device, the software modules can be stored in the MEGA-SIM card or the large-capacity flash memory device.

[0187] One or more and / or one or more combinations of functional blocks described in the accompanying drawings can be implemented as a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, or any suitable combination thereof for performing the functions described herein. One or more and / or one or more combinations of functional blocks described in the accompanying drawings can also be implemented as a combination of computing devices, such as a combination of a DSP and a microprocessor, multiple microprocessors, one or more microprocessors in communication with a DSP, or any other such configuration.

[0188] The present application has been described above with reference to specific embodiments. However, those skilled in the art should understand that these descriptions are exemplary and not intended to limit the scope of protection of the present application. Those skilled in the art can make various modifications and variations to the present application based on the principles thereof, and these modifications and variations are also within the scope of the present application.

Claims

1. A mode selection method for a color sensor, characterized in that, The method includes: Acquire the first color signal at a first position of the reference object and the second color signal at a second position of the reference object; Based on the first color signal and the second color signal, calculate the normalized difference (ΔSc) related to the signal ratio of each color channel and calculate the signal difference (ΔSr) related to the difference corresponding to each color channel; and Based on the normalized difference (ΔSc) and the signal difference (ΔSr), a contrast mode or a color mode is selected, wherein the contrast mode and the color mode are used to determine whether the color signal of the object to be detected corresponds to the same color as the first color signal.

2. The method according to claim 1, characterized in that, Based on the normalized difference (ΔSc) and the semaphore difference (ΔSr), select either a contrast mode or a color mode, including: Based on the first comparison result of the normalized difference (ΔSc) and the color mode signal fluctuation (HYScolor), and the signal difference (ΔSr) and the contrast mode signal fluctuation (HYS) 对比度 The second comparison result determines whether the color mode and the contrast mode are available; and Based on the determination of whether the color mode and the contrast mode are available, select the contrast mode or the color mode.

3. The method according to claim 2, characterized in that, If the color mode is available, select the color mode; or, If the color mode is unavailable and the contrast mode is available, select the contrast mode; or If neither the color mode nor the contrast mode is available, the contrast mode or the color mode is selected based on the relationship between the normalized difference (ΔSc) and the semaphore difference (ΔSr).

4. The method according to claim 3, characterized in that, Based on the relationship between the normalized difference (ΔSc) and the signal difference (ΔSr), the contrast mode or the color mode is selected, including: The normalized difference (ΔSc) is multiplied by the first weight to obtain the first value; Compare the first value with the magnitude of the semaphore difference (ΔSr); and If the first value is not less than the signal difference (ΔSr), the contrast mode is selected; if the first value is less than the signal difference (ΔSr), the color mode is selected.

5. The method according to claim 4, characterized in that, The first weight is greater than 1.

6. The method according to claim 1, characterized in that, Calculating the normalized difference (ΔSc) includes: Calculate the first proportion of the signal quantity of each channel in the first color signal quantity; Calculate the second proportional value of the signal quantity of each channel in the second color signal quantity; Calculate the sum of the absolute values ​​of the differences between the first ratio value and the second ratio value of the signal quantities of each channel corresponding to the first color signal quantity and the second color signal quantity; and The sum of the absolute values ​​of the differences is normalized to obtain the normalized difference (ΔSc).

7. The method according to claim 1, characterized in that, Calculating the semaphore difference (ΔSr) includes: Calculate the difference between the signal quantities of each channel corresponding to the first color signal quantity and the second color signal quantity, and obtain the signal quantity difference (ΔSr) based on the maximum value of the difference.

8. A mode selection device for a color sensor, characterized in that, The device includes: The acquisition unit acquires a first color signal at a first position of the reference object and a second color signal at a second position of the reference object; The calculation unit calculates a normalized difference (ΔSc) related to the signal ratio of each color channel and a signal difference (ΔSr) related to the difference between the corresponding color channels, based on the first color signal and the second color signal; and The selection unit selects a contrast mode or a color mode based on the normalized difference (ΔSc) and the signal difference (ΔSr), wherein the contrast mode and the color mode are used to determine whether the color signal of the object to be detected corresponds to the same color as the first color signal.

9. The apparatus according to claim 8, characterized in that, The selection unit selects a contrast mode or a color mode based on the normalized difference (ΔSc) and the signal difference (ΔSr), including: Based on the first comparison result of the normalized difference (ΔSc) and the color mode signal fluctuation (HYScolor), and the signal difference (ΔSr) and the contrast mode signal fluctuation (HYS) 对比度 The second comparison result determines whether the color mode and the contrast mode are available; and Based on the determination of whether the color mode and the contrast mode are available, select the contrast mode or the color mode.

10. A color sensor, characterized in that, The color sensor includes the mode selection device of the color sensor as described in claim 8 or 9.