A multi-region color recognition system and method based on programmable three-dimensional scanning
Patent Information
- Application Number
- CN202610919216.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-24
- Publication Date
- 2026-10-09
AI Technical Summary
[0004]本发明的目的在于克服现有技术的不足,提供一种基于可编程三维扫描的多区域颜色识别系统及方法,以解决现有颜色检测方案在面对立体工件的多区域颜色检测时硬件结构复杂、换型柔性差以及难以兼顾轴向对焦导致检测精度低的问题
首先,在硬件架构层面,本发明以单套光学测量单元替代了传统方案中多个固定式传感器堆叠的方式,无需为每个检测点配备独立的传感器,大幅降低了硬件成本、安装空间的占用以及系统布线的复杂性。其次,在检测柔性层面,本发明的三维检测程序完全通过软件编程实现,当生产线切换产品型号时,仅需调用或修改检测程序中的坐标参数和基准颜色数据,无需对传感器和光路进行任何物理位置的手动调整,实现了真正的软件定义检测,显著提升了生产线的换产效率。再者,在三维适应能力层面,本发明通过轴向调节机构驱动整个扫描振镜及传感器单元沿垂直于工件表面的方向整体平移,能够针对每个检测点独立进行轴向位置补偿,确保在不同高度、不同倾斜角度的立体表面上均能获得精确聚焦的测量光斑,有效解决了面阵相机景深不足和固定传感器离焦的问题。最后,在测量精度层面,本发明采用单点式测量方式,每次采集均为独立的高精度颜色数据,避免了面阵成像中因光照不均匀、边缘效应和颜色混叠导致的测量误差,检测结果更为稳定可靠。
Smart Images

Figure CN122881872A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of industrial automation visual inspection technology, specifically relating to a multi-region color recognition system and method based on programmable 3D scanning. Background Technology
[0002] In automated industrial production, color consistency inspection is a crucial step in ensuring product quality. As industrial manufacturing becomes increasingly diversified and precise, the surface of workpieces often contains multiple independent areas requiring color identification, and these areas exhibit varying heights in space, such as stepped, uneven, or three-dimensional polyhedral structures. Currently, to automate color inspection of these workpieces with multiple areas and varying heights, the industry primarily relies on optical color sensors or visual imaging equipment deployed at inspection stations on production lines.
[0003] However, existing color detection solutions have significant drawbacks when dealing with multi-area and three-dimensional surfaces. One common approach involves deploying multiple single-point color sensors, each aligned with a specific area to be measured. Since ordinary single-point color sensors can only identify a single point of color at a fixed location, physical stacking of hardware is required when dealing with multiple areas. This leads to a linear increase in system hardware costs with the number of detection points, complex internal wiring and mechanical installation structures, and the need for manual adjustment of the spatial positions of all sensors when switching product models on the production line, resulting in poor detection flexibility. Another approach uses an area-array industrial camera to take a comprehensive image, followed by pixel-by-pixel color segmentation and recognition using image processing algorithms. This approach has high equipment costs, strict requirements for ambient lighting uniformity, and limitations imposed by lens depth of field. Area-array cameras struggle to capture areas with height differences on the surface, easily leading to blurred images in off-focal plane areas, color aliasing, and measurement data drift, thus failing to guarantee high-precision color measurement. Therefore, it is urgent to improve the existing technology to solve the technical problems of complex hardware structure, poor flexibility in shape change, and low detection accuracy caused by difficulty in axial focusing when dealing with multi-area color detection of three-dimensional workpieces. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of the prior art and provide a multi-region color recognition system and method based on programmable three-dimensional scanning, so as to solve the problems of complex hardware structure, poor flexibility in shape change, and low detection accuracy caused by difficulty in axial focusing when dealing with multi-region color detection of three-dimensional workpieces in existing color detection schemes.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: In a first aspect, the present invention provides a multi-region color recognition system based on programmable three-dimensional scanning, comprising: A single-point color measurement unit is used to emit a detection beam and receive the single-point reflected light signal returning along the original optical path in order to collect color information. A three-dimensional beam guiding unit is connected to the optical path of the single-point color measurement unit and is used to control the deflection and focusing of the measurement optical path of the single-point color measurement unit in three-dimensional space. The three-dimensional beam guiding unit includes a two-dimensional scanning galvanometer and an axial adjustment mechanism. The two-dimensional scanning galvanometer includes a first reflecting mirror, a second reflecting mirror, and servo motor groups that independently control the deflection of the corresponding mirrors. The axial adjustment mechanism is mechanically connected to both the single-point color measurement unit and the two-dimensional scanning galvanometer and is used to drive the single-point color measurement unit and the two-dimensional scanning galvanometer to translate along a direction perpendicular to the surface of the workpiece to be measured. The control processing unit is electrically connected to the single-point color measurement unit, the servo motor group, and the axial adjustment mechanism, respectively. The control processing unit stores a programmable three-dimensional detection program, which is used to send angle deflection commands to the servo motor group to control the measurement optical path to perform planar two-dimensional scanning according to the program settings, and to send height adjustment commands to the axial adjustment mechanism to perform axial dynamic focusing. At the same time, it receives color data uploaded by the single-point color measurement unit for comparison and judgment.
[0006] Preferably, the axial adjustment mechanism is an electrically controlled single-axis moving platform, which includes a guide frame, a sliding slider slidably disposed on the guide frame, a mounting frame fixed on the sliding slider, and a drive motor; the single-point color measurement unit and the two-dimensional scanning galvanometer are both fixedly mounted on the mounting frame, and the drive motor is electrically connected to the control processing unit to drive the sliding slider to move in a direction perpendicular to the surface of the workpiece to be measured.
[0007] Secondly, the present invention provides a multi-region color recognition method based on programmable three-dimensional scanning, applied in the aforementioned multi-region color recognition system. The multi-region color recognition method includes the following steps: Step S100: Establish a corresponding three-dimensional detection program based on the calibration sample. The three-dimensional detection program includes the three-dimensional spatial coordinates of each color region to be tested on the calibration sample and the corresponding reference color data. Step S200: Based on the three-dimensional detection program, detect the workpiece to be tested, determine the target color area to be tested, and control the two-dimensional scanning galvanometer to guide and position the measurement optical path between the single-point color measurement unit and the target color area to be tested to the target color area. Step S300: Based on the height data in the three-dimensional spatial coordinate set, drive the axial adjustment mechanism to move and adjust the relative distance between the two-dimensional scanning galvanometer and the target color area to be measured for dynamic focusing; Step S400: Trigger the single-point color measurement unit to collect real-time color data of the target color area along the measurement optical path; Step S500: Compare the real-time color data with the corresponding reference color data in the three-dimensional spatial coordinate group, and output the color determination result of the target color area to be tested.
[0008] Preferably, step S100 includes: Step S101: Place the calibration sample at the testing station; Step S102: Call the calibration control command to control the servo motor group to drive the first reflective lens and the second reflective lens to deflect to a preset angle, so that the measurement optical path between the single-point color measurement unit and one of the color areas to be measured of the calibration sample is guided and aligned by the first reflective lens and the second reflective lens; Step S103: Control the axial adjustment mechanism to move to a preset height so that the measurement optical path is focused on the current color area to be measured; Step S104: Trigger the single-point color measurement unit to collect the reference color data at the current position; Step S105: Store the current preset angle and preset height as a set of three-dimensional spatial coordinate parameters, corresponding to the reference color data, in the storage list of the three-dimensional detection program; Step S106: Repeat steps S102 to S105 sequentially until the parameter input of all color regions to be tested on the calibration sample is completed, and the three-dimensional detection program is generated.
[0009] Preferably, step S103 includes: driving the axial adjustment mechanism to move, and monitoring the signal strength fed back by the single-point color measurement unit in real time during the movement, recording the position of the axial adjustment mechanism corresponding to the maximum value of the signal strength as the target focus position, and using the target focus position as the preset height.
[0010] Preferably, step S200 includes: Step S201: Place the workpiece to be tested into the testing station and call the three-dimensional testing program corresponding to the model of the workpiece to be tested; Step S202: Analyze the three-dimensional detection program and extract the X-axis angle parameters and Y-axis angle parameters corresponding to the target color region to be detected. Step S203: Send a position control command to the servo motor group to drive the first reflective lens and the second reflective lens to deflect accordingly, so as to guide and position the measurement optical path to the target color area to be measured.
[0011] Preferably, step S300 includes: Step S301: Extract the Z-axis height parameter corresponding to the target color region from the three-dimensional detection program; Step S302: Control the axial adjustment mechanism to move to the physical position corresponding to the Z-axis height parameter, so as to compensate for the axial height difference of the target color area to be tested due to surface unevenness or stepped structure.
[0012] Preferably, step S400 includes: Step S401: After the two-dimensional scanning galvanometer and the axial adjustment mechanism have both moved into position, a trigger acquisition command is sent to the single-point color measurement unit; Step S402: Read the RGB color value, color channel value or color space coordinate value obtained by the single-point color measurement unit in a single acquisition, and use it as the real-time color data.
[0013] Preferably, step S500 includes: Step S501: Calculate the color difference value between the real-time color data and the corresponding reference color data; Step S502: Determine whether the color difference value is within the preset tolerance range. If it is within the tolerance range, the target color area to be tested is determined to be qualified. If it exceeds the tolerance range, the target color area to be tested is determined to be unqualified. Step S503: Output the pass / fail judgment result of the target color area to be tested.
[0014] Preferably, after step S503, the method further includes: Step S600: Determine whether all the color regions to be tested in the storage list of the 3D detection program have been traversed; if not, switch to the next target color region to be tested and return to execute step S202.
[0015] The multi-region color recognition system and method based on programmable three-dimensional scanning disclosed in this invention are based on the combination of a single-point color measurement unit and a three-dimensional beam guiding unit including a two-dimensional scanning galvanometer and an axial adjustment mechanism. Through programmable control of the control processing unit, a single sensor can sequentially complete the detection of multiple color points at different spatial positions and heights. Compared with existing technologies, this invention has the following significant advantages: First, at the hardware architecture level, this invention replaces the traditional method of stacking multiple fixed sensors with a single optical measurement unit. This eliminates the need for an independent sensor for each detection point, significantly reducing hardware costs, installation space requirements, and system wiring complexity. Second, regarding detection flexibility, the 3D detection program of this invention is entirely implemented through software programming. When the production line switches product models, only the coordinate parameters and reference color data in the detection program need to be called or modified. No manual adjustment of the physical positions of the sensors and optical paths is required, achieving true software-defined detection and significantly improving production line changeover efficiency. Third, in terms of 3D adaptability, this invention uses an axial adjustment mechanism to drive the entire scanning galvanometer and sensor unit to translate along a direction perpendicular to the workpiece surface. This allows for independent axial position compensation for each detection point, ensuring that a precisely focused measurement spot can be obtained on three-dimensional surfaces at different heights and tilt angles. This effectively solves the problems of insufficient depth of field in area array cameras and defocusing of fixed sensors. Finally, in terms of measurement accuracy, this invention adopts a single-point measurement method, and each acquisition is an independent high-precision color data, which avoids measurement errors caused by uneven illumination, edge effects and color mixing in area array imaging, and the detection results are more stable and reliable. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a structural block diagram of the system of the present invention.
[0018] Figure 2 This is a schematic diagram of a specific embodiment of the system of the present invention.
[0019] Figure 3 for Figure 2 A schematic diagram of the system from another perspective.
[0020] Figure 4 This is an overall flowchart of the method of the present invention.
[0021] Figure 5 This is a logic block diagram of the calibration stage in the method of the present invention.
[0022] Figure 6 This is a logic block diagram of the detection stage in the method of the present invention.
[0023] The reference numerals in the attached figures are explained as follows: 1. Single-point color measurement unit; 2. Three-dimensional beam guiding unit; 21. Two-dimensional scanning galvanometer; 211. First reflecting mirror; 212. Second reflecting mirror; 213. Servo motor assembly; 22. Axial adjustment mechanism; 221. Guide frame; 222. Moving slider; 223. Mounting frame; 224. Drive motor; 3. Control processing unit; 4. Workpiece to be measured. Detailed Implementation
[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0025] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limiting this invention.
[0026] Existing color detection solutions suffer from high costs and difficulties in changing models when dealing with multi-region detection of three-dimensional workpieces due to the stacking of multiple sensors, while area scan camera solutions are limited by depth of field and lighting conditions, making it difficult to guarantee accuracy. Therefore, to address these issues, this application provides a multi-region color recognition system and method based on programmable 3D scanning.
[0027] like Figure 1 , Figure 2 and Figure 3 As shown, the multi-region color recognition system based on programmable three-dimensional scanning provided in this application embodiment includes a single-point color measurement unit 1, a three-dimensional beam guiding unit 2, and a control processing unit 3.
[0028] The single-point color measurement unit 1 is used to emit a detection beam and receive the single-point reflected light signal returning along the original optical path for color information acquisition. This unit integrates a light source emitter, a beam splitter, and a photoelectric detection module, enabling high-precision color measurement of tiny light spot areas with diameters ranging from sub-millimeters to several millimeters, outputting values such as RGB three-channel values, Lab chromaticity space coordinates, or digital representations of specific color spaces.
[0029] The three-dimensional beam guiding unit 2 is optically connected to the single-point color measurement unit 1, and is used to control the deflection and focusing of the measurement beam of the single-point color measurement unit 1 in three-dimensional space. The three-dimensional beam guiding unit 2 includes a two-dimensional scanning galvanometer 21 and an axial adjustment mechanism 22. The two-dimensional scanning galvanometer 21 includes a first reflecting mirror 211, a second reflecting mirror 212, and servo motor groups 213 that independently control the deflection of the corresponding mirrors. The first reflecting mirror 211 is used to control the deflection angle of the beam in the X-axis direction (horizontal transverse direction), and the second reflecting mirror 212 is used to control the deflection angle of the beam in the Y-axis direction (horizontal longitudinal direction). Through the coordinated deflection of the two mirrors, the incident collimated beam can be guided to any coordinate position in the working plane. The axial adjustment mechanism 22 is mechanically connected to the single-point color measurement unit 1 and the two-dimensional scanning galvanometer 21. It is used to drive the single-point color measurement unit 1 and the two-dimensional scanning galvanometer 21 to translate as a whole along the direction perpendicular to the surface of the workpiece 4 to be measured (i.e., the Z-axis direction), thereby changing the focal plane position of the measurement optical path so that the measurement spot can be accurately focused on the surface to be measured at different heights.
[0030] The control processing unit 3 is electrically connected to the single-point color measurement unit 1, the servo motor assembly 213, and the axial adjustment mechanism 22. The control processing unit 3 internally stores a programmable 3D detection program. "Programmable" means that the program, independent of hardware firmware, uses a structured text format (such as XML, JSON, or a custom configuration file) to describe the 3D spatial coordinates and reference color data of each detection point. Users or host computer software can add, delete, or modify the coordinate parameters or reference color values of any detection point by editing the program file without modifying the underlying driver code. Multiple independent program files can also be created for different product models. Essentially, the program is a structured file containing the 3D spatial coordinates (X-axis lens angle, Y-axis lens angle, Z-axis height position) of multiple detection points and their corresponding reference color data. During operation, the control processing unit 3 sends angle deflection commands to the servo motor assembly 213 according to the program settings to control the measurement optical path for planar 2D scanning, and sends height adjustment commands to the axial adjustment mechanism 22 for dynamic axial focusing. Simultaneously, it receives color data uploaded by the single-point color measurement unit 1 for comparison and judgment, and outputs the final detection result. When the production line switches product models, the operator only needs to select the corresponding program file through the human-machine interface, or the production management system will automatically issue a program switching command, and the control processing unit 3 will load the new detection program. No physical adjustment of the sensor, galvanometer or axial adjustment mechanism is required, thus realizing flexible production of "software-defined detection".
[0031] Through the above technical solution, this system achieves color detection capability at multiple discrete points in space and different height positions using a single optical measurement unit. Its core advantage lies in transforming the traditional "multi-point, multi-position" hardware stacking scheme into a "single-point, multi-point" programmable scanning scheme. The control and processing unit 3 precisely controls the beam direction and focal position based on pre-stored three-dimensional coordinate data, enabling the light spot to sequentially and rapidly access each detection point. This reduces system complexity while retaining the inherent high-precision characteristics of single-point measurement.
[0032] The present invention further proposes that the axial adjustment mechanism 22 is an electrically controlled single-axis moving platform, which includes a guide frame 221, a sliding slider 222 slidably disposed on the guide frame 221, a mounting frame 223 fixed on the sliding slider 222, and a drive motor 224. The single-point color measurement unit 1 and the two-dimensional scanning galvanometer 21 are both fixedly mounted on the mounting frame 223. The drive motor 224 is electrically connected to the control processing unit 3 and is used to drive the sliding slider 222 to move in a direction perpendicular to the surface of the workpiece 4 to be measured.
[0033] The guide frame 221 serves as a support and guide structure, and can be internally equipped with linear guides or ball screw pairs. The sliding fit between the movable slider 222 and the guide frame 221 ensures the directional accuracy and repeatability of the movement. The mounting frame 223 supports the single-point color measurement unit 1 and the two-dimensional scanning galvanometer 21, maintaining a fixed relative position between them. The drive motor 224 can be a stepper motor or a servo motor. The control processing unit 3 sends pulse signals to it to control the angle and direction of the motor's rotation, thereby driving the movable slider 222 to move to the target position. In one specific embodiment, the output shaft of the drive motor 224 is connected to a ball screw, and a nut that mates with the ball screw is provided on the movable slider 222. When the motor drives the screw to rotate, the nut drives the movable slider 222 to move along the screw axis, achieving precise linear displacement. Compared to traditional optical zoom methods, this scheme, which moves the sensor and scanning galvanometer as a whole, has a larger focusing range and better optical path stability because the internal relative position of the entire optical path system remains unchanged, and only the absolute distance between the system and the workpiece changes, thus avoiding aberrations and light energy loss that may be introduced during the zoom process.
[0034] In specific embodiments, besides using an electrically controlled single-axis moving platform as the axial adjustment mechanism 22, as a preferred alternative, the axial adjustment mechanism 22 can also be a dynamic focusing lens integrated inside the two-dimensional scanning galvanometer 21. This lens is controlled by an independent driver to move along the optical axis to change the position of the beam convergence point, thereby achieving high-speed dynamic focusing; or it can be set as an electrically controlled zoom optical lens located in the output optical path of the single-point color measurement unit 1, changing the system focal length by adjusting the relative position of the internal lens group, thereby completing focusing. Those skilled in the art can flexibly choose from the above solutions according to the required focusing range, response speed, and structural compactness requirements.
[0035] Through the above technical solution, the axial adjustment mechanism 22 of this system can independently provide precise Z-axis position compensation for each detection point. Even if there is a large height difference on the surface of the workpiece 4 to be measured, the system can adjust to the optimal focal plane position of each detection point in sequence, ensuring that each measurement point is acquired in the best optical condition, fundamentally solving the problem of color measurement value drift caused by defocus.
[0036] like Figure 4 As shown, this application embodiment also provides a multi-region color recognition method based on programmable three-dimensional scanning, which is applied in the above system. The method includes the following steps S100 to S500.
[0037] Step S100: Establish a corresponding three-dimensional detection program based on the calibration sample. The three-dimensional detection program includes the three-dimensional spatial coordinates of each color region to be tested on the calibration sample and the corresponding reference color data.
[0038] Step S200: Based on the three-dimensional detection program, the workpiece 4 to be tested is detected, the target color area to be tested is determined, and the two-dimensional scanning galvanometer 21 is controlled to guide and position the measurement optical path between the single-point color measurement unit 1 and the target color area to be tested to the target color area.
[0039] Step S300: Based on the height data in the three-dimensional spatial coordinate group, drive the axial adjustment mechanism 22 to move, and adjust the relative distance between the two-dimensional scanning galvanometer 21 and the target color area to be measured for dynamic focusing.
[0040] Step S400: Trigger the single-point color measurement unit 1 to collect real-time color data of the target color area along the measurement optical path.
[0041] Step S500: Compare the real-time color data with the corresponding reference color data in the three-dimensional spatial coordinate group, and output the color judgment result of the target color area to be measured.
[0042] The core logic of the above method is to treat multiple discrete detection points in three-dimensional space as a series of target poses that can be accessed sequentially. Step S100 is equivalent to the "teaching" process of the standard sample, recording the spatial position information and color fingerprint of each detection point; steps S200 to S400 are the "execution" process of the workpiece 4 to be tested, accessing the detection points one by one and collecting data according to the order and parameters recorded in the teaching; step S500 completes the judgment. Specifically, this method is divided into two main stages in practical applications: the detection program calibration stage and the automatic scanning detection stage; such as Figure 5 As shown, during the calibration phase, the spatial coordinates and color references of each detection point are established through a "teaching" method; for example... Figure 6 As shown, during the detection phase, each detection point is accessed sequentially according to the calibration procedure, and color comparison is completed. This "teach-before-execute" mode allows the system to adapt to any layout and any number of detection points without changing the hardware structure, by updating the program file, thus exhibiting extremely high flexibility in adaptability.
[0043] The present invention further proposes that step S100 specifically includes steps S101 to S106.
[0044] Step S101: Place the calibration sample at the testing station. The calibration sample is usually a standard part whose color has been confirmed to be accurate by metrology or the first batch of qualified samples. Its placement should be consistent with the positioning reference of the subsequent workpiece 4 to be tested.
[0045] Step S102: Call the calibration control command to control the servo motor group 213 to drive the first reflecting lens 211 and the second reflecting lens 212 to deflect to a preset angle, so that the measurement optical path between the single-point color measurement unit 1 and one of the color areas to be measured on the calibration sample is aligned by the two reflecting lenses. This preset angle can be an initial trial angle or an estimated value calculated in advance based on the product design drawings. For example, in actual operation, for products with known CAD models, the angle that the first reflecting lens 211 and the second reflecting lens 212 should deflect can be calculated in advance using geometric optics formulas based on the theoretical position of the detection point in the workpiece coordinate system, thereby significantly shortening the search time in the calibration process. For samples without CAD models, the light spot can be manually guided for rough alignment, and the system records the current lens angle as the initial value.
[0046] Step S103: Control the axial adjustment mechanism 22 to move to the preset height so that the measurement optical path is focused on the current color area to be measured.
[0047] Step S104: Trigger the single-point color measurement unit 1 to collect the reference color data at the current position.
[0048] Step S105: The current preset angle and preset height are used as a set of three-dimensional spatial coordinate parameters and stored in the storage list of the three-dimensional detection program, corresponding to the reference color data. This storage list can be recorded in tabular form, with each row corresponding to a detection point, including the X-lens deflection angle, Y-lens deflection angle, Z-axis position, and the R, G, and B color reference channel values.
[0049] Step S106: Repeat steps S102 to S105 sequentially until the parameters for all color regions to be tested on the calibration sample are entered, generating a 3D detection program. The generated 3D detection program is stored as an independent file in the non-volatile memory of the control processing unit 3. Users can directly open this file via an external computer or touchscreen interface to view and modify the coordinates or reference color values of any detection point, or copy and rename the file to adapt to different batches of products. This hardware-decoupled program architecture reduces the changeover time of the detection system from hours in traditional solutions to seconds.
[0050] The specific implementation of step S103 above is as follows: drive the axial adjustment mechanism 22 to move, and monitor the signal strength fed back by the single-point color measurement unit 1 in real time during the movement. Record the position of the axial adjustment mechanism 22 corresponding to the maximum signal strength as the target focus position, and use this target focus position as the preset height. For example, during the calibration process, the control processing unit 3 can use the following algorithm to achieve automatic focusing: first, drive the axial adjustment mechanism 22 to move from the initial position in one direction with a fixed step size. Record the total light intensity value I returned by the current color measurement unit for each step. When I drops more than three times in a row, it is determined that the peak value has been exceeded, and the search is switched to the reverse direction with a smaller step size. Find the middle position with the largest I value among the three adjacent positions as the precise focus point. As a specific and implementable parameter configuration, the step size of the coarse scanning stage can be set to 1 / 10 to 1 / 20 of the total stroke of the axial adjustment mechanism 22, and the step size of the fine scanning stage can be set to 1 / 3 to 1 / 5 of the coarse scanning step size. Taking a linear platform with a total travel of 20mm as an example, the coarse scan step size can be set to 1mm, and the fine scan step size to 0.2mm to 0.3mm. These parameters can be adjusted according to the required focusing accuracy and calibration time requirements. This strategy of coarse scanning followed by fine scanning improves calibration efficiency while ensuring focusing accuracy.
[0051] As a preferred calibration implementation method, Figure 5The detailed logic flow of the calibration procedure is shown. At the start of calibration, a standard sample is placed on the testing station. For the first color area to be tested, the operator can manually or automatically guide the measuring spot to roughly align with the center of the area using the control processing unit 3. Precise focusing is not required at this stage; it is only necessary to ensure the spot falls within the test area. Subsequently, the control processing unit 3 initiates the automatic focusing process: the system drives the axial adjustment mechanism 22 to move in small steps along the Z-axis, while simultaneously monitoring the intensity of the light signal fed back by the single-point color measurement unit 1 in real time. By fine-tuning the Z-axis position, the system finds the optimal signal peak, i.e., the optimal focus. Once the optimal focus is found, the system records the current three-dimensional spatial coordinates, including the two deflection angles of the two-dimensional scanning galvanometer 21 (corresponding to the X and Y coordinates) and the position of the axial adjustment mechanism 22 (corresponding to the Z coordinate). After completing the coordinate recording, the control processing unit 3 triggers the single-point color measurement unit 1 to acquire the color data of that point and saves it as the reference color value for that test point. The system then determines if there are any uncalibrated color areas. If so, it automatically guides the measurement optical path to the next area to be measured, repeating the above process of "rough alignment—autofocus—coordinate recording—reference acquisition" until all areas are calibrated. Finally, the system integrates the 3D coordinate parameters of all detection points and the corresponding reference color data into a single file, generates a complete 3D detection program, and stores it for subsequent batch detection.
[0052] Through the above technical solution, the three-dimensional detection program established in step S100 not only records the projection position of each detection point on the two-dimensional plane (characterized by the angle of the two reflecting mirrors), but also accurately records the height information of each detection point (characterized by the position of the axial adjustment mechanism 22). This enables the system to completely reproduce the optimal measurement conditions during calibration during subsequent detection, ensuring that the measurement results of different detection points have a consistent reference benchmark.
[0053] The present invention further proposes that step S200 includes steps S201 to S203.
[0054] Step S201: Place the workpiece 4 to be tested into the inspection station and call the 3D inspection program corresponding to the model of the workpiece 4. This calling process can be automatically triggered by the production line's MES system (Manufacturing Execution System) based on the current product model, or it can be manually selected by the operator by scanning the product barcode.
[0055] Step S202: Analyze the 3D detection program and extract the X-axis and Y-axis angle parameters corresponding to the target color region to be detected. These parameters are essentially the target angle values that the servo motor assembly 213 needs to drive the two reflective mirrors to achieve.
[0056] Step S203: Send a position control command to the servo motor assembly 213 to drive the first reflecting lens 211 and the second reflecting lens 212 to deflect accordingly, so as to guide and position the measurement optical path to the target color area to be measured. The servo motor assembly 213 is usually equipped with an angle encoder, which can realize closed-loop control to ensure the accuracy and repeatability of the lens deflection angle.
[0057] Specifically, step S300 includes steps S301 to S302.
[0058] Step S301: Extract the Z-axis height parameter corresponding to the target color region from the 3D detection program.
[0059] Step S302: Control the axial adjustment mechanism 22 to move to the physical position corresponding to the Z-axis height parameter to compensate for the axial height difference caused by surface unevenness or stepped structure of the target color area to be tested. It should be noted that this compensation is based on the relative height difference recorded during calibration, that is, the amount of movement of the axial adjustment mechanism 22 reflects the height difference between the current detection point and the corresponding point of the calibration sample (or is directly controlled by absolute position).
[0060] For example, for a product with a three-tiered surface, the three detection points are located on the stepped planes at different heights. During calibration, the axial adjustment mechanisms 22 corresponding to the three detection points are set to Z1=10.0mm, Z2=12.5mm, and Z3=15.2mm, respectively. During the detection phase, as the system sequentially accesses these three points, the control processing unit 3 drives the axial adjustment mechanisms 22 to positions of 10.0mm, 12.5mm, and 15.2mm, respectively, ensuring that each detection point is precisely focused. The Z-axis movement between points and the XY lens deflection can be synchronized; for example, the Z-axis motor can be started simultaneously with the lens deflection, allowing both to reach the target position at the same time, thus saving cycle time for each detection point.
[0061] Through the above technical solutions, steps S200 and S300 achieve rapid positioning and dynamic focusing of the measurement optical path. The two-dimensional scanning galvanometer 21 has a fast response speed (millisecond level). Although the axial adjustment mechanism 22 has a large moment of inertia, it only moves when switching detection points, and its movement stroke can be optimized within a small range. Therefore, the overall detection cycle can still meet the production line cycle requirements. More importantly, independent Z-axis compensation for each detection point solves the core problem in three-dimensional workpiece inspection.
[0062] The present invention further proposes that step S400 includes steps S401 to S402.
[0063] Step S401: After the two-dimensional scanning galvanometer 21 and the axial adjustment mechanism 22 have both reached their positions, a trigger acquisition command is sent to the single-point color measurement unit 1. When the control processing unit 3 determines that the movement has reached its position, it can either use a timer to delay and wait, or it can read the position signals of the servo motor group 213 and the axial adjustment mechanism 22 in real time to ensure the repeatability of the measurement.
[0064] Step S402: Read the RGB color value, color channel value, or chromaticity space coordinate value obtained from a single acquisition by the single-point color measurement unit 1 as real-time color data. The integration time of the single-point color measurement unit 1 can usually be set to several milliseconds to tens of milliseconds. After receiving the complete data, the control processing unit 3 associates and stores the data with the identification information of the current detection point.
[0065] The present invention further proposes that step S500 includes steps S501 to S503.
[0066] Step S501: Calculate the color difference between the real-time color data and the corresponding reference color data. In the RGB color space, the color difference can be calculated using the Euclidean distance formula: ΔE = √[(R 测 -R 基 )²+(G 测 -G 基 )²+(B 测 -B 基 If the Lab color space is used, then the CIE 1976 color difference formula is used: ΔE = √[(L²]. 测 -L 基 )²+(a 测 -a 基 )²+(b 测 -b 基 It should be noted that color difference calculation in the RGB color space is suitable for relative comparisons under the same lighting conditions and the same measurement system, and has the advantage of simple calculation; while the Lab color space is closer to human visual perception and is suitable for applications that require calibration with international standard color difference values. Those skilled in the art can choose the appropriate color space and color difference formula according to actual testing requirements.
[0067] Step S502: Determine whether the color difference value is within the preset tolerance range. If it is within the tolerance range, the target color area to be tested is deemed qualified; if it exceeds the tolerance range, the target color area to be tested is deemed unqualified. The tolerance range can be set according to product specifications. For example, for high-end interior parts that are sensitive to color difference, ΔE < 1.0 can be set as qualified; for general industrial products, ΔE < 2.5 can be set as qualified.
[0068] Step S503: Output the pass / fail judgment result of the target color area to be tested. The output method can be to output an OK / NG signal to the PLC through the I / O interface, or to upload the test data to the production management system for traceability.
[0069] As a specific implementation method, in actual production line applications, the test results can be further subdivided into multiple levels. For example, two tolerance thresholds ΔE1 and ΔE2 can be set. When ΔE < ΔE1, it is judged as Grade A (Excellent); when ΔE1 ≤ ΔE < ΔE2, it is judged as Grade B (Pass but with a tendency to drift, requiring attention); and when ΔE ≥ ΔE2, it is judged as NG (Unacceptable). This grading method helps production managers to detect color drift trends early and intervene in process parameters in advance.
[0070] Through the above technical solution, step S500 quantitatively compares the collected color data with the reference data, avoiding the subjectivity of human visual inspection and realizing the objectification, standardization and automation of color quality inspection.
[0071] The present invention further proposes that, after step S503, step S600 is included: determining whether all the color regions to be tested in the storage list of the 3D detection program have been traversed; if not, switching to the next target color region to be tested and returning to step S202; if the traversal has been completed, ending the current detection process and outputting the overall judgment summary result.
[0072] The presence of step S600 enables the entire inspection process to be executed automatically and cyclically without human intervention. Once all inspection points have been visited and judged, the system can output an inspection report containing detailed color data and judgment results for each inspection point. For batch inspection scenarios, this process can be automatically repeated for each workpiece, forming a continuous automated inspection capability.
[0073] As a preferred detection implementation method, Figure 6The detailed logic flow of automatic scanning and inspection is shown. At the start of inspection, the product to be tested is conveyed to the inspection station and positioned. The control processing unit 3 automatically calls the corresponding 3D inspection program based on the product model. After the program is loaded, the system first reads the 3D coordinate information of the first inspection point, drives the 2D scanning galvanometer 21 to guide the measurement optical path to the X and Y positions of the inspection point, and simultaneously drives the axial adjustment mechanism 22 to move to the corresponding Z-axis height. The system waits for a short stabilization period (usually tens of milliseconds) to ensure that the galvanometer and axial adjustment mechanism 22 are in position without jitter before triggering the single-point color measurement unit 1 to acquire color data. The acquired real-time color data is compared with the reference color value pre-stored in the program for that inspection point. The system determines whether the inspection point is qualified or unqualified according to the preset color difference tolerance range and records the result. Subsequently, the system checks if there are any undetected points in the program. If so, it automatically switches to the next inspection point, repeating the cycle of "guidance and positioning—axial focusing—stabilization and waiting—trigger acquisition—comparison and judgment" until all inspection points have been accessed. After completing the point-by-point judgment of all inspection points, the system integrates the pass / fail information of each point and outputs the overall judgment result of the product: if all inspection points are pass, the product is judged to be passable as a whole; if any inspection point is fail, the product is judged to be failable, and the system can further output the location and specific color difference value of the failable point for subsequent sorting or rework. Throughout the entire inspection process, the control processing unit 3 requires no manual intervention, realizing fully automatic, programmable multi-area color scanning and recognition.
[0074] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A multi-region color recognition system based on programmable three-dimensional scanning, characterized in that, include: A single-point color measurement unit is used to emit a detection beam and receive the single-point reflected light signal returning along the original optical path in order to collect color information. A three-dimensional beam guiding unit is connected to the optical path of the single-point color measurement unit and is used to control the deflection and focusing of the measurement optical path of the single-point color measurement unit in three-dimensional space. The three-dimensional beam guiding unit includes a two-dimensional scanning galvanometer and an axial adjustment mechanism. The two-dimensional scanning galvanometer includes a first reflecting mirror, a second reflecting mirror, and servo motor groups that independently control the deflection of the corresponding mirrors. The axial adjustment mechanism is mechanically connected to both the single-point color measurement unit and the two-dimensional scanning galvanometer and is used to drive the single-point color measurement unit and the two-dimensional scanning galvanometer to translate along a direction perpendicular to the surface of the workpiece to be measured. The control processing unit is electrically connected to the single-point color measurement unit, the servo motor group, and the axial adjustment mechanism, respectively. The control processing unit stores a programmable three-dimensional detection program, which is used to send angle deflection commands to the servo motor group to control the measurement optical path to perform planar two-dimensional scanning according to the program settings, and to send height adjustment commands to the axial adjustment mechanism to perform axial dynamic focusing. At the same time, it receives color data uploaded by the single-point color measurement unit for comparison and judgment.
2. The multi-region color recognition system based on programmable three-dimensional scanning according to claim 1, characterized in that, The axial adjustment mechanism is an electrically controlled single-axis moving platform, which includes a guide frame, a sliding slider slidably disposed on the guide frame, a mounting frame fixed on the sliding slider, and a drive motor. The single-point color measurement unit and the two-dimensional scanning galvanometer are both fixedly mounted on the mounting frame. The drive motor is electrically connected to the control processing unit and is used to drive the sliding slider to move in a direction perpendicular to the surface of the workpiece to be measured.
3. A multi-region color recognition method based on programmable 3D scanning, characterized in that, In the multi-region color recognition system as described in claim 1, the multi-region color recognition method includes the following steps: Step S100: Establish a corresponding three-dimensional detection program based on the calibration sample. The three-dimensional detection program includes the three-dimensional spatial coordinates of each color region to be tested on the calibration sample and the corresponding reference color data. Step S200: Based on the three-dimensional detection program, detect the workpiece to be tested, determine the target color area to be tested, and control the two-dimensional scanning galvanometer to guide and position the measurement optical path between the single-point color measurement unit and the target color area to be tested to the target color area. Step S300: Based on the height data in the three-dimensional spatial coordinate set, drive the axial adjustment mechanism to move and adjust the relative distance between the two-dimensional scanning galvanometer and the target color area to be measured for dynamic focusing; Step S400: Trigger the single-point color measurement unit to collect real-time color data of the target color area along the measurement optical path; Step S500: Compare the real-time color data with the corresponding reference color data in the three-dimensional spatial coordinate group, and output the color determination result of the target color area to be tested.
4. The multi-region color recognition method based on programmable three-dimensional scanning according to claim 3, characterized in that, Step S100 includes: Step S101: Place the calibration sample at the testing station; Step S102: Call the calibration control command to control the servo motor group to drive the first reflective lens and the second reflective lens to deflect to a preset angle, so that the measurement optical path between the single-point color measurement unit and one of the color areas to be measured of the calibration sample is guided and aligned by the first reflective lens and the second reflective lens; Step S103: Control the axial adjustment mechanism to move to a preset height so that the measurement optical path is focused on the current color area to be measured; Step S104: Trigger the single-point color measurement unit to collect the reference color data at the current position; Step S105: Store the current preset angle and preset height as a set of three-dimensional spatial coordinate parameters, corresponding to the reference color data, in the storage list of the three-dimensional detection program; Step S106: Repeat steps S102 to S105 sequentially until the parameter input of all color regions to be tested on the calibration sample is completed, and the three-dimensional detection program is generated.
5. A multi-region color recognition method based on programmable three-dimensional scanning according to claim 4, characterized in that, Step S103 includes: The axial adjustment mechanism is driven to move, and the signal strength fed back by the single-point color measurement unit is monitored in real time during the movement. The position of the axial adjustment mechanism when the signal strength reaches the maximum value is recorded as the target focus position, and the target focus position is used as the preset height.
6. The multi-region color recognition method based on programmable three-dimensional scanning according to claim 3, characterized in that, Step S200 includes: Step S201: Place the workpiece to be tested into the testing station and call the three-dimensional testing program corresponding to the model of the workpiece to be tested; Step S202: Analyze the three-dimensional detection program and extract the X-axis angle parameters and Y-axis angle parameters corresponding to the target color region to be detected. Step S203: Send a position control command to the servo motor group to drive the first reflective lens and the second reflective lens to deflect accordingly, so as to guide and position the measurement optical path to the target color area to be measured.
7. The multi-region color recognition method based on programmable three-dimensional scanning according to claim 6, characterized in that, Step S300 includes: Step S301: Extract the Z-axis height parameter corresponding to the target color region from the three-dimensional detection program; Step S302: Control the axial adjustment mechanism to move to the physical position corresponding to the Z-axis height parameter, so as to compensate for the axial height difference of the target color area to be tested due to surface unevenness or stepped structure.
8. The multi-region color recognition method based on programmable three-dimensional scanning according to claim 7, characterized in that, Step S400 includes: Step S401: After the two-dimensional scanning galvanometer and the axial adjustment mechanism have both moved into position, a trigger acquisition command is sent to the single-point color measurement unit; Step S402: Read the RGB color value, color channel value or color space coordinate value obtained by the single-point color measurement unit in a single acquisition, and use it as the real-time color data.
9. A multi-region color recognition method based on programmable three-dimensional scanning according to claim 8, characterized in that, Step S500 includes: Step S501: Calculate the color difference value between the real-time color data and the corresponding reference color data; Step S502: Determine whether the color difference value is within the preset tolerance range. If it is within the tolerance range, the target color area to be tested is determined to be qualified. If it exceeds the tolerance range, the target color area to be tested is determined to be unqualified. Step S503: Output the pass / fail judgment result of the target color area to be tested.
10. A multi-region color recognition method based on programmable three-dimensional scanning according to claim 9, characterized in that, Following step S503, the method further includes: Step S600: Determine whether all the color regions to be tested in the storage list of the 3D detection program have been traversed; if not, switch to the next target color region to be tested and return to execute step S202.