Measuring method, device, storage medium and product of a video measuring instrument

CN121112883BActive Publication Date: 2026-10-23GOOD VISION PRECISION INSTR CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511142916.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-15
Publication Date
2026-10-23
Estimated Expiration
2045-08-15

AI Technical Summary

Benefits of technology

通过获取标准测量仪与待测测量仪在相同光源环境下对目标样本进行拍摄分别得到的第一图像和第二图像,并基于第一图像的颜色信息和第二图像的颜色信息确定颜色通道映射模型,以基于颜色通道映射模型对待测测量仪所拍摄的待测产品图像进行校准,得到校准后的图像,并采用标准测量仪训练的检测模型对校准后的待测产品图像进行处理,得到待测产品的尺寸测量结果,能够实现检测模型在多影像测量仪之间的通用性,降低部署与维护的成本,还能提供待测测量仪量测的准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121112883B_ABST
    Figure CN121112883B_ABST
Patent Text Reader

Abstract

The application discloses a kind of image measuring instrument measurement method, equipment, storage medium and product, it is related to measurement technical field, discloses the measurement method of image measuring instrument, comprising: obtaining standard measuring instrument and the first image and the second image that are respectively obtained by being photographed to target sample under the same light source environment by to-be-measured measuring instrument;Color channel mapping model is determined based on the color information of first image and the color information of second image;Based on color channel mapping model, the to-be-measured product image photographed by to-be-measured measuring instrument is calibrated, and the image after calibration is obtained;Calling detection model processes the image after calibration, and obtains the measurement result of to-be-measured product;Wherein, detection model is trained based on the image data of standard measuring instrument.This application can realize the versatility of detection model between multiple image measuring instruments, reduce deployment and maintenance cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of measurement technology, and in particular to a measurement method, device, storage medium, and product for an image measuring instrument. Background Technology

[0002] With the development of industrial automation and precision manufacturing, machine vision dimensional inspection has become a core component of production quality control. As an automated inspection device integrating optical imaging and laser measurement technologies, image measuring instruments can perform dimensional measurements in industrial fields such as mobile phone accessories, home appliances, connectors, and precision mechanical parts.

[0003] In scenarios involving collaborative operation of multiple image measuring instruments, cross-device measurement presents significant limitations. Specifically, due to differences in hardware parameters between different devices, the same object often exhibits noticeable color differences in images captured by different devices. This color difference directly renders general artificial intelligence (AI) models trained on benchmark measuring devices unsuitable for images acquired by other devices, necessitating the separate training of AI models for each device and resulting in high deployment costs. Summary of the Invention

[0004] This application provides a measurement method, device, storage medium, and product for an image measuring instrument, which enables the universality of a general AI model across multiple image measuring instruments, reducing deployment and maintenance costs.

[0005] In a first aspect, this application provides a measurement method for an image measuring instrument, comprising: A first image and a second image are obtained by taking pictures of the target sample with a standard measuring instrument and a measuring instrument under test under the same light source environment, respectively. The first image is the target sample image taken by the standard measuring instrument, and the second image is the target sample image taken by the measuring instrument under test. A color channel mapping model is determined based on the color information of the first image and the color information of the second image; The image of the product under test captured by the measuring instrument under test is calibrated based on the color channel mapping model to obtain the calibrated image. The calibrated image is processed by calling the detection model to obtain the measurement result of the product under test; wherein, the detection model is trained based on the image data of the standard measuring instrument.

[0006] Secondly, this application also proposes an electronic device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the measurement method of the image measuring instrument as described above.

[0007] Thirdly, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the measurement method of the image measuring instrument as described above.

[0008] Fourthly, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the measurement method of the image measuring instrument as described above.

[0009] One or more technical solutions proposed in this application have at least the following technical effects: By acquiring a first image and a second image of the target sample under the same light source environment using a standard measuring instrument and the measuring instrument under test, respectively, and determining a color channel mapping model based on the color information of the first and second images, the image of the product under test captured by the measuring instrument under test is calibrated based on the color channel mapping model to obtain a calibrated image. The calibrated image of the product under test is then processed using a detection model trained on the standard measuring instrument to obtain the size measurement result of the product under test. This method enables the detection model to be universal among multiple image measuring instruments, reduces deployment and maintenance costs, and improves the accuracy of measurements taken by the measuring instrument under test. Attached Figure Description

[0010] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0011] Figure 1 A flowchart illustrating an embodiment of the measurement method of the image measuring instrument of this application; Figure 2 A comparison of the imaging images of the measuring instrument under test provided in this application before and after calibration; Figure 3 This is a schematic diagram of the hardware operating environment involved in the measurement method of the image measuring instrument in the embodiments of this application. Detailed Implementation

[0012] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0013] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0014] In related technologies, AI-based edge detection and circle finding for multi-device applications have certain limitations. The hardware parameters of sensors in different image measuring instruments have inherent differences. For example, the same object may appear as "green" and "brown" with significant discrepancies. Existing technologies mostly rely on the hardware parameters of the device itself for calibration. However, this approach makes it difficult to achieve a unified standard across devices. As a result, when deploying multiple devices, it is necessary to train an AI model separately for each device, which increases deployment costs.

[0015] Based on this, embodiments of this application provide a measurement method for an image measuring instrument, referring to... Figure 1 , Figure 1 This is a schematic flowchart of an embodiment of the measurement method of the image measuring instrument of this application.

[0016] In this embodiment, the measurement method of the image measuring instrument includes steps S10 to S40: Step S10: Obtain a first image and a second image respectively obtained by the standard measuring instrument and the measuring instrument under test taking pictures of the target sample under the same light source environment, wherein the first image is the target sample image taken by the standard measuring instrument and the second image is the target sample image taken by the measuring instrument under test.

[0017] In this embodiment, the standard measuring instrument and the measuring instrument under test are laser measuring instruments that integrate optical imaging and laser measurement technology, and can measure the length, area and other dimensions of objects.

[0018] In some implementations, a target object that frequently appears in the size detection scenario can be selected as the target sample. Then, a standard measuring instrument and the measuring instrument under test are controlled to capture images of the same target sample, resulting in a first image and a second image. The standard measuring instrument and the measuring instrument under test can capture multiple images continuously during the capture process, thereby obtaining multiple first images and multiple second images.

[0019] Specifically, there can be multiple measuring instruments under test. The standard measuring instrument can be a relatively stable one, and the image data captured by the standard measuring instrument has been pre-used in the training of the AI ​​model for edge detection. The AI ​​model trained from the image data captured by the standard measuring instrument serves as a universal detection model for multiple image measuring instruments, thereby reducing deployment costs.

[0020] In some implementations, the types of light sources include coaxial light, incident light, surface light, and bottom light.

[0021] The following is an explanation of the various light source types: Coaxial light: is a light source that is coaxial with the optical axis of a camera lens. The light is emitted from around or inside the lens and illuminates the target sample along a path parallel to the lens's shooting direction (i.e., perpendicular to the sample surface).

[0022] Spectral light, also known as "reflected light", is light that shines on the sample from above at an angle, is reflected off the sample surface, and then enters the camera lens.

[0023] A surface light is a light source that emits light uniformly over a large area (such as a flat panel lamp or a ring-shaped surface light source). The light shines on a large area above the sample, forming uniform diffuse reflection illumination.

[0024] Bottom lighting refers to a light source that shines from below the sample (on the side opposite the camera lens). The light penetrates the sample (or is reflected from the bottom of the sample) and enters the lens, which is a type of transmissive illumination.

[0025] Step S20: Determine the color channel mapping model based on the color information of the first image and the color information of the second image.

[0026] Specifically, the color information can be RGB channel color information, including the color component values ​​of the R channel, G channel and B channel. The color component values ​​of the R channel, G channel and B channel determine the color value of each pixel in the image.

[0027] In some implementations, regions with the same area range and average gray value in the first and second images can be selected for color information extraction to obtain color information of the first region and color information of the second region, respectively; then, a color channel mapping model is established based on the color information of the first region and the color information of the second region.

[0028] For example, if the average gray value of the pixel region from row 3 to row 13 of the first image is the same as the average gray value of the pixel region from row 2 to row 12 of the second image, then the color information of the pixel region from row 3 to row 13 of the first image is extracted to obtain the color information of the first region, and the color information of the pixel region from row 2 to row 12 of the second image is extracted to obtain the color information of the second region.

[0029] Specifically, the grayscale value of each pixel can be calculated using the following formula: , Where Gray is the grayscale value, R is the color component value of the R channel of the pixel, G is the color component value of the G channel of the pixel, and B is the color component value of the B channel of the pixel. Therefore, the average grayscale value of all pixels in the target area (i.e., the area where color information is extracted) can be calculated to obtain the average grayscale value of that area.

[0030] In some implementations, the above steps, determining the color channel mapping model based on the color information of the first image and the color information of the second image, may include: Based on color information, the color component values ​​of the pixels in the first and second images in each channel of the RGB color space are extracted. For each channel, a channel mapping function is established based on the color component values ​​of the pixels in the first and second images in the corresponding channel. The color channel mapping model is determined based on the channel mapping function of each channel.

[0031] In some implementations, the above steps, including establishing the channel mapping function for the corresponding channel based on the color component values ​​of the pixels in the first and second images in the corresponding channels, may include: Based on the color component values ​​of multiple pixels in the first image and multiple pixels in the second image in the corresponding channels, a channel mapping function for the corresponding channels is established through function fitting.

[0032] Specifically, multiple pixels in regions with the same area range and average gray value in the first and second images can be selected, and their color component values ​​in each channel can be obtained. For each channel, a function fitting is performed based on the color component values ​​in the corresponding channel to obtain the channel mapping function for the corresponding channel.

[0033] More specifically, the above steps, based on the color component values ​​of multiple pixels in the first image and multiple pixels in the second image in corresponding channels, to establish a channel mapping function for the corresponding channels through function fitting, may include: Calculate the frequency of occurrence of each color component value in each channel of the first image and the frequency of occurrence of each color component value in each channel of the second image; Based on the frequency of occurrence of each color component value of the first image in each channel, the cumulative probability corresponding to each color component value of the first image in each channel is calculated to obtain the first cumulative probability set of each channel. The cumulative probability in the first cumulative probability set is denoted as the first cumulative probability, and the color component value is denoted as the first color component value. Based on the frequency of occurrence of each color component value in each channel of the second image, the cumulative probability corresponding to each color component value in each channel of the second image is calculated to obtain the second cumulative probability set for each channel. The cumulative probability in the second cumulative probability set is denoted as the second cumulative probability, and the color component value is denoted as the second color component value. For each channel, find the first color component value and the second color component value in the first cumulative probability set and the second cumulative probability set of the corresponding channel such that the absolute value of the difference between the first cumulative probability and the second cumulative probability is less than a preset error threshold, and establish the corresponding pairing relationship between the first color component value and the second color component value. Record all paired first and second color component values ​​for each channel into the pairing table corresponding to each channel. For each channel, the first and second color component values ​​of each pair are selected from the pairing table of the corresponding channel and the function is fitted to obtain the channel mapping function of the corresponding channel.

[0034] As an example, taking the frequency of occurrence of the color component value 100 in the R channel of the first image as an example, the frequency of occurrence of the color component value 100 in the R channel of the first image = the number of pixels with a color component value of 100 in the R channel / the total number of pixels in the target area of ​​the first image.

[0035] As an example, suppose This represents the cumulative probability of the color component value y in the R channel of the first image. This represents the cumulative probability of the color component value y in the G channel of the first image. Let y represent the cumulative probability of the color component value y in the B channel of the first image, where 0 ≤ y ≤ 255; and assume that... This represents the cumulative probability of the color component value x in the R channel of the second image. This represents the cumulative probability of the color component value x in the G channel of the second image. Let x represent the cumulative probability of a color component value of x in the B channel of the second image, where 0 ≤ x ≤ 255. Then, find a set of (x, y) such that... ,in, This is a preset error threshold.

[0036] Finally, based on the paired first and second color component values ​​(x, y), a channel mapping function for the corresponding channel is obtained by constructing a polynomial fitting function. Taking the channel mapping function of the R channel as an example, suppose the polynomial fitting function of the R channel is expressed as... Then, substitute the first color component value and the second color component value (x, y) of each pair into the formula. The fitting yielded , and Then obtained through calculation , and Determine the channel mapping function for the R channel.

[0037] It should be noted that having the same average grayscale value only indicates that the overall brightness baseline of the selected areas in the first and second images is consistent, but it does not guarantee that the color ratios of the RGB three channels are the same. Different combinations of R, G, and B values ​​can still produce the same grayscale value. The essence of color is the numerical ratio of the R, G, and B channels. For example, the redness of red is determined by the R / G ratio and the R / B ratio. If this is ignored and mapping is directly established based on pixel position, such as pairing the pixel value of the i-th row and j-th column of the first image region with the pixel value of the same position in the second image region, different pixels may be associated, causing the mapping relationship to deviate completely from the true color characteristics.

[0038] This application uses statistical cumulative probability to ensure that the color component values ​​of the R, G, and B channels have consistent distribution patterns. For example, a pixel with R=100 in the calibration measuring instrument is mapped to a pixel with R=150 in the measuring instrument under test. This process essentially aligns the statistical distribution of red intensity between the standard measuring instrument and the measuring instrument under test. In this way, regardless of pixel position, as long as the proportion of pixels with "R value ≤ 100" in the calibration measuring instrument is the same as the proportion of pixels with "R value ≤ 150" in the measuring instrument under test, it means that the two devices perceive the proportion of the darker red areas in the same way.

[0039] By using this method based on cumulative probability distribution matching, each (x, y) pair used for function fitting can be the same feature point of the target sample, thus improving the accuracy of the constructed color channel mapping relationship.

[0040] Furthermore, considering that different measuring instruments have different light sensitivities to wavelengths, this difference can lead to wavelength-dependent nonlinear deviations in the RGB values ​​of the same color on different measuring instruments. Therefore, in the measurement method of the image measuring instrument in this embodiment, spectral response compensation is also performed on the channel mapping function of each channel. Specifically, in some embodiments, the above steps, determining the color channel mapping model based on the channel mapping function of each channel, include: Obtain the first spectral response curve and the second spectral response curve; wherein, the first spectral response curve is the spectral response curve of the sensor of the standard measuring instrument, and the second spectral response curve is the spectral response curve of the sensor of the measuring instrument under test; The spectral response difference coefficient between the instrument under test and the standard instrument is determined based on the first and second spectral response curves. The channel mapping function of each channel is corrected based on the spectral response difference coefficient to obtain the corrected channel mapping function. The color channel mapping model is determined based on each modified channel mapping function.

[0041] Specifically, the first spectral response curve records the response values ​​of the standard measuring instrument to each wavelength, and the second spectral response curve records the response values ​​of the measuring instrument under test to each wavelength. The first and second spectral response curves can be provided by the measuring instrument manufacturer. Alternatively, if the manufacturer does not provide them, the response values ​​of different measuring instruments at each wavelength can be obtained through the following methods: The output wavelength of the monochromator is controlled to be λ, and the intensity of the incident light at this wavelength λ is recorded. Then, the sensor of the measuring instrument is aligned with the output port of the monochromator, and the image output by the sensor is acquired. The average pixel value of the photosensitive area is extracted and recorded as S(λ). Then, the ratio of S(λ) to λ is calculated to obtain the response value.

[0042] Specifically, the above steps, based on the first and second spectral response curves, to determine the spectral response difference coefficient between the instrument under test and the standard instrument, may include: Each target wavelength is selected within the wavelength range corresponding to each channel, and then the response difference coefficient of each target wavelength in each channel is calculated.

[0043] For example, if the wavelength range of the R channel is 620-700nm, the wavelength range of the G channel is 540-570nm, and the wavelength range of the B channel is 430-480nm, then multiple target wavelengths can be selected in the 620-700nm range to obtain multiple target wavelengths for the R channel, multiple target wavelengths can be selected in the 540-570nm range to obtain multiple target wavelengths for the G channel, and multiple target wavelengths can be selected in the 430-480nm range to obtain multiple target wavelengths for the B channel.

[0044] Then, the response difference coefficients for each target wavelength in each channel are calculated as follows: , in, This represents the response difference coefficient for the k-th target wavelength in the corresponding channel. This represents the response value of the measuring instrument to the k-th target wavelength on the corresponding channel. This represents the response value of the standard measuring instrument to the k-th target wavelength on the corresponding channel.

[0045] Then, the response difference coefficients for all target wavelengths of the channel are averaged to obtain the spectral response correction coefficient for that channel.

[0046] Subsequently, the channel mapping function is determined based on the spectral response correction coefficient of that channel. Correction coefficients for the quadratic, linear, and constant terms in the equation: The correction factor for the quadratic term is: ,in, is the correction coefficient for the quadratic term, and m is the number of target wavelengths selected for the corresponding channel. Given that the color component value of the corresponding channel is x, and the target wavelength is The quadratic correlation coefficient, where the characteristic wavelengths of different channels are divided into multiple wavelength ranges in ascending order, when... When the color component value is in the range [L1, L2) and the color component value is in the range [D1, D2), Equal to q1, when When the color component value is in the range [L2, L3) and the color component value is in the range [D2, D3), Equal to q2, when When the color component value is in the range [L3, L4] and the color component value is in the range [D3, D4], It equals q3, where L1 <L2<L3<L4,D1<D2<D3<D4,q1<q2<q3。

[0047] The correction factor for the linear term is: ,in, is the correction factor for the first-order term, and m is the number of target wavelengths selected for the corresponding channel. Given that the color component value of the corresponding channel is x, and the target wavelength is The correlation coefficient of the first term, when When the color component values ​​are in the range [L5, L6) and the color component values ​​are in the range [D1, D2), Equal to p1, when When the color component values ​​are in the range [L6, L7) and the color component values ​​are in the range [D2, D3), Equal to p2, when When the color component values ​​are in the range [L7, L8) and [D3, D4], Equal to p3, where L5 <L6<L7<L8,p1<p2<p3。

[0048] The correction factor for the constant term is: ,in, is the correction factor for the constant term, and m is the number of target wavelengths selected for the corresponding channel. Given that the color component value of the corresponding channel is x, and the target wavelength is The correlation coefficient of the constant term, when When the color component values ​​are in the range [L9, L10) and the color component values ​​are in the range [D1, D2), For z1, when When the color component value is in the range [L10, L11) and the color component value is in the range [D2, D3), For z2, when When the color component value is in the range [L11, L12) and the color component value is in the range [D3, D4], For z3, where L9 <L10<L11<L12,z1<z2<z3。

[0049] It should be noted that the RGB sensor achieves color separation through a color filter array (CFA). The R-channel filter is designed to have high transmittance for red light and low transmittance for other wavelengths (such as green and blue). This means that when the intensity of red light in the environment is high, more photons can penetrate the R-channel filter, resulting in higher output color component values. Consequently, R-channel pixels with different x-values ​​are significantly affected by specific wavelengths. For example, the 200-255nm R-channel color component values ​​are mainly contributed by red light and are highly influenced by specific wavelengths within this band, while red light contributes very little to the 0-55nm R-channel color component values ​​and is less affected. By correlating the channel color component value x with wavelength, the weight of the spectral correction term is dynamically adjusted according to the x-value, ensuring that the spectral response correction accurately matches different pixel values ​​and improving mapping accuracy.

[0050] After obtaining the correction coefficients for the quadratic, linear, and constant terms, the correction coefficients for the quadratic term are added to the base coefficients of the quadratic term, the correction coefficients for the linear term are added to the base coefficients of the linear term, and the correction coefficients for the constant term are added to the base coefficients of the constant term, resulting in the corrected channel mapping function: Then, the corrected channel mapping functions for the R channel, G channel, and B channel are summarized to obtain the final color channel mapping model.

[0051] Furthermore, the measurement methods of the image measuring instrument may also include: By switching the light source type and controlling the standard measuring instrument and the measuring instrument under test to re-capture the target sample in the switched light source environment, a corresponding color channel mapping model is generated for each light source type based on the color information of the re-captured target sample image.

[0052] Specifically, the light source is switched, and the standard measuring instrument and the measuring instrument under test are controlled to take pictures of the target sample under the same light source environment. Then, the above steps S10 to S20 are executed to obtain the color channel mapping model corresponding to the switched light source. This process is repeated until the color channel mapping models of all types of light sources are obtained.

[0053] Step S30: Based on the color channel mapping model, calibrate the image of the product under test captured by the measuring instrument under test to obtain the calibrated image.

[0054] In some implementations, the current light source type is identified, and then the color channel mapping model corresponding to the light source type is invoked to calibrate the image of the product under test.

[0055] Specifically, the light source used by the measuring instrument under test when photographing the product under test is obtained. Then, the color channel mapping model of the corresponding light source type is called. The color component values ​​of each pixel in the image of the product under test in each channel are substituted into the channel mapping function of the corresponding channel to obtain the corrected color component values. The color component values ​​of each pixel in the image of the product under test in each channel are then modified to the corrected color component values ​​to obtain the calibrated image.

[0056] As an example, see Figure 2 , Figure 2 (a) in the image is the image captured by the standard measuring instrument. Figure 2 Image (b) is the image of the measuring instrument before calibration. Figure 2 (c) in the figure is the image of the measuring instrument under test after calibration.

[0057] Step S40: The detection model is called to process the calibrated image to obtain the measurement result of the product under test; wherein, the detection model is trained based on the image data of the standard measuring instrument.

[0058] The detection model is an artificial intelligence model pre-trained using image data captured by a standard measuring instrument. This model can perform edge detection on the image to obtain the measurement results of the product under test. The model can be trained using neural networks, deep learning, etc., and this application does not limit its training in this regard.

[0059] In the above scheme, a first image and a second image are obtained by taking pictures of the target sample with a standard measuring instrument and the measuring instrument under test under the same light source environment. A color channel mapping model is determined based on the color information of the first image and the second image. The image of the product under test taken by the measuring instrument under test is calibrated based on the color channel mapping model to obtain a calibrated image. The detection model trained with the standard measuring instrument processes the calibrated image, realizing the universality of the general AI model among multiple image measuring instruments, reducing the deployment and maintenance costs, and improving the accuracy of the measurement by the measuring instrument under test.

[0060] This application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the measurement method of the image measuring instrument in the first embodiment described above.

[0061] The following is for reference. Figure 3The diagram illustrates a structural schematic of an electronic device suitable for implementing embodiments of this application. The electronic devices in these embodiments may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 3 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0062] like Figure 3 As shown, the electronic device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the electronic device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. While electronic devices with various systems are shown in the figures, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.

[0063] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0064] The electronic device provided in this application employs the measurement method of the image measuring instrument in the above embodiments. Compared with the prior art, the beneficial effects of the electronic device provided in this application are the same as those of the measurement method of the image measuring instrument provided in the above embodiments, and other technical features of the electronic device are the same as those disclosed in the method of the previous embodiment, and will not be repeated here.

[0065] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0066] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, which are used to execute the measurement method of the image measuring instrument in the above embodiments.

[0067] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0068] The aforementioned computer-readable storage medium may be included in an electronic device or may exist independently without being assembled into an electronic device.

[0069] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0070] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0071] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0072] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., a computer program) for executing the measurement method of the image measuring instrument described above. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the measurement method of the image measuring instrument provided in the above embodiments, and will not be repeated here.

[0073] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the measurement method of the image measuring instrument as described above.

[0074] Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the measurement method of the image measuring instrument provided in the above embodiments, and will not be repeated here.

[0075] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A measurement method for an image measuring instrument, characterized in that, include: A first image and a second image are obtained by taking pictures of the target sample with a standard measuring instrument and a measuring instrument under test under the same light source environment, respectively. The first image is the target sample image taken by the standard measuring instrument, and the second image is the target sample image taken by the measuring instrument under test. Based on the color information of the first image and the color information of the second image, the color component values ​​of the pixels of the first image and the second image in each channel of the RGB color space are extracted. Calculate the frequency of occurrence of each color component value in each channel of the first image and the frequency of occurrence of each color component value in each channel of the second image; Based on the frequency of occurrence of each color component value of the first image in each channel, the cumulative probability corresponding to each color component value of the first image in each channel is calculated to obtain the first cumulative probability set of each channel. The cumulative probability in the first cumulative probability set is denoted as the first cumulative probability, and the color component value is denoted as the first color component value. Based on the frequency of occurrence of each color component value of the second image in each channel, the cumulative probability corresponding to each color component value of the second image in each channel is calculated to obtain the second cumulative probability set of each channel. The cumulative probability in the second cumulative probability set is denoted as the second cumulative probability, and the color component value is denoted as the second color component value. For each channel, find the first color component value and the second color component value in the first cumulative probability set and the second cumulative probability set of the corresponding channel such that the absolute value of the difference between the first cumulative probability and the second cumulative probability is less than a preset error threshold, and establish a pairing relationship between the first color component value and the second color component value. Record all paired first and second color component values ​​for each channel into the pairing table corresponding to each channel. For each channel, the first color component value and the second color component value of each pair are selected from the pairing table of the corresponding channel and the function is fitted to obtain the channel mapping function of the corresponding channel. Obtain a first spectral response curve and a second spectral response curve; wherein, the first spectral response curve is the spectral response curve of the sensor of the standard measuring instrument, and the second spectral response curve is the spectral response curve of the sensor of the measuring instrument under test; The spectral response difference coefficient between the instrument under test and the standard instrument is determined based on the first spectral response curve and the second spectral response curve. The determination of the spectral response difference coefficient between the instrument under test and the standard instrument based on the first spectral response curve and the second spectral response curve includes: Each target wavelength is selected within the wavelength range corresponding to each channel, and then the response difference coefficient of each target wavelength in each channel is calculated. The response difference coefficient is: ,in, This represents the response difference coefficient for the k-th target wavelength in the corresponding channel. This represents the response value of the measuring instrument to the k-th target wavelength on the corresponding channel. This represents the response value of the standard measuring instrument to the k-th target wavelength on the corresponding channel; The spectral response correction coefficient of the channel is obtained by averaging the response difference coefficients for all target wavelengths of the channel. The channel mapping function is determined based on the spectral response correction coefficient of the channel. The correction coefficients for the quadratic, linear, and constant terms in the equation, where, This represents the value of the second color component. Indicates and The paired first color component value; The correction factor for the quadratic term is: ,in, is the correction coefficient for the quadratic term, and m is the number of target wavelengths selected for the corresponding channel. Given that the color component value of the corresponding channel is x, and the target wavelength is The quadratic correlation coefficient, where the characteristic wavelengths of different channels are divided into multiple wavelength ranges in ascending order, when... When the color component value is in the range [L1, L2) and the color component value is in the range [D1, D2), Equal to q1, when When the color component value is in the range [L2, L3) and the color component value is in the range [D2, D3), Equal to q2, when When the color component value is in the range [L3, L4] and the color component value is in the range [D3, D4], It equals q3, where L1 <L2<L3<L4,D1<D2<D3<D4,q1<q2<q3; The correction factor for the linear term is: ,in, is the correction factor for the first-order term, and m is the number of target wavelengths selected for the corresponding channel. Given that the color component value of the corresponding channel is x, and the target wavelength is The correlation coefficient of the first term, when When the color component values ​​are in the range [L5, L6) and the color component values ​​are in the range [D1, D2), Equal to p1, when When the color component values ​​are in the range [L6, L7) and the color component values ​​are in the range [D2, D3), Equal to p2, when When the color component values ​​are in the range [L7, L8) and [D3, D4], Equal to p3, where L5 <L6<L7<L8,p1<p2<p3; The correction factor for the constant term is: ,in, is the correction factor for the constant term, and m is the number of target wavelengths selected for the corresponding channel. Given that the color component value of the corresponding channel is x, and the target wavelength is The correlation coefficient of the constant term, when When the color component values ​​are in the range [L9, L10) and the color component values ​​are in the range [D1, D2), For z1, when When the color component value is in the range [L10, L11) and the color component value is in the range [D2, D3), For z2, when When the color component value is in the range [L11, L12) and the color component value is in the range [D3, D4], For z3, where L9 <L10<L11<L12,z1<z2<z3; Based on the spectral response difference coefficient, the channel mapping function of each channel is corrected to obtain the corrected channel mapping function. The color channel mapping model is determined based on each modified channel mapping function; The image of the product under test captured by the measuring instrument under test is calibrated based on the color channel mapping model to obtain the calibrated image; The calibrated image is processed by calling the detection model to obtain the measurement result of the product under test; wherein, the detection model is trained based on the image data of the standard measuring instrument.

2. The measurement method of the image measuring instrument as described in claim 1, characterized in that, The method further includes: By switching the light source type and controlling the standard measuring instrument and the measuring instrument under test to re-capture the target sample in the switched light source environment, a corresponding color channel mapping model is generated for each light source type based on the color information of the re-captured target sample image.

3. The measurement method of the image measuring instrument as described in claim 2, characterized in that, The calibration of the product image captured by the measuring instrument under test based on the color channel mapping model includes: Obtain the type of light source used when photographing the product under test; The color channel mapping model corresponding to the light source type is invoked to calibrate the image of the product under test.

4. An electronic device, characterized in that, The electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the measurement method of the image measuring instrument as described in any one of claims 1 to 3.

5. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the measurement method of the image measuring instrument as described in any one of claims 1 to 3.

6. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the measurement method of the image measuring instrument as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Model training method, color difference correction method and device, medium and electronic equipment

    CN109903256A

  • Visible light detector visual function correction method based on spectrometer

    CN109990980A

  • Color correction method and device and readable storage medium

    CN111586300A